![]() Must use to correctly compile and link with the target they appear on.įor any binary target, the contents of each INTERFACE_ property onĮach target specified in a target_link_libraries() command is Usage Requirements - they specify content which consumers INTERFACE_COMPILE_OPTIONS target properties are The contents of the INTERFACE_INCLUDE_DIRECTORIES, Special separate handling, such as POSITION_INDEPENDENT_CODE. In the order of appearance in the property value. ![]() TheĭEFINE_SYMBOL target property is also added as a compileĭefinition as a special convenience case for SHARED and MODULEĮntries in the COMPILE_OPTIONS are escaped for the shell and added D and added to the compile line in an unspecified order. With -I or -isystem prefixes and in the order of appearance in theĮntries in the COMPILE_DEFINITIONS are prefixed with -D or Properties are used appropriately when compiling the source files of aĮntries in the INCLUDE_DIRECTORIES are added to the compile line Target Properties ¶ĬOMPILE_DEFINITIONS and COMPILE_OPTIONS target That must be taken when specifying usage requirements while creating See the Creating Relocatable Packages section of theĬmake-packages(7) manual for discussion of additional care The properties must be requirements, not merely recommendations or Note that usage requirements are not designed as a way to make downstreamsĬOMPILE_DEFINITIONS etc for convenience only. Target_compile_definitions( archive PRIVATE BUILDING_WITH_LZMA INTERFACE USING_ARCHIVE_LIB ) The PUBLIC mode populates both variants of the respective target property.Įach command may be invoked with multiple uses of each keyword: Property and the INTERFACE mode populates only the INTERFACE_ variants. PRIVATE mode populates only the non- INTERFACE_ variant of the target INTERFACE_INCLUDE_DIRECTORIES, INTERFACE_COMPILE_DEFINITIONSĪnd INTERFACE_COMPILE_OPTIONS target properties.Įach of the commands has a PRIVATE, PUBLIC and INTERFACE mode. INCLUDE_DIRECTORIES, COMPILE_DEFINITIONS andĬOMPILE_OPTIONS target properties respectively, and/or the The target_include_directories(), target_compile_definitions()Īnd target_compile_options() commands specify the build specificationsĪnd the usage requirements of binary targets. Build Specification and Usage Requirements ¶ The list of objects can be used by add_custom_command(OUTPUT) Object libraries may not be used as the TARGET in a use of theĪdd_custom_command(TARGET) command signature. Will propagate transitively to dependents of those other targets. ![]() Usage requirements of the OBJECT libraries will be honored when compiling ![]() The link (or archiving) step of those other targets will use the objectįiles from OBJECT libraries that are directly linked. ![]() Dependencies between binary targets are expressed usingĪdd_library( archive OBJECT archive.cpp zip.cpp lzma.cpp ) add_library( archiveExtras STATIC extras.cpp ) target_link_libraries( archiveExtras PUBLIC archive ) add_executable( test_exe test.cpp ) target_link_libraries( test_exe archive ) The resulting binary files haveĪppropriate PREFIX, SUFFIX and extensions for the Binary Targets ¶Įxecutables and libraries are defined using the add_executable()Īnd add_library() commands. Targets are expressed in the buildsystem to determine the build orderĪnd the rules for regeneration in response to change. Is a custom target containing custom commands. Each target corresponds to an executable or library, or Include Directories and Usage RequirementsĪ CMake-based buildsystem is organized as a set of high-level logical Build Specification and Usage Requirementsīuild Specification with Generator Expressions ![]()
0 Comments
Leave a Reply. |