

Alias Executables add_executable( ALIAS )Ĭreates an Alias Target, such that can be used to refer to in subsequent commands. See documentation of the IMPORTED_* properties for more information. The most important such property is IMPORTED_LOCATION (and its per-configuration version IMPORTED_LOCATION_) which specifies the location of the main executable file on disk. Details about the imported executable are specified by setting properties whose names begin in IMPORTED_. IMPORTED executables are useful for convenient reference from commands like add_custom_command(). It may be referenced like any target built within the project. The target name has scope in the directory in which it is created and below, but the GLOBAL option extends visibility.

No rules are generated to build it, and the IMPORTED target property is True. The OUTPUTNAME target property affects deployment settings on Android, but those settings are written out as part of finalizing the. qtaddexecutable(simpleapp main.cpp) The following example shows a scenario where finalization must be deferred. These files contain logic to set build options, resolve external project dependencies, and add executable and library targets. Imported Executables add_executable( IMPORTED )Īn IMPORTED executable target references an executable file located outside the project. When using CMake 3.19 or later, finalization will occur at the end of the current directory scope. See also HEADER_FILE_ONLY on what to do if some sources are pre-processed, and you want to have the original sources reachable from within IDE.
#Cmake add executable manual
See the cmake-buildsystem(7) manual for more on defining buildsystem properties. New in version 3.11: An ALIAS can target a GLOBAL Imported Target.
The#Cmake add executable archive
See documentation of the EXCLUDE_FROM_ALL target property for details. An object library compiles source files but does not archive or link their object files into a library. If EXCLUDE_FROM_ALL is given the corresponding property will be set on the created target. See documentation of the MACOSX_BUNDLE target property for details. If MACOSX_BUNDLE is given the corresponding property will be set on the created target. See documentation of that target property for details. If WIN32 is given the property WIN32_EXECUTABLE will be set on the target created. See documentation of the OUTPUT_NAME target property to change the part of the final file name. See documentation of the RUNTIME_OUTPUT_DIRECTORY target property to change this location. New in version 3.11: The source files can be omitted if they are added later using target_sources().īy default the executable file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked.
