diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 1765 |
1 files changed, 331 insertions, 1434 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c9095df..2d7f720 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -16,9 +16,6 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmComputeLinkInformation.h" -#include "cmDocumentCompileDefinitions.h" -#include "cmDocumentGeneratorExpressions.h" -#include "cmDocumentLocationUndefined.h" #include "cmListFileCache.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" @@ -47,6 +44,8 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "UTILITY"; case cmTarget::GLOBAL_TARGET: return "GLOBAL_TARGET"; + case cmTarget::INTERFACE_LIBRARY: + return "INTERFACE_LIBRARY"; case cmTarget::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } @@ -217,1370 +216,14 @@ cmTarget::cmTarget() void cmTarget::DefineProperties(cmake *cm) { cm->DefineProperty - ("AUTOMOC", cmProperty::TARGET, - "Should the target be processed with automoc (for Qt projects).", - "AUTOMOC is a boolean specifying whether CMake will handle " - "the Qt moc preprocessor automatically, i.e. without having to use " - "the QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are " - "supported. " - "When this property is set to TRUE, CMake will scan the source files " - "at build time and invoke moc accordingly. " - "If an #include statement like #include \"moc_foo.cpp\" is found, " - "the Q_OBJECT class declaration is expected in the header, and moc is " - "run on the header file. " - "If an #include statement like #include \"foo.moc\" is found, " - "then a Q_OBJECT is expected in the current source file and moc " - "is run on the file itself. " - "Additionally, all header files are parsed for Q_OBJECT macros, " - "and if found, moc is also executed on those files. The resulting " - "moc files, which are not included as shown above in any of the source " - "files are included in a generated <targetname>_automoc.cpp file, " - "which is compiled as part of the target." - "This property is initialized by the value of the variable " - "CMAKE_AUTOMOC if it is set when a target is created.\n" - "Additional command line options for moc can be set via the " - "AUTOMOC_MOC_OPTIONS property.\n" - "By setting the CMAKE_AUTOMOC_RELAXED_MODE variable to TRUE the rules " - "for searching the files which will be processed by moc can be relaxed. " - "See the documentation for this variable for more details.\n" - "The global property AUTOMOC_TARGETS_FOLDER can be used to group the " - "automoc targets together in an IDE, e.g. in MSVS."); - - cm->DefineProperty - ("AUTOMOC_MOC_OPTIONS", cmProperty::TARGET, - "Additional options for moc when using automoc (see the AUTOMOC property)", - "This property is only used if the AUTOMOC property is set to TRUE for " - "this target. In this case, it holds additional command line options " - "which will be used when moc is executed during the build, i.e. it is " - "equivalent to the optional OPTIONS argument of the qt4_wrap_cpp() " - "macro.\n" - "By default it is empty."); - - cm->DefineProperty - ("BUILD_WITH_INSTALL_RPATH", cmProperty::TARGET, - "Should build tree targets have install tree rpaths.", - "BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link " - "the target in the build tree with the INSTALL_RPATH. This takes " - "precedence over SKIP_BUILD_RPATH and avoids the need for relinking " - "before installation. " - "This property is initialized by the value of the variable " - "CMAKE_BUILD_WITH_INSTALL_RPATH if it is set when a target is created."); - - cm->DefineProperty - ("COMPILE_FLAGS", cmProperty::TARGET, - "Additional flags to use when compiling this target's sources.", - "The COMPILE_FLAGS property sets additional compiler flags used " - "to build sources within the target. Use COMPILE_DEFINITIONS " - "to pass additional preprocessor definitions."); - - cm->DefineProperty - ("COMPILE_DEFINITIONS", cmProperty::TARGET, - "Preprocessor definitions for compiling a target's sources.", - "The COMPILE_DEFINITIONS property may be set to a " - "semicolon-separated list of preprocessor " - "definitions using the syntax VAR or VAR=value. Function-style " - "definitions are not supported. CMake will automatically escape " - "the value correctly for the native build system (note that CMake " - "language syntax may require escapes to specify some values). " - "This property may be set on a per-configuration basis using the name " - "COMPILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case name " - "(ex. \"COMPILE_DEFINITIONS_DEBUG\").\n" - "CMake will automatically drop some definitions that " - "are not supported by the native build tool. " - "The VS6 IDE does not support definition values with spaces " - "(but NMake does).\n" - "Contents of COMPILE_DEFINITIONS may use \"generator expressions\" with " - "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS - CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER); - - cm->DefineProperty - ("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::TARGET, - "Per-configuration preprocessor definitions on a target.", - "This is the configuration-specific version of COMPILE_DEFINITIONS."); - - cm->DefineProperty - ("COMPILE_OPTIONS", cmProperty::TARGET, - "List of options to pass to the compiler.", - "This property specifies the list of options specified " - "so far for this property. " - "This property exists on directories and targets." - "\n" - "The target property values are used by the generators to set " - "the options for the compiler.\n" - "Contents of COMPILE_OPTIONS may use \"generator expressions\" with " - "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INTERFACE_COMPILE_OPTIONS", cmProperty::TARGET, - "List of interface options to pass to the compiler.", - "Targets may populate this property to publish the compile options " - "required to compile against the headers for the target. Consuming " - "targets can add entries to their own COMPILE_OPTIONS property such " - "as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_OPTIONS> to use the " - "compile options specified in the interface of 'foo'." - "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("DEFINE_SYMBOL", cmProperty::TARGET, - "Define a symbol when compiling this target's sources.", - "DEFINE_SYMBOL sets the name of the preprocessor symbol defined when " - "compiling sources in a shared library. " - "If not set here then it is set to target_EXPORTS by default " - "(with some substitutions if the target is not a valid C " - "identifier). This is useful for headers to know whether they are " - "being included from inside their library or outside to properly " - "setup dllexport/dllimport decorations. "); - - cm->DefineProperty - ("DEBUG_POSTFIX", cmProperty::TARGET, - "See target property <CONFIG>_POSTFIX.", - "This property is a special case of the more-general <CONFIG>_POSTFIX " - "property for the DEBUG configuration."); - - cm->DefineProperty - ("<CONFIG>_POSTFIX", cmProperty::TARGET, - "Postfix to append to the target file name for configuration <CONFIG>.", - "When building with configuration <CONFIG> the value of this property " - "is appended to the target file name built on disk. " - "For non-executable targets, this property is initialized by the value " - "of the variable CMAKE_<CONFIG>_POSTFIX if it is set when a target is " - "created. " - "This property is ignored on the Mac for Frameworks and App Bundles."); - - cm->DefineProperty - ("EchoString", cmProperty::TARGET, - "A message to be displayed when the target is built.", - "A message to display on some generators (such as makefiles) when " - "the target is built."); - - cm->DefineProperty - ("BUNDLE", cmProperty::TARGET, - "This target is a CFBundle on the Mac.", - "If a module library target has this property set to true it will " - "be built as a CFBundle when built on the mac. It will have the " - "directory structure required for a CFBundle and will be suitable " - "to be used for creating Browser Plugins or other application " - "resources."); - - cm->DefineProperty - ("BUNDLE_EXTENSION", cmProperty::TARGET, - "The file extension used to name a BUNDLE target on the Mac.", - "The default value is \"bundle\" - you can also use \"plugin\" or " - "whatever file extension is required by the host app for your " - "bundle."); - - cm->DefineProperty - ("EXCLUDE_FROM_DEFAULT_BUILD", cmProperty::TARGET, - "Exclude target from \"Build Solution\".", - "This property is only used by Visual Studio generators 7 and above. " - "When set to TRUE, the target will not be built when you press " - "\"Build Solution\"."); - - cm->DefineProperty - ("EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>", cmProperty::TARGET, - "Per-configuration version of target exclusion from \"Build Solution\". ", - "This is the configuration-specific version of " - "EXCLUDE_FROM_DEFAULT_BUILD. If the generic EXCLUDE_FROM_DEFAULT_BUILD " - "is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> takes " - "precedence in configurations for which it has a value."); - - cm->DefineProperty - ("FRAMEWORK", cmProperty::TARGET, - "This target is a framework on the Mac.", - "If a shared library target has this property set to true it will " - "be built as a framework when built on the mac. It will have the " - "directory structure required for a framework and will be suitable " - "to be used with the -framework option"); - - cm->DefineProperty - ("HAS_CXX", cmProperty::TARGET, - "Link the target using the C++ linker tool (obsolete).", - "This is equivalent to setting the LINKER_LANGUAGE property to CXX. " - "See that property's documentation for details."); - - cm->DefineProperty - ("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM", cmProperty::TARGET, - "Specify #include line transforms for dependencies in a target.", - "This property specifies rules to transform macro-like #include lines " - "during implicit dependency scanning of C and C++ source files. " - "The list of rules must be semicolon-separated with each entry of " - "the form \"A_MACRO(%)=value-with-%\" (the % must be literal). " - "During dependency scanning occurrences of A_MACRO(...) on #include " - "lines will be replaced by the value given with the macro argument " - "substituted for '%'. For example, the entry\n" - " MYDIR(%)=<mydir/%>\n" - "will convert lines of the form\n" - " #include MYDIR(myheader.h)\n" - "to\n" - " #include <mydir/myheader.h>\n" - "allowing the dependency to be followed.\n" - "This property applies to sources in the target on which it is set."); - - cm->DefineProperty - ("IMPORT_PREFIX", cmProperty::TARGET, - "What comes before the import library name.", - "Similar to the target property PREFIX, but used for import libraries " - "(typically corresponding to a DLL) instead of regular libraries. " - "A target property that can be set to override the prefix " - "(such as \"lib\") on an import library name."); - - cm->DefineProperty - ("IMPORT_SUFFIX", cmProperty::TARGET, - "What comes after the import library name.", - "Similar to the target property SUFFIX, but used for import libraries " - "(typically corresponding to a DLL) instead of regular libraries. " - "A target property that can be set to override the suffix " - "(such as \".lib\") on an import library name."); - - cm->DefineProperty - ("IMPORTED", cmProperty::TARGET, - "Read-only indication of whether a target is IMPORTED.", - "The boolean value of this property is true for targets created with " - "the IMPORTED option to add_executable or add_library. " - "It is false for targets built within the project."); - - cm->DefineProperty - ("IMPORTED_CONFIGURATIONS", cmProperty::TARGET, - "Configurations provided for an IMPORTED target.", - "Set this to the list of configuration names available for an " - "IMPORTED target. " - "The names correspond to configurations defined in the project from " - "which the target is imported. " - "If the importing project uses a different set of configurations " - "the names may be mapped using the MAP_IMPORTED_CONFIG_<CONFIG> " - "property. " - "Ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_IMPLIB", cmProperty::TARGET, - "Full path to the import library for an IMPORTED target.", - "Set this to the location of the \".lib\" part of a windows DLL. " - "Ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_IMPLIB_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_IMPLIB property.", - "Configuration names correspond to those provided by the project " - "from which the target is imported."); - - cm->DefineProperty - ("IMPORTED_LINK_DEPENDENT_LIBRARIES", cmProperty::TARGET, - "Dependent shared libraries of an imported shared library.", - "Shared libraries may be linked to other shared libraries as part " - "of their implementation. On some platforms the linker searches " - "for the dependent libraries of shared libraries they are including " - "in the link. " - "Set this property to the list of dependent shared libraries of an " - "imported library. " - "The list " - "should be disjoint from the list of interface libraries in the " - "INTERFACE_LINK_LIBRARIES property. On platforms requiring " - "dependent shared libraries to be found at link time CMake uses this " - "list to add appropriate files or paths to the link command line. " - "Ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_LINK_DEPENDENT_LIBRARIES_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_LINK_DEPENDENT_LIBRARIES.", - "Configuration names correspond to those provided by the project " - "from which the target is imported. " - "If set, this property completely overrides the generic property " - "for the named configuration."); - - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_LIBRARIES", cmProperty::TARGET, - "Transitive link interface of an IMPORTED target.", - "Set this to the list of libraries whose interface is included when " - "an IMPORTED library target is linked to another target. " - "The libraries will be included on the link line for the target. " - "Unlike the LINK_INTERFACE_LIBRARIES property, this property applies " - "to all imported target types, including STATIC libraries. " - "This property is ignored for non-imported targets.\n" - "This property is ignored if the target also has a non-empty " - "INTERFACE_LINK_LIBRARIES property.\n" - "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."); - - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LIBRARIES.", - "Configuration names correspond to those provided by the project " - "from which the target is imported. " - "If set, this property completely overrides the generic property " - "for the named configuration.\n" - "This property is ignored if the target also has a non-empty " - "INTERFACE_LINK_LIBRARIES property.\n" - "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."); - - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_LANGUAGES", cmProperty::TARGET, - "Languages compiled into an IMPORTED static library.", - "Set this to the list of languages of source files compiled to " - "produce a STATIC IMPORTED library (such as \"C\" or \"CXX\"). " - "CMake accounts for these languages when computing how to link a " - "target to the imported library. " - "For example, when a C executable links to an imported C++ static " - "library CMake chooses the C++ linker to satisfy language runtime " - "dependencies of the static library. " - "\n" - "This property is ignored for targets that are not STATIC libraries. " - "This property is ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_LANGUAGES_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_LANGUAGES.", - "Configuration names correspond to those provided by the project " - "from which the target is imported. " - "If set, this property completely overrides the generic property " - "for the named configuration."); - - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET, - "Repetition count for cycles of IMPORTED static libraries.", - "This is LINK_INTERFACE_MULTIPLICITY for IMPORTED targets."); - cm->DefineProperty - ("IMPORTED_LINK_INTERFACE_MULTIPLICITY_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_LINK_INTERFACE_MULTIPLICITY.", - "If set, this property completely overrides the generic property " - "for the named configuration."); - - cm->DefineProperty - ("IMPORTED_LOCATION", cmProperty::TARGET, - "Full path to the main file on disk for an IMPORTED target.", - "Set this to the location of an IMPORTED target file on disk. " - "For executables this is the location of the executable file. " - "For bundles on OS X this is the location of the executable file " - "inside Contents/MacOS under the application bundle folder. " - "For static libraries and modules this is the location of the " - "library or module. " - "For shared libraries on non-DLL platforms this is the location of " - "the shared library. " - "For frameworks on OS X this is the location of the library file " - "symlink just inside the framework folder. " - "For DLLs this is the location of the \".dll\" part of the library. " - "For UNKNOWN libraries this is the location of the file to be linked. " - "Ignored for non-imported targets." - "\n" - "Projects may skip IMPORTED_LOCATION if the configuration-specific " - "property IMPORTED_LOCATION_<CONFIG> is set. " - "To get the location of an imported target read one of the " - "LOCATION or LOCATION_<CONFIG> properties."); - - cm->DefineProperty - ("IMPORTED_LOCATION_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_LOCATION property.", - "Configuration names correspond to those provided by the project " - "from which the target is imported."); - - cm->DefineProperty - ("IMPORTED_SONAME", cmProperty::TARGET, - "The \"soname\" of an IMPORTED target of shared library type.", - "Set this to the \"soname\" embedded in an imported shared library. " - "This is meaningful only on platforms supporting the feature. " - "Ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_SONAME_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_SONAME property.", - "Configuration names correspond to those provided by the project " - "from which the target is imported."); - - cm->DefineProperty - ("IMPORTED_NO_SONAME", cmProperty::TARGET, - "Specifies that an IMPORTED shared library target has no \"soname\". ", - "Set this property to true for an imported shared library file that " - "has no \"soname\" field. " - "CMake may adjust generated link commands for some platforms to prevent " - "the linker from using the path to the library in place of its missing " - "soname. " - "Ignored for non-imported targets."); - - cm->DefineProperty - ("IMPORTED_NO_SONAME_<CONFIG>", cmProperty::TARGET, - "<CONFIG>-specific version of IMPORTED_NO_SONAME property.", - "Configuration names correspond to those provided by the project " - "from which the target is imported."); - - cm->DefineProperty - ("EXCLUDE_FROM_ALL", cmProperty::TARGET, - "Exclude the target from the all target.", - "A property on a target that indicates if the target is excluded " - "from the default build target. If it is not, then with a Makefile " - "for example typing make will cause this target to be built. " - "The same concept applies to the default build of other generators. " - "Installing a target with EXCLUDE_FROM_ALL set to true has " - "undefined behavior."); - - cm->DefineProperty - ("LINK_LIBRARIES", cmProperty::TARGET, - "List of direct link dependencies.", - "This property specifies the list of libraries or targets which will be " - "used for linking. " - "In addition to accepting values from the target_link_libraries " - "command, values may be set directly on any target using the " - "set_property command. " - "\n" - "The target property values are used by the generators to set " - "the link libraries for the compiler. " - "See also the target_link_libraries command.\n" - "Contents of LINK_LIBRARIES may use \"generator expressions\" with " - "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INCLUDE_DIRECTORIES", cmProperty::TARGET, - "List of preprocessor include file search directories.", - "This property specifies the list of directories given " - "so far to the include_directories command. " - "This property exists on directories and targets. " - "In addition to accepting values from the include_directories " - "command, values may be set directly on any directory or any " - "target using the set_property command. " - "A target gets its initial value for this property from the value " - "of the directory property. " - "A directory gets its initial value from its parent directory if " - "it has one. " - "Both directory and target property values are adjusted by calls " - "to the include_directories command." - "\n" - "The target property values are used by the generators to set " - "the include paths for the compiler. " - "See also the include_directories command.\n" - "Contents of INCLUDE_DIRECTORIES may use \"generator expressions\" with " - "the syntax \"$<...>\". " - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INSTALL_NAME_DIR", cmProperty::TARGET, - "Mac OSX directory name for installed targets.", - "INSTALL_NAME_DIR is a string specifying the " - "directory portion of the \"install_name\" field of shared libraries " - "on Mac OSX to use in the installed targets. "); - - cm->DefineProperty - ("INSTALL_RPATH", cmProperty::TARGET, - "The rpath to use for installed targets.", - "A semicolon-separated list specifying the rpath " - "to use in installed targets (for platforms that support it). " - "This property is initialized by the value of the variable " - "CMAKE_INSTALL_RPATH if it is set when a target is created."); - - cm->DefineProperty - ("INSTALL_RPATH_USE_LINK_PATH", cmProperty::TARGET, - "Add paths to linker search and installed rpath.", - "INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will " - "append directories in the linker search path and outside the " - "project to the INSTALL_RPATH. " - "This property is initialized by the value of the variable " - "CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is " - "created."); - - cm->DefineProperty - ("INTERPROCEDURAL_OPTIMIZATION", cmProperty::TARGET, - "Enable interprocedural optimization for a target.", - "If set to true, enables interprocedural optimizations " - "if they are known to be supported by the compiler."); - - cm->DefineProperty - ("INTERPROCEDURAL_OPTIMIZATION_<CONFIG>", cmProperty::TARGET, - "Per-configuration interprocedural optimization for a target.", - "This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. " - "If set, this property overrides the generic property " - "for the named configuration."); - - cm->DefineProperty - ("LABELS", cmProperty::TARGET, - "Specify a list of text labels associated with a target.", - "Target label semantics are currently unspecified."); - - cm->DefineProperty - ("LINK_FLAGS", cmProperty::TARGET, - "Additional flags to use when linking this target.", - "The LINK_FLAGS property can be used to add extra flags to the " - "link step of a target. LINK_FLAGS_<CONFIG> will add to the " - "configuration <CONFIG>, " - "for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. "); - - cm->DefineProperty - ("LINK_FLAGS_<CONFIG>", cmProperty::TARGET, - "Per-configuration linker flags for a target.", - "This is the configuration-specific version of LINK_FLAGS."); - -#define CM_LINK_SEARCH_SUMMARY \ - "Some linkers support switches such as -Bstatic and -Bdynamic " \ - "to determine whether to use static or shared libraries for -lXXX " \ - "options. CMake uses these options to set the link type for " \ - "libraries whose full paths are not known or (in some cases) are in " \ - "implicit link directories for the platform. " - - cm->DefineProperty - ("LINK_SEARCH_START_STATIC", cmProperty::TARGET, - "Assume the linker looks for static libraries by default.", - CM_LINK_SEARCH_SUMMARY - "By default the linker search type is assumed to be -Bdynamic at " - "the beginning of the library list. This property switches the " - "assumption to -Bstatic. It is intended for use when linking an " - "executable statically (e.g. with the GNU -static option). " - "See also LINK_SEARCH_END_STATIC."); - - cm->DefineProperty - ("LINK_SEARCH_END_STATIC", cmProperty::TARGET, - "End a link line such that static system libraries are used.", - CM_LINK_SEARCH_SUMMARY - "By default CMake adds an option at the end of the library list (if " - "necessary) to set the linker search type back to its starting type. " - "This property switches the final linker search type to -Bstatic " - "regardless of how it started. " - "See also LINK_SEARCH_START_STATIC."); - - cm->DefineProperty - ("LINKER_LANGUAGE", cmProperty::TARGET, - "Specifies language whose compiler will invoke the linker.", - "For executables, shared libraries, and modules, this sets the " - "language whose compiler is used to link the target " - "(such as \"C\" or \"CXX\"). " - "A typical value for an executable is the language of the source " - "file providing the program entry point (main). " - "If not set, the language with the highest linker preference " - "value is the default. " - "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables." - "\n" - "If this property is not set by the user, it will be calculated at " - "generate-time by CMake." - ); - - cm->DefineProperty - ("LOCATION", cmProperty::TARGET, - "Read-only location of a target on disk.", - "For an imported target, this read-only property returns the value of " - "the LOCATION_<CONFIG> property for an unspecified configuration " - "<CONFIG> provided by the target.\n" - "For a non-imported target, this property is provided for compatibility " - "with CMake 2.4 and below. " - "It was meant to get the location of an executable target's output file " - "for use in add_custom_command. " - "The path may contain a build-system-specific portion that " - "is replaced at build time with the configuration getting built " - "(such as \"$(ConfigurationName)\" in VS). " - "In CMake 2.6 and above add_custom_command automatically recognizes a " - "target name in its COMMAND and DEPENDS options and computes the " - "target location. " - "In CMake 2.8.4 and above add_custom_command recognizes generator " - "expressions to refer to target locations anywhere in the command. " - "Therefore this property is not needed for creating custom commands." - CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property")); - - cm->DefineProperty - ("LOCATION_<CONFIG>", cmProperty::TARGET, - "Read-only property providing a target location on disk.", - "A read-only property that indicates where a target's main file is " - "located on disk for the configuration <CONFIG>. " - "The property is defined only for library and executable targets. " - "An imported target may provide a set of configurations different " - "from that of the importing project. " - "By default CMake looks for an exact-match but otherwise uses an " - "arbitrary available configuration. " - "Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported " - "configurations explicitly." - CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property")); - - cm->DefineProperty - ("LINK_DEPENDS", cmProperty::TARGET, - "Additional files on which a target binary depends for linking.", - "Specifies a semicolon-separated list of full-paths to files on which " - "the link rule for this target depends. " - "The target binary will be linked if any of the named files is newer " - "than it." - "\n" - "This property is ignored by non-Makefile generators. " - "It is intended to specify dependencies on \"linker scripts\" for " - "custom Makefile link rules."); - - cm->DefineProperty - ("LINK_DEPENDS_NO_SHARED", cmProperty::TARGET, - "Do not depend on linked shared library files.", - "Set this property to true to tell CMake generators not to add " - "file-level dependencies on the shared library files linked by " - "this target. " - "Modification to the shared libraries will not be sufficient to " - "re-link this target. " - "Logical target-level dependencies will not be affected so the " - "linked shared libraries will still be brought up to date before " - "this target is built." - "\n" - "This property is initialized by the value of the variable " - "CMAKE_LINK_DEPENDS_NO_SHARED if it is set when a target is " - "created."); - - cm->DefineProperty - ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET, - "List public interface libraries for a shared library or executable.", - "By default linking to a shared library target transitively " - "links to targets with which the library itself was linked. " - "For an executable with exports (see the ENABLE_EXPORTS property) " - "no default transitive link dependencies are used. " - "This property replaces the default transitive link dependencies with " - "an explicit list. " - "When the target is linked into another target the libraries " - "listed (and recursively their link interface libraries) will be " - "provided to the other target also. " - "If the list is empty then no transitive link dependencies will be " - "incorporated when this target is linked into another target even if " - "the default set is non-empty. " - "This property is initialized by the value of the variable " - "CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is " - "created. " - "This property is ignored for STATIC libraries.\n" - "This property is overriden by the INTERFACE_LINK_LIBRARIES property if " - "policy CMP0022 is NEW.\n" - "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."); - - cm->DefineProperty - ("LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET, - "Per-configuration list of public interface libraries for a target.", - "This is the configuration-specific version of " - "LINK_INTERFACE_LIBRARIES. " - "If set, this property completely overrides the generic property " - "for the named configuration.\n" - "This property is overriden by the INTERFACE_LINK_LIBRARIES property if " - "policy CMP0022 is NEW.\n" - "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."); - - cm->DefineProperty - ("INTERFACE_LINK_LIBRARIES", cmProperty::TARGET, - "List public interface libraries for a shared library or executable.", - "This property contains the list of transitive link dependencies. " - "When the target is linked into another target the libraries " - "listed (and recursively their link interface libraries) will be " - "provided to the other target also. " - "This property is overriden by the LINK_INTERFACE_LIBRARIES or " - "LINK_INTERFACE_LIBRARIES_<CONFIG> property if " - "policy CMP0022 is OLD or unset.\n" - "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET, - "List of public include directories for a library.", - "Targets may populate this property to publish the include directories " - "required to compile against the headers for the target. Consuming " - "targets can add entries to their own INCLUDE_DIRECTORIES property such " - "as $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES> to use the " - "include directories specified in the interface of 'foo'." - "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", cmProperty::TARGET, - "List of public system include directories for a library.", - "Targets may populate this property to publish the include directories " - "which contain system headers, and therefore should not result in " - "compiler warnings. Consuming targets will then mark the same include " - "directories as system headers." - "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("INTERFACE_COMPILE_DEFINITIONS", cmProperty::TARGET, - "List of public compile definitions for a library.", - "Targets may populate this property to publish the compile definitions " - "required to compile against the headers for the target. Consuming " - "targets can add entries to their own COMPILE_DEFINITIONS property such " - "as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_DEFINITIONS> to use the " - "compile definitions specified in the interface of 'foo'." - "\n" - CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS); - - cm->DefineProperty - ("LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET, - "Repetition count for STATIC libraries with cyclic dependencies.", - "When linking to a STATIC library target with cyclic dependencies the " - "linker may need to scan more than once through the archives in the " - "strongly connected component of the dependency graph. " - "CMake by default constructs the link line so that the linker will " - "scan through the component at least twice. " - "This property specifies the minimum number of scans if it is larger " - "than the default. " - "CMake uses the largest value specified by any target in a component."); - cm->DefineProperty - ("LINK_INTERFACE_MULTIPLICITY_<CONFIG>", cmProperty::TARGET, - "Per-configuration repetition count for cycles of STATIC libraries.", - "This is the configuration-specific version of " - "LINK_INTERFACE_MULTIPLICITY. " - "If set, this property completely overrides the generic property " - "for the named configuration."); - - cm->DefineProperty - ("MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::TARGET, - "Map from project configuration to IMPORTED target's configuration.", - "Set this to the list of configurations of an imported target that " - "may be used for the current project's <CONFIG> configuration. " - "Targets imported from another project may not provide the same set " - "of configuration names available in the current project. " - "Setting this property tells CMake what imported configurations are " - "suitable for use when building the <CONFIG> configuration. " - "The first configuration in the list found to be provided by the " - "imported target is selected. If this property is set and no matching " - "configurations are available, then the imported target is considered " - "to be not found. This property is ignored for non-imported targets.", - false /* TODO: make this chained */ ); - - cm->DefineProperty - ("OSX_ARCHITECTURES", cmProperty::TARGET, - "Target specific architectures for OS X.", - "The OSX_ARCHITECTURES property sets the target binary architecture " - "for targets on OS X. " - "This property is initialized by the value of the variable " - "CMAKE_OSX_ARCHITECTURES if it is set when a target is created. " - "Use OSX_ARCHITECTURES_<CONFIG> to set the binary architectures on a " - "per-configuration basis. " - "<CONFIG> is an upper-case name (ex: \"OSX_ARCHITECTURES_DEBUG\")."); - - cm->DefineProperty - ("OSX_ARCHITECTURES_<CONFIG>", cmProperty::TARGET, - "Per-configuration OS X binary architectures for a target.", - "This property is the configuration-specific version of " - "OSX_ARCHITECTURES."); - - cm->DefineProperty - ("NAME", cmProperty::TARGET, - "Logical name for the target.", - "Read-only logical name for the target as used by CMake."); - - cm->DefineProperty - ("EXPORT_NAME", cmProperty::TARGET, - "Exported name for target files.", - "This sets the name for the IMPORTED target generated when it this " - "target is is exported. " - "If not set, the logical target name is used by default."); - - cm->DefineProperty - ("OUTPUT_NAME", cmProperty::TARGET, - "Output name for target files.", - "This sets the base name for output files created for an executable or " - "library target. " - "If not set, the logical target name is used by default."); - - cm->DefineProperty - ("OUTPUT_NAME_<CONFIG>", cmProperty::TARGET, - "Per-configuration target file base name.", - "This is the configuration-specific version of OUTPUT_NAME."); - - cm->DefineProperty - ("ALIASED_TARGET", cmProperty::TARGET, - "Name of target aliased by this target.", - "If this is an ALIAS target, this property contains the name of the " - "target aliased."); - - cm->DefineProperty - ("<CONFIG>_OUTPUT_NAME", cmProperty::TARGET, - "Old per-configuration target file base name.", - "This is a configuration-specific version of OUTPUT_NAME. " - "Use OUTPUT_NAME_<CONFIG> instead."); - - cm->DefineProperty - ("PDB_NAME", cmProperty::TARGET, - "Output name for MS debug symbols .pdb file from linker.", - "Set the base name for debug symbols file created for an " - "executable or shared library target. " - "If not set, the logical target name is used by default. " - "\n" - "This property is not implemented by the Visual Studio 6 generator."); - - cm->DefineProperty - ("PDB_NAME_<CONFIG>", cmProperty::TARGET, - "Per-configuration name for MS debug symbols .pdb file. ", - "This is the configuration-specific version of PDB_NAME. " - "\n" - "This property is not implemented by the Visual Studio 6 generator."); - - cm->DefineProperty - ("PRE_INSTALL_SCRIPT", cmProperty::TARGET, - "Deprecated install support.", - "The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the " - "old way to specify CMake scripts to run before and after " - "installing a target. They are used only when the old " - "INSTALL_TARGETS command is used to install the target. Use the " - "INSTALL command instead."); - - cm->DefineProperty - ("PREFIX", cmProperty::TARGET, - "What comes before the library name.", - "A target property that can be set to override the prefix " - "(such as \"lib\") on a library name."); - - cm->DefineProperty - ("<LANG>_VISIBILITY_PRESET", cmProperty::TARGET, - "Value for symbol visibility compile flags", - "The <LANG>_VISIBILITY_PRESET property determines the value passed in " - "a visibility related compile option, such as -fvisibility= for <LANG>. " - "This property only has an affect for libraries and executables with " - "exports. This property is initialized by the value of the variable " - "CMAKE_<LANG>_VISIBILITY_PRESET if it is set when a target is created."); - - cm->DefineProperty - ("VISIBILITY_INLINES_HIDDEN", cmProperty::TARGET, - "Whether to add a compile flag to hide symbols of inline functions", - "The VISIBILITY_INLINES_HIDDEN property determines whether a flag for " - "hiding symbols for inline functions. the value passed used in " - "a visibility related compile option, such as -fvisibility=. This " - "property only has an affect for libraries and executables with " - "exports. This property is initialized by the value of the variable " - "CMAKE_VISIBILITY_INLINES_HIDDEN if it is set when a target is " - "created."); - - cm->DefineProperty - ("POSITION_INDEPENDENT_CODE", cmProperty::TARGET, - "Whether to create a position-independent target", - "The POSITION_INDEPENDENT_CODE property determines whether position " - "independent executables or shared libraries will be created. " - "This property is true by default for SHARED and MODULE library " - "targets and false otherwise. " - "This property is initialized by the value of the variable " - "CMAKE_POSITION_INDEPENDENT_CODE if it is set when a target is " - "created."); - - cm->DefineProperty - ("INTERFACE_POSITION_INDEPENDENT_CODE", cmProperty::TARGET, - "Whether consumers need to create a position-independent target", - "The INTERFACE_POSITION_INDEPENDENT_CODE property informs consumers of " - "this target whether they must set their POSITION_INDEPENDENT_CODE " - "property to ON. If this property is set to ON, then the " - "POSITION_INDEPENDENT_CODE property on all consumers will be set to " - "ON. Similarly, if this property is set to OFF, then the " - "POSITION_INDEPENDENT_CODE property on all consumers will be set to " - "OFF. If this property is undefined, then consumers will determine " - "their POSITION_INDEPENDENT_CODE property by other means. Consumers " - "must ensure that the targets that they link to have a consistent " - "requirement for their INTERFACE_POSITION_INDEPENDENT_CODE property."); - - cm->DefineProperty - ("COMPATIBLE_INTERFACE_BOOL", cmProperty::TARGET, - "Properties which must be compatible with their link interface", - "The COMPATIBLE_INTERFACE_BOOL property may contain a list of properties" - "for this target which must be consistent when evaluated as a boolean " - "in the INTERFACE of all linked dependees. For example, if a " - "property \"FOO\" appears in the list, then for each dependee, the " - "\"INTERFACE_FOO\" property content in all of its dependencies must be " - "consistent with each other, and with the \"FOO\" property in the " - "dependee. Consistency in this sense has the meaning that if the " - "property is set, then it must have the same boolean value as all " - "others, and if the property is not set, then it is ignored. Note that " - "for each dependee, the set of properties from this property must not " - "intersect with the set of properties from the " - "COMPATIBLE_INTERFACE_STRING property."); - - cm->DefineProperty - ("COMPATIBLE_INTERFACE_STRING", cmProperty::TARGET, - "Properties which must be string-compatible with their link interface", - "The COMPATIBLE_INTERFACE_STRING property may contain a list of " - "properties for this target which must be the same when evaluated as " - "a string in the INTERFACE of all linked dependees. For example, " - "if a property \"FOO\" appears in the list, then for each dependee, the " - "\"INTERFACE_FOO\" property content in all of its dependencies must be " - "equal with each other, and with the \"FOO\" property in the dependee. " - "If the property is not set, then it is ignored. Note that for each " - "dependee, the set of properties from this property must not intersect " - "with the set of properties from the COMPATIBLE_INTERFACE_BOOL " - "property."); - - cm->DefineProperty - ("POST_INSTALL_SCRIPT", cmProperty::TARGET, - "Deprecated install support.", - "The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the " - "old way to specify CMake scripts to run before and after " - "installing a target. They are used only when the old " - "INSTALL_TARGETS command is used to install the target. Use the " - "INSTALL command instead."); - - cm->DefineProperty - ("PRIVATE_HEADER", cmProperty::TARGET, - "Specify private header files in a FRAMEWORK shared library target.", - "Shared library targets marked with the FRAMEWORK property generate " - "frameworks on OS X and normal shared libraries on other platforms. " - "This property may be set to a list of header files to be placed " - "in the PrivateHeaders directory inside the framework folder. " - "On non-Apple platforms these headers may be installed using the " - "PRIVATE_HEADER option to the install(TARGETS) command."); - - cm->DefineProperty - ("PUBLIC_HEADER", cmProperty::TARGET, - "Specify public header files in a FRAMEWORK shared library target.", - "Shared library targets marked with the FRAMEWORK property generate " - "frameworks on OS X and normal shared libraries on other platforms. " - "This property may be set to a list of header files to be placed " - "in the Headers directory inside the framework folder. " - "On non-Apple platforms these headers may be installed using the " - "PUBLIC_HEADER option to the install(TARGETS) command."); - - cm->DefineProperty - ("RESOURCE", cmProperty::TARGET, - "Specify resource files in a FRAMEWORK shared library target.", - "Shared library targets marked with the FRAMEWORK property generate " - "frameworks on OS X and normal shared libraries on other platforms. " - "This property may be set to a list of files to be placed " - "in the Resources directory inside the framework folder. " - "On non-Apple platforms these files may be installed using the " - "RESOURCE option to the install(TARGETS) command."); - - cm->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::TARGET, - "Specify a launcher for compile rules.", - "See the global property of the same name for details. " - "This overrides the global and directory property for a target.", - true); + "", "", true); cm->DefineProperty ("RULE_LAUNCH_LINK", cmProperty::TARGET, - "Specify a launcher for link rules.", - "See the global property of the same name for details. " - "This overrides the global and directory property for a target.", - true); + "", "", true); cm->DefineProperty ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, - "Specify a launcher for custom rules.", - "See the global property of the same name for details. " - "This overrides the global and directory property for a target.", - true); - - cm->DefineProperty - ("SKIP_BUILD_RPATH", cmProperty::TARGET, - "Should rpaths be used for the build tree.", - "SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic " - "generation of an rpath allowing the target to run from the " - "build tree. " - "This property is initialized by the value of the variable " - "CMAKE_SKIP_BUILD_RPATH if it is set when a target is created."); - - cm->DefineProperty - ("NO_SONAME", cmProperty::TARGET, - "Whether to set \"soname\" when linking a shared library or module.", - "Enable this boolean property if a generated shared library or module " - "should not have \"soname\" set. Default is to set \"soname\" on all " - "shared libraries and modules as long as the platform supports it. " - "Generally, use this property only for leaf private libraries or " - "plugins. If you use it on normal shared libraries which other targets " - "link against, on some platforms a linker will insert a full path to " - "the library (as specified at link time) into the dynamic section of " - "the dependent binary. Therefore, once installed, dynamic loader may " - "eventually fail to locate the library for the binary."); - - cm->DefineProperty - ("SOVERSION", cmProperty::TARGET, - "What version number is this target.", - "For shared libraries VERSION and SOVERSION can be used to specify " - "the build version and API version respectively. When building or " - "installing appropriate symlinks are created if the platform " - "supports symlinks and the linker supports so-names. " - "If only one of both is specified the missing is assumed to have " - "the same version number. " - "SOVERSION is ignored if NO_SONAME property is set. " - "For shared libraries and executables on Windows the VERSION " - "attribute is parsed to extract a \"major.minor\" version number. " - "These numbers are used as the image version of the binary. "); - - cm->DefineProperty - ("STATIC_LIBRARY_FLAGS", cmProperty::TARGET, - "Extra flags to use when linking static libraries.", - "Extra flags to use when linking a static library."); - - cm->DefineProperty - ("STATIC_LIBRARY_FLAGS_<CONFIG>", cmProperty::TARGET, - "Per-configuration flags for creating a static library.", - "This is the configuration-specific version of STATIC_LIBRARY_FLAGS."); - - cm->DefineProperty - ("SUFFIX", cmProperty::TARGET, - "What comes after the target name.", - "A target property that can be set to override the suffix " - "(such as \".so\" or \".exe\") on the name of a library, module or " - "executable."); - - cm->DefineProperty - ("TYPE", cmProperty::TARGET, - "The type of the target.", - "This read-only property can be used to test the type of the given " - "target. It will be one of STATIC_LIBRARY, MODULE_LIBRARY, " - "SHARED_LIBRARY, EXECUTABLE or one of the internal target types."); - - cm->DefineProperty - ("VERSION", cmProperty::TARGET, - "What version number is this target.", - "For shared libraries VERSION and SOVERSION can be used to specify " - "the build version and API version respectively. When building or " - "installing appropriate symlinks are created if the platform " - "supports symlinks and the linker supports so-names. " - "If only one of both is specified the missing is assumed to have " - "the same version number. " - "For executables VERSION can be used to specify the build version. " - "When building or installing appropriate symlinks are created if " - "the platform supports symlinks. " - "For shared libraries and executables on Windows the VERSION " - "attribute is parsed to extract a \"major.minor\" version number. " - "These numbers are used as the image version of the binary. "); - - - cm->DefineProperty - ("WIN32_EXECUTABLE", cmProperty::TARGET, - "Build an executable with a WinMain entry point on windows.", - "When this property is set to true the executable when linked " - "on Windows will be created with a WinMain() entry point instead " - "of just main(). " - "This makes it a GUI executable instead of a console application. " - "See the CMAKE_MFC_FLAG variable documentation to configure use " - "of MFC for WinMain executables. " - "This property is initialized by the value of the variable " - "CMAKE_WIN32_EXECUTABLE if it is set when a target is created."); - - cm->DefineProperty - ("MACOSX_BUNDLE", cmProperty::TARGET, - "Build an executable as an application bundle on Mac OS X.", - "When this property is set to true the executable when built " - "on Mac OS X will be created as an application bundle. " - "This makes it a GUI executable that can be launched from " - "the Finder. " - "See the MACOSX_BUNDLE_INFO_PLIST target property for information " - "about creation of the Info.plist file for the application bundle. " - "This property is initialized by the value of the variable " - "CMAKE_MACOSX_BUNDLE if it is set when a target is created."); - - cm->DefineProperty - ("MACOSX_BUNDLE_INFO_PLIST", cmProperty::TARGET, - "Specify a custom Info.plist template for a Mac OS X App Bundle.", - "An executable target with MACOSX_BUNDLE enabled will be built as an " - "application bundle on Mac OS X. " - "By default its Info.plist file is created by configuring a template " - "called MacOSXBundleInfo.plist.in located in the CMAKE_MODULE_PATH. " - "This property specifies an alternative template file name which " - "may be a full path.\n" - "The following target properties may be set to specify content to " - "be configured into the file:\n" - " MACOSX_BUNDLE_INFO_STRING\n" - " MACOSX_BUNDLE_ICON_FILE\n" - " MACOSX_BUNDLE_GUI_IDENTIFIER\n" - " MACOSX_BUNDLE_LONG_VERSION_STRING\n" - " MACOSX_BUNDLE_BUNDLE_NAME\n" - " MACOSX_BUNDLE_SHORT_VERSION_STRING\n" - " MACOSX_BUNDLE_BUNDLE_VERSION\n" - " MACOSX_BUNDLE_COPYRIGHT\n" - "CMake variables of the same name may be set to affect all targets " - "in a directory that do not have each specific property set. " - "If a custom Info.plist is specified by this property it may of course " - "hard-code all the settings instead of using the target properties."); - - cm->DefineProperty - ("MACOSX_FRAMEWORK_INFO_PLIST", cmProperty::TARGET, - "Specify a custom Info.plist template for a Mac OS X Framework.", - "A library target with FRAMEWORK enabled will be built as a " - "framework on Mac OS X. " - "By default its Info.plist file is created by configuring a template " - "called MacOSXFrameworkInfo.plist.in located in the CMAKE_MODULE_PATH. " - "This property specifies an alternative template file name which " - "may be a full path.\n" - "The following target properties may be set to specify content to " - "be configured into the file:\n" - " MACOSX_FRAMEWORK_ICON_FILE\n" - " MACOSX_FRAMEWORK_IDENTIFIER\n" - " MACOSX_FRAMEWORK_SHORT_VERSION_STRING\n" - " MACOSX_FRAMEWORK_BUNDLE_VERSION\n" - "CMake variables of the same name may be set to affect all targets " - "in a directory that do not have each specific property set. " - "If a custom Info.plist is specified by this property it may of course " - "hard-code all the settings instead of using the target properties."); - - cm->DefineProperty - ("MACOSX_RPATH", cmProperty::TARGET, - "Whether to use rpaths on Mac OS X.", - "When this property is set to true, the directory portion of the" - "\"install_name\" field of shared libraries will default to \"@rpath\"." - "Runtime paths will also be embedded in binaries using this target." - "This property is initialized by the value of the variable " - "CMAKE_MACOSX_RPATH if it is set when a target is created."); - - cm->DefineProperty - ("ENABLE_EXPORTS", cmProperty::TARGET, - "Specify whether an executable exports symbols for loadable modules.", - "Normally an executable does not export any symbols because it is " - "the final program. It is possible for an executable to export " - "symbols to be used by loadable modules. When this property is " - "set to true CMake will allow other targets to \"link\" to the " - "executable with the TARGET_LINK_LIBRARIES command. " - "On all platforms a target-level dependency on the executable is " - "created for targets that link to it. " - "For DLL platforms an import library will be created for the " - "exported symbols and then used for linking. " - "All Windows-based systems including Cygwin are DLL platforms. " - "For non-DLL platforms that require all symbols to be resolved at " - "link time, such as Mac OS X, the module will \"link\" to the " - "executable using a flag like \"-bundle_loader\". " - "For other non-DLL platforms the link rule is simply ignored since " - "the dynamic loader will automatically bind symbols when the " - "module is loaded. " - ); - - cm->DefineProperty - ("Fortran_FORMAT", cmProperty::TARGET, - "Set to FIXED or FREE to indicate the Fortran source layout.", - "This property tells CMake whether the Fortran source files " - "in a target use fixed-format or free-format. " - "CMake will pass the corresponding format flag to the compiler. " - "Use the source-specific Fortran_FORMAT property to change the " - "format of a specific source file. " - "If the variable CMAKE_Fortran_FORMAT is set when a target " - "is created its value is used to initialize this property."); - - cm->DefineProperty - ("Fortran_MODULE_DIRECTORY", cmProperty::TARGET, - "Specify output directory for Fortran modules provided by the target.", - "If the target contains Fortran source files that provide modules " - "and the compiler supports a module output directory this specifies " - "the directory in which the modules will be placed. " - "When this property is not set the modules will be placed in the " - "build directory corresponding to the target's source directory. " - "If the variable CMAKE_Fortran_MODULE_DIRECTORY is set when a target " - "is created its value is used to initialize this property." - "\n" - "Note that some compilers will automatically search the module output " - "directory for modules USEd during compilation but others will not. " - "If your sources USE modules their location must be specified by " - "INCLUDE_DIRECTORIES regardless of this property."); - - cm->DefineProperty - ("GNUtoMS", cmProperty::TARGET, - "Convert GNU import library (.dll.a) to MS format (.lib).", - "When linking a shared library or executable that exports symbols " - "using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed " - "convert the import library (.dll.a) from GNU to MS format (.lib). " - "Both import libraries will be installed by install(TARGETS) and " - "exported by install(EXPORT) and export() to be linked by applications " - "with either GNU- or MS-compatible tools." - "\n" - "If the variable CMAKE_GNUtoMS is set when a target " - "is created its value is used to initialize this property. " - "The variable must be set prior to the first command that enables " - "a language such as project() or enable_language(). " - "CMake provides the variable as an option to the user automatically " - "when configuring on Windows with GNU tools."); - - cm->DefineProperty - ("XCODE_ATTRIBUTE_<an-attribute>", cmProperty::TARGET, - "Set Xcode target attributes directly.", - "Tell the Xcode generator to set '<an-attribute>' to a given value " - "in the generated Xcode project. Ignored on other generators."); - - cm->DefineProperty - ("GENERATOR_FILE_NAME", cmProperty::TARGET, - "Generator's file for this target.", - "An internal property used by some generators to record the name of the " - "project or dsp file associated with this target. Note that at configure " - "time, this property is only set for targets created by " - "include_external_msproject()."); - - cm->DefineProperty - ("SOURCES", cmProperty::TARGET, - "Source names specified for a target.", - "Read-only list of sources specified for a target. " - "The names returned are suitable for passing to the " - "set_source_files_properties command."); - - cm->DefineProperty - ("FOLDER", cmProperty::TARGET, - "Set the folder name. Use to organize targets in an IDE.", - "Targets with no FOLDER property will appear as top level " - "entities in IDEs like Visual Studio. Targets with the same " - "FOLDER property value will appear next to each other in a " - "folder of that name. To nest folders, use FOLDER values such " - "as 'GUI/Dialogs' with '/' characters separating folder levels."); - - cm->DefineProperty - ("PROJECT_LABEL", cmProperty::TARGET, - "Change the name of a target in an IDE.", - "Can be used to change the name of the target in an IDE " - "like Visual Studio. "); - cm->DefineProperty - ("VS_KEYWORD", cmProperty::TARGET, - "Visual Studio project keyword.", - "Can be set to change the visual studio keyword, for example " - "Qt integration works better if this is set to Qt4VSv1.0. "); - cm->DefineProperty - ("VS_SCC_PROVIDER", cmProperty::TARGET, - "Visual Studio Source Code Control Provider.", - "Can be set to change the visual studio source code control " - "provider property."); - cm->DefineProperty - ("VS_SCC_LOCALPATH", cmProperty::TARGET, - "Visual Studio Source Code Control Local Path.", - "Can be set to change the visual studio source code control " - "local path property."); - cm->DefineProperty - ("VS_SCC_PROJECTNAME", cmProperty::TARGET, - "Visual Studio Source Code Control Project.", - "Can be set to change the visual studio source code control " - "project name property."); - cm->DefineProperty - ("VS_SCC_AUXPATH", cmProperty::TARGET, - "Visual Studio Source Code Control Aux Path.", - "Can be set to change the visual studio source code control " - "auxpath property."); - cm->DefineProperty - ("VS_GLOBAL_PROJECT_TYPES", cmProperty::TARGET, - "Visual Studio project type(s).", - "Can be set to one or more UUIDs recognized by Visual Studio " - "to indicate the type of project. This value is copied " - "verbatim into the generated project file. Example for a " - "managed C++ unit testing project:\n" - " {3AC096D0-A1C2-E12C-1390-A8335801FDAB};" - "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\n" - "UUIDs are semicolon-delimited."); - cm->DefineProperty - ("VS_GLOBAL_KEYWORD", cmProperty::TARGET, - "Visual Studio project keyword.", - "Sets the \"keyword\" attribute for a generated Visual Studio " - "project. Defaults to \"Win32Proj\". You may wish to override " - "this value with \"ManagedCProj\", for example, in a Visual " - "Studio managed C++ unit test project."); - cm->DefineProperty - ("VS_GLOBAL_ROOTNAMESPACE", cmProperty::TARGET, - "Visual Studio project root namespace.", - "Sets the \"RootNamespace\" attribute for a generated Visual Studio " - "project. The attribute will be generated only if this is set."); - cm->DefineProperty - ("VS_DOTNET_TARGET_FRAMEWORK_VERSION", cmProperty::TARGET, - "Specify the .NET target framework version.", - "Used to specify the .NET target framework version for C++/CLI. " - "For example, \"v4.5\"."); - cm->DefineProperty - ("VS_DOTNET_REFERENCES", cmProperty::TARGET, - "Visual Studio managed project .NET references", - "Adds one or more semicolon-delimited .NET references to a " - "generated Visual Studio project. For example, \"System;" - "System.Windows.Forms\"."); - cm->DefineProperty - ("VS_WINRT_EXTENSIONS", cmProperty::TARGET, - "Visual Studio project C++/CX language extensions for Windows Runtime", - "Can be set to enable C++/CX language extensions."); - cm->DefineProperty - ("VS_WINRT_REFERENCES", cmProperty::TARGET, - "Visual Studio project Windows Runtime Metadata references", - "Adds one or more semicolon-delimited WinRT references to a " - "generated Visual Studio project. For example, \"Windows;" - "Windows.UI.Core\"."); - cm->DefineProperty - ("VS_GLOBAL_<variable>", cmProperty::TARGET, - "Visual Studio project-specific global variable.", - "Tell the Visual Studio generator to set the global variable " - "'<variable>' to a given value in the generated Visual Studio " - "project. Ignored on other generators. Qt integration works " - "better if VS_GLOBAL_QtVersion is set to the version " - "FindQt4.cmake found. For example, \"4.7.3\""); - -#define CM_TARGET_FILE_TYPES_DOC \ - "There are three kinds of target files that may be built: " \ - "archive, library, and runtime. " \ - "Executables are always treated as runtime targets. " \ - "Static libraries are always treated as archive targets. " \ - "Module libraries are always treated as library targets. " \ - "For non-DLL platforms shared libraries are treated as library " \ - "targets. " \ - "For DLL platforms the DLL part of a shared library is treated as " \ - "a runtime target and the corresponding import library is treated as " \ - "an archive target. " \ - "All Windows-based systems including Cygwin are DLL platforms." - -#define CM_TARGET_OUTDIR_DOC(TYPE, type) \ - "This property specifies the directory into which " #type " target " \ - "files should be built. " \ - "Multi-configuration generators (VS, Xcode) append " \ - "a per-configuration subdirectory to the specified directory. " \ - CM_TARGET_FILE_TYPES_DOC " " \ - "This property is initialized by the value of the variable " \ - "CMAKE_" #TYPE "_OUTPUT_DIRECTORY if it is set when a target is created." - -#define CM_TARGET_OUTDIR_CONFIG_DOC(TYPE) \ - "This is a per-configuration version of " #TYPE "_OUTPUT_DIRECTORY, " \ - "but multi-configuration generators (VS, Xcode) do NOT append " \ - "a per-configuration subdirectory to the specified directory. " \ - "This property is initialized by the value of the variable " \ - "CMAKE_" #TYPE "_OUTPUT_DIRECTORY_<CONFIG> " \ - "if it is set when a target is created." - - cm->DefineProperty - ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET, - "Output directory in which to build ARCHIVE target files.", - CM_TARGET_OUTDIR_DOC(ARCHIVE, archive)); - cm->DefineProperty - ("ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>", cmProperty::TARGET, - "Per-configuration output directory for ARCHIVE target files.", - CM_TARGET_OUTDIR_CONFIG_DOC(ARCHIVE)); - cm->DefineProperty - ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET, - "Output directory in which to build LIBRARY target files.", - CM_TARGET_OUTDIR_DOC(LIBRARY, library)); - cm->DefineProperty - ("LIBRARY_OUTPUT_DIRECTORY_<CONFIG>", cmProperty::TARGET, - "Per-configuration output directory for LIBRARY target files.", - CM_TARGET_OUTDIR_CONFIG_DOC(LIBRARY)); - cm->DefineProperty - ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET, - "Output directory in which to build RUNTIME target files.", - CM_TARGET_OUTDIR_DOC(RUNTIME, runtime)); - cm->DefineProperty - ("RUNTIME_OUTPUT_DIRECTORY_<CONFIG>", cmProperty::TARGET, - "Per-configuration output directory for RUNTIME target files.", - CM_TARGET_OUTDIR_CONFIG_DOC(RUNTIME)); - - cm->DefineProperty - ("PDB_OUTPUT_DIRECTORY", cmProperty::TARGET, - "Output directory for MS debug symbols .pdb file from linker.", - "This property specifies the directory into which the MS debug symbols " - "will be placed by the linker. " - "This property is initialized by the value of the variable " - "CMAKE_PDB_OUTPUT_DIRECTORY if it is set when a target is created." - "\n" - "This property is not implemented by the Visual Studio 6 generator."); - cm->DefineProperty - ("PDB_OUTPUT_DIRECTORY_<CONFIG>", cmProperty::TARGET, - "Per-configuration output directory for MS debug symbols .pdb files.", - "This is a per-configuration version of PDB_OUTPUT_DIRECTORY, " - "but multi-configuration generators (VS, Xcode) do NOT append " - "a per-configuration subdirectory to the specified directory. " - "This property is initialized by the value of the variable " - "CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> " - "if it is set when a target is created." - "\n" - "This property is not implemented by the Visual Studio 6 generator."); - - cm->DefineProperty - ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET, - "Output name for ARCHIVE target files.", - "This property specifies the base name for archive target files. " - "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. " - CM_TARGET_FILE_TYPES_DOC); - cm->DefineProperty - ("ARCHIVE_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET, - "Per-configuration output name for ARCHIVE target files.", - "This is the configuration-specific version of ARCHIVE_OUTPUT_NAME."); - cm->DefineProperty - ("LIBRARY_OUTPUT_NAME", cmProperty::TARGET, - "Output name for LIBRARY target files.", - "This property specifies the base name for library target files. " - "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. " - CM_TARGET_FILE_TYPES_DOC); - cm->DefineProperty - ("LIBRARY_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET, - "Per-configuration output name for LIBRARY target files.", - "This is the configuration-specific version of LIBRARY_OUTPUT_NAME."); - cm->DefineProperty - ("RUNTIME_OUTPUT_NAME", cmProperty::TARGET, - "Output name for RUNTIME target files.", - "This property specifies the base name for runtime target files. " - "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. " - CM_TARGET_FILE_TYPES_DOC); - cm->DefineProperty - ("RUNTIME_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET, - "Per-configuration output name for RUNTIME target files.", - "This is the configuration-specific version of RUNTIME_OUTPUT_NAME."); + "", "", true); } void cmTarget::SetType(TargetType type, const char* name) @@ -1637,6 +280,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("WIN32_EXECUTABLE", 0); this->SetPropertyDefault("MACOSX_BUNDLE", 0); this->SetPropertyDefault("MACOSX_RPATH", 0); + this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0); // Collect the set of configuration types. @@ -1649,6 +293,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) "LIBRARY_OUTPUT_DIRECTORY_", "RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_", + "MAP_IMPORTED_CONFIG_", 0}; for(std::vector<std::string>::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) @@ -1727,6 +372,14 @@ void cmTarget::SetMakefile(cmMakefile* mf) CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY) #undef CAPTURE_TARGET_POLICY + + if (this->TargetTypeValue == INTERFACE_LIBRARY) + { + // This policy is checked in a few conditions. The properties relevant + // to the policy are always ignored for INTERFACE_LIBRARY targets, + // so ensure that the conditions don't lead to nonsense. + this->PolicyStatusCMP0022 = cmPolicies::NEW; + } } //---------------------------------------------------------------------------- @@ -1792,6 +445,7 @@ bool cmTarget::IsLinkable() this->GetType() == cmTarget::SHARED_LIBRARY || this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY || + this->GetType() == cmTarget::INTERFACE_LIBRARY || this->IsExecutableWithExports()); } @@ -2463,6 +1117,29 @@ void cmTarget::GetDirectLinkLibraries(const char *config, } //---------------------------------------------------------------------------- +void cmTarget::GetInterfaceLinkLibraries(const char *config, + std::vector<std::string> &libs, cmTarget *head) +{ + const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); + if (prop) + { + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); + + cmGeneratorExpressionDAGChecker dagChecker(lfbt, + this->GetName(), + "INTERFACE_LINK_LIBRARIES", 0, 0); + cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, + config, + false, + head, + &dagChecker), + libs); + } +} + +//---------------------------------------------------------------------------- std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) { @@ -2568,8 +1245,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, return; } - { cmTarget *tgt = this->Makefile->FindTargetToUse(lib); + { const bool isNonImportedTarget = tgt && !tgt->IsImported(); const std::string libName = (isNonImportedTarget && llt != GENERAL) @@ -2580,7 +1257,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, llt).c_str()); } - if (cmGeneratorExpression::Find(lib) != std::string::npos) + if (cmGeneratorExpression::Find(lib) != std::string::npos + || (tgt && tgt->GetType() == INTERFACE_LIBRARY)) { return; } @@ -2662,6 +1340,11 @@ void cmTarget::FinalizeSystemIncludeDirectories() end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); @@ -2669,10 +1352,28 @@ void cmTarget::FinalizeSystemIncludeDirectories() ge.Parse(it->Value); std::string targetName = cge->Evaluate(this->Makefile, 0, false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetName.c_str())) + cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str()); + if (!tgt) { continue; } + if (tgt->IsImported() + && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES") + && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED")) + { + std::string includeGenex = "$<TARGET_PROPERTY:" + + it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>"; + if (cmGeneratorExpression::Find(it->Value) != std::string::npos) + { + // Because it->Value is a generator expression, ensure that it + // evaluates to the non-empty string before being used in the + // TARGET_PROPERTY expression. + includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">"; + } + this->SystemIncludeDirectories.insert(includeGenex); + return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset + // of the INTERFACE_INCLUDE_DIRECTORIES + } } std::string includeGenex = "$<TARGET_PROPERTY:" + it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>"; @@ -3038,15 +1739,11 @@ void cmTarget::SetProperty(const char* prop, const char* value) if (strcmp(prop, "LINK_LIBRARIES") == 0) { this->Internal->LinkInterfacePropertyEntries.clear(); - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.SetProperty(prop, value, cmProperty::TARGET); this->MaybeInvalidatePropertyCache(prop); @@ -3104,15 +1801,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value, } if (strcmp(prop, "LINK_LIBRARIES") == 0) { - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); this->MaybeInvalidatePropertyCache(prop); @@ -3246,19 +1939,56 @@ static void processIncludeDirectories(cmTarget *tgt, } } std::string usedIncludes; + cmListFileBacktrace lfbt; for(std::vector<std::string>::iterator li = entryIncludes.begin(); li != entryIncludes.end(); ++li) { - cmTarget *dependentTarget = - mf->FindTargetToUse((*it)->TargetName.c_str()); + std::string targetName = (*it)->TargetName; + std::string evaluatedTargetName; + { + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(targetName); + evaluatedTargetName = cge->Evaluate(mf, config, false, tgt, 0, 0); + } + + cmTarget *dependentTarget = mf->FindTargetToUse(targetName.c_str()); const bool fromImported = dependentTarget && dependentTarget->IsImported(); - if (fromImported && !cmSystemTools::FileExists(li->c_str())) + cmTarget *evaluatedDependentTarget = + (targetName != evaluatedTargetName) + ? mf->FindTargetToUse(evaluatedTargetName.c_str()) + : 0; + + targetName = evaluatedTargetName; + + const bool fromEvaluatedImported = evaluatedDependentTarget + && evaluatedDependentTarget->IsImported(); + + if ((fromImported || fromEvaluatedImported) + && !cmSystemTools::FileExists(li->c_str())) { cmOStringStream e; - e << "Imported target \"" << (*it)->TargetName << "\" includes " + cmake::MessageType messageType = cmake::FATAL_ERROR; + if (fromEvaluatedImported) + { + switch(mf->GetPolicyStatus(cmPolicies::CMP0027)) + { + case cmPolicies::WARN: + e << (mf->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n"; + case cmPolicies::OLD: + messageType = cmake::AUTHOR_WARNING; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; + } + } + e << "Imported target \"" << targetName << "\" includes " "non-existent path\n \"" << *li << "\"\nin its " "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n" "* The path was deleted, renamed, or moved to another " @@ -3267,7 +1997,7 @@ static void processIncludeDirectories(cmTarget *tgt, "successfully.\n" "* The installation package was faulty and references files it " "does not provide.\n"; - tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); return; } @@ -3276,9 +2006,9 @@ static void processIncludeDirectories(cmTarget *tgt, cmOStringStream e; bool noMessage = false; cmake::MessageType messageType = cmake::FATAL_ERROR; - if (!(*it)->TargetName.empty()) + if (!targetName.empty()) { - e << "Target \"" << (*it)->TargetName << "\" contains relative " + e << "Target \"" << targetName << "\" contains relative " "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" " \"" << *li << "\""; } @@ -3288,7 +2018,6 @@ static void processIncludeDirectories(cmTarget *tgt, { case cmPolicies::WARN: { - cmOStringStream w; e << (mf->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n"; messageType = cmake::AUTHOR_WARNING; @@ -3392,6 +2121,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3590,6 +2324,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3698,6 +2437,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -4077,6 +2821,43 @@ const char *cmTarget::GetProperty(const char* prop) } //---------------------------------------------------------------------------- +bool cmTarget::HandleLocationPropertyPolicy() +{ + if (this->IsImported()) + { + return true; + } + const char *modal = 0; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026)) + { + case cmPolicies::WARN: + modal = "should"; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + modal = "may"; + messageType = cmake::FATAL_ERROR; + } + + if (modal) + { + cmOStringStream e; + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; + e << "The LOCATION property " << modal << " not be read from target \"" + << this->GetName() << "\". Use the target name directly with " + "add_custom_command, or use the generator expression $<TARGET_FILE>, " + "as appropriate.\n"; + this->Makefile->IssueMessage(messageType, e.str().c_str()); + } + + return messageType != cmake::FATAL_ERROR; +} + +//---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const char* prop, cmProperty::ScopeType scope) { @@ -4096,10 +2877,16 @@ const char *cmTarget::GetProperty(const char* prop, this->GetType() == cmTarget::STATIC_LIBRARY || this->GetType() == cmTarget::SHARED_LIBRARY || this->GetType() == cmTarget::MODULE_LIBRARY || + this->GetType() == cmTarget::INTERFACE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { if(strcmp(prop,"LOCATION") == 0) { + if (!this->HandleLocationPropertyPolicy()) + { + return 0; + } + // Set the LOCATION property of the target. // // For an imported target this is the location of an arbitrary @@ -4115,18 +2902,26 @@ const char *cmTarget::GetProperty(const char* prop, // Support "LOCATION_<CONFIG>". if(strncmp(prop, "LOCATION_", 9) == 0) { + if (!this->HandleLocationPropertyPolicy()) + { + return 0; + } std::string configName = prop+9; this->SetProperty(prop, this->GetLocation(configName.c_str())); } else { - // Support "<CONFIG>_LOCATION" for compatiblity. + // Support "<CONFIG>_LOCATION" for compatibility. int len = static_cast<int>(strlen(prop)); if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0) { std::string configName(prop, len-9); if(configName != "IMPORTED") { + if (!this->HandleLocationPropertyPolicy()) + { + return 0; + } this->SetProperty(prop, this->GetLocation(configName.c_str())); } } @@ -4186,6 +2981,22 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } + if(strcmp(prop,"LINK_LIBRARIES") == 0) + { + static std::string output; + output = ""; + std::string sep; + for (std::vector<cmValueWithOrigin>::const_iterator + it = this->Internal->LinkInterfacePropertyEntries.begin(), + end = this->Internal->LinkInterfacePropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } if (strcmp(prop,"IMPORTED") == 0) { @@ -6004,6 +4815,10 @@ cmTarget::GetImportInfo(const char* config, cmTarget *headTarget) i = this->Internal->ImportInfoMap.insert(entry).first; } + if(this->GetType() == INTERFACE_LIBRARY) + { + return &i->second; + } // If the location is empty then the target is not available for // this configuration. if(i->second.Location.empty() && i->second.ImportLibrary.empty()) @@ -6152,7 +4967,51 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, const char* loc = 0; const char* imp = 0; std::string suffix; - if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix)) + if (this->GetType() != INTERFACE_LIBRARY && + !this->GetMappedConfig(desired_config, &loc, &imp, suffix)) + { + return; + } + + // Get the link interface. + { + std::string linkProp = "INTERFACE_LINK_LIBRARIES"; + const char *propertyLibs = this->GetProperty(linkProp.c_str()); + + if (this->GetType() != INTERFACE_LIBRARY) + { + if(!propertyLibs) + { + linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; + linkProp += suffix; + propertyLibs = this->GetProperty(linkProp.c_str()); + } + + if(!propertyLibs) + { + linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; + propertyLibs = this->GetProperty(linkProp.c_str()); + } + } + if(propertyLibs) + { + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + + cmGeneratorExpressionDAGChecker dagChecker(lfbt, + this->GetName(), + linkProp, 0, 0); + cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) + ->Evaluate(this->Makefile, + desired_config.c_str(), + false, + headTarget, + this, + &dagChecker), + info.LinkInterface.Libraries); + } + } + if(this->GetType() == INTERFACE_LIBRARY) { return; } @@ -6229,42 +5088,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } } - // Get the link interface. - { - std::string linkProp = "INTERFACE_LINK_LIBRARIES"; - const char *propertyLibs = this->GetProperty(linkProp.c_str()); - - if (!propertyLibs) - { - linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; - linkProp += suffix; - propertyLibs = this->GetProperty(linkProp.c_str()); - } - - if(!propertyLibs) - { - linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; - propertyLibs = this->GetProperty(linkProp.c_str()); - } - if(propertyLibs) - { - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - linkProp, 0, 0); - cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) - ->Evaluate(this->Makefile, - desired_config.c_str(), - false, - headTarget, - this, - &dagChecker), - info.LinkInterface.Libraries); - } - } - // Get the link dependencies. { std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES"; @@ -6493,6 +5316,25 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, { case cmPolicies::WARN: { + std::string oldLibraries; + std::string newLibraries; + const char *sep = ""; + for(std::vector<std::string>::const_iterator it + = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) + { + oldLibraries += sep; + oldLibraries += *it; + sep = ";"; + } + sep = ""; + for(std::vector<std::string>::const_iterator it + = ifaceLibs.begin(); it != ifaceLibs.end(); ++it) + { + newLibraries += sep; + newLibraries += *it; + sep = ";"; + } + cmOStringStream w; w << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n" @@ -6500,7 +5342,13 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, "INTERFACE_LINK_LIBRARIES property. This should be preferred " "as the source of the link interface for this library. " "Ignoring the property and using the link implementation " - "as the link interface instead."; + "as the link interface instead." + "\n" + "INTERFACE_LINK_LIBRARIES:\n " + << newLibraries + << "\n" + << "Link implementation:\n " + << oldLibraries << "\n"; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } // Fall through @@ -6525,6 +5373,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } + else if (this->GetType() == cmTarget::INTERFACE_LIBRARY) + { + explicitLibraries = newExplicitLibraries; + linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; + } // There is no implicit link interface for executables or modules // so if none was explicitly set then there is no link interface. @@ -6552,7 +5405,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, this, &dagChecker), iface.Libraries); if(this->GetType() == cmTarget::SHARED_LIBRARY - || this->GetType() == cmTarget::STATIC_LIBRARY) + || this->GetType() == cmTarget::STATIC_LIBRARY + || this->GetType() == cmTarget::INTERFACE_LIBRARY) { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. @@ -6681,6 +5535,46 @@ void cmTarget::ComputeLinkImplementation(const char* config, { continue; } + cmTarget *tgt = this->Makefile->FindTargetToUse(li->c_str()); + + if(!tgt && std::string(item).find("::") != std::string::npos) + { + bool noMessage = false; + cmake::MessageType messageType = cmake::FATAL_ERROR; + cmOStringStream e; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028)) + { + case cmPolicies::WARN: + { + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n"; + messageType = cmake::AUTHOR_WARNING; + } + break; + case cmPolicies::OLD: + noMessage = true; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Issue the fatal message. + break; + } + + if(!noMessage) + { + e << "Target \"" << this->GetName() << "\" links to target \"" << item + << "\" but the target was not found. Perhaps a find_package() " + "call is missing for an IMPORTED target, or a ALIAS target is " + "missing?"; + this->Makefile->GetCMakeInstance()->IssueMessage(messageType, + e.str(), + this->GetBacktrace()); + if (messageType == cmake::FATAL_ERROR) + { + return; + } + } + } // The entry is meant for this configuration. impl.Libraries.push_back(item); } @@ -6823,13 +5717,16 @@ void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee, std::vector<std::string> props; cmSystemTools::ExpandListArgument(prop, props); + std::string pdir = + dependee->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT"); + pdir += "/Help/prop_tgt/"; for(std::vector<std::string>::iterator pi = props.begin(); pi != props.end(); ++pi) { - if (depender->GetMakefile()->GetCMakeInstance() - ->GetIsPropertyDefined(pi->c_str(), - cmProperty::TARGET)) + std::string pname = cmSystemTools::HelpFileName(*pi); + std::string pfile = pdir + pname + ".rst"; + if(cmSystemTools::FileExists(pfile.c_str(), true)) { cmOStringStream e; e << "Target \"" << dependee->GetName() << "\" has property \"" |