summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* export(): Process the export() command at generate time.Stephen Kelly2013-10-111-0/+6
| | | | | | | | | | | | Make the API for adding targets string based so that it can easily use cmGeneratorTarget. Teach the cmIncludeCommand to generate the exported file at configure-time instead if it is to be include()d. The RunCMake.ExportWithoutLanguage test now needs a dummy header.h file as expected error from export() is now reported after the missing file error.
* Merge topic 'INTERFACE_LIBRARY-target-type'Brad King2013-10-081-5/+11
|\ | | | | | | | | | | | | ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets 435c912 export: Add support for INTERFACE_LIBRARY targets fe73226 Add the INTERFACE_LIBRARY target type.
| * export: Add support for INTERFACE_LIBRARY targetsStephen Kelly2013-10-081-5/+11
| |
* | Export: Never treat private link libraries as public package dependencies.Stephen Kelly2013-09-241-1/+2
|/ | | | | | | | | | | | | | | Multiple libraries in a single buildsystem can be exported to multiple export-sets. If a library from one export set depends on a library from another export set, the export logic generates a check in the targets file to verify that the target in the other export set is found. That check is executed at downstream-find_package-time. However, a target may depend privately on a target in another export set. In that case, the depend used to also be listed in the required targets in the targets file. Change the export logic to ignore the private link entries instead.
* Export: Process generator expressions from INCLUDES DESTINATION.Stephen Kelly2013-07-311-3/+25
| | | | Configuration sensitive expressions are not permitted.
* Merge topic 'fix-export-includes-crash'Brad King2013-07-291-1/+1
|\ | | | | | | | | f868e47 Fix crash on export of target with empty INTERFACE_INCLUDE_DIRECTORIES.
| * Fix crash on export of target with empty INTERFACE_INCLUDE_DIRECTORIES.Stephen Kelly2013-07-291-1/+1
| | | | | | | | | | | | | | | | The new feature of install(TARGETS ... INCLUDES DESTINATION) introduced in commit 650e61f8 (Add a convenient way to add the includes install dir to the INTERFACE., 2013-01-05) introduced this crash. If the new feature is used with a target which has no INTERFACE_INCLUDE_DIRECTORIES, a segfault occurred.
* | Merge topic 'minor-cleanups'Brad King2013-07-291-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | b8dc7fa Genex: Disallow LINKER_LANGUAGE only when used on a static library. c8a10ba cmTarget: Fix iface libraries and languages for static libraries. f94bdb3 cmTarget: Remove duplicates when printing traces of tll signatures ff3d5fa Export: Fix typo of LINK_INTERFACE_LIBRARIES. 79a7a81 Docs: Document variables for default visibility values. 6f6391b Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs. d8cb47f Docs: Trim trailing whitespace in generated doc. f10e648 Docs: Document existing target property debugging options. 4f4d69f Qt4Macros: Simplify some variable population. a413a40 Qt4Macros: Remove undefined varible use. b60a29e Qt4Macros: Remove unneeded generate CONDITION. e454cba Docs: Document file(GENERATE) CONDITION as optional.
| * Export: Fix typo of LINK_INTERFACE_LIBRARIES.Stephen Kelly2013-07-261-1/+1
| | | | | | | | Refer correctly to the old property, not the new one.
* | Merge topic 'install-interface-relative'Brad King2013-07-261-1/+2
|\ \ | | | | | | | | | | | | d777b8e Genex: Allow relative paths in INSTALL_INTERFACE.
| * | Genex: Allow relative paths in INSTALL_INTERFACE.Stephen Kelly2013-07-251-1/+2
| | | | | | | | | | | | | | | | | | | | | These paths can be prepended with the ${_IMPORT_PREFIX} generated in the export file. Such relative paths were previously an error.
* | | Merge topic 'install-interface-includes'Brad King2013-07-261-4/+8
|\ \ \ | |/ / | | / | |/ |/| 650e61f Add a convenient way to add the includes install dir to the INTERFACE.
| * Add a convenient way to add the includes install dir to the INTERFACE.Stephen Kelly2013-07-241-4/+8
| | | | | | | | | | | | | | Export the INCLUDES DESTINATION without appending to the INTERFACE_INCLUDE_DIRECTORIES of the target itself. That way, a target can be exported multiple times with different INCLUDES DESTINATION without unintended cross-pollution of export sets.
* | export: Error when exporting a target without a languageBen Boeckel2013-07-251-0/+10
| | | | | | | | | | | | | | | | First, it prevents a NULL dereference and second it reiterates that targets without languages are not supported by CMake. Add a RunCMake.ExportWithoutLanguage test exporting a library without a languages.
* | ExportTargets: add one more comment to the generated file.Alex Neundorf2013-07-191-1/+3
|/ | | | | | | | This patch adds a comment above the block which protects the exported targets file against multiple inclusion, to make the file easier to understand for readers. Alex
* Export: Generate INTERFACE_LINK_LIBRARIES property on targets.Stephen Kelly2013-07-081-0/+50
| | | | | | | | | | This property is generated only for targets which have recorded policy CMP0022 as NEW, and a compatibility mode is added to additionally export the old interfaces in that case too. If the old interfaces are not exported, the generated export files require CMake 2.8.12. Because the unit tests use a version which is not yet called 2.8.12, temporarily require a lower version.
* Merge topic 'rpath-on-mac'Brad King2013-06-031-1/+5
|\ | | | | | | | | | | | | | | dc1d025 OS X: Add test for rpaths on Mac. 8576b3f OS X: Add support for @rpath in export files. 00d71bd Xcode: Add rpath support in Xcode generator. 94e7fef OS X: Add RPATH support for Mac.
| * OS X: Add support for @rpath in export files.Clinton Stimpson2013-06-031-1/+5
| | | | | | | | | | Also expand the IMPORTED_SONAME property for targets to match the install_name.
* | Add EXPORT_NAME property.Stephen Kelly2013-05-181-5/+7
|/ | | | | | This allows for example, the buildsystem to use names like 'boost_any' instead of the overly generic 'any', and still be able to generate IMPORTED targets called 'boost::any'.
* install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIESStephen Kelly2013-03-261-0/+111
| | | | | | | | | | Check that source and binary directories are not part of the INTERFACE_INCLUDE_DIRECTORIES for installed IMPORTED targets. This is limited to directories which do not contain generator expressions to evaluate. Such paths can only be checked at time of use of the imported target, which will be done in a follow up patch.
* Merge topic 'try_compile-targets'Brad King2013-02-251-0/+3
|\ | | | | | | | | | | | | 236133e Handle targets in the LINK_LIBRARIES of try_compile. 1c0597c Add a new Export generator for IMPORTED targets. f2ab17d Keep track of all targets seen while evaluating a genex.
| * Add a new Export generator for IMPORTED targets.Stephen Kelly2013-02-221-0/+3
| | | | | | | | | | | | This is to be used during try_compile using LINK_LIBRARIES in the srcfile signature and, in the future, TARGETS in the binary dir signature.
* | export files: rewrite the code for checking required targetsAlex Neundorf2013-02-201-13/+30
|/ | | | | | | | | | | Instead of generating a whole bunch of repeated if-statements now a foreach()-loop is generated in the targets-file. Also now a comment is inserted in the generated file if no targets from other export sets are used, so if somebody looks at the file he can see whether the information about missing imported targets has been generated or not. Alex
* Revert "Add a way to exclude INTERFACE properties from exported targets."Stephen Kelly2013-02-131-4/+3
| | | | | | | | This reverts commit 2c3654c3de718fe822f8960063373774fc019494. The removal of some tests added in commit 77cecb77 (Add includes and compile definitions with target_link_libraries., 2012-11-05) are also squashed into this commit.
* Revert "Add the $<LINKED:...> generator expression."Stephen Kelly2013-02-131-60/+6
| | | | | | | | | This reverts commit 0b92602b816e2584db3781b120a1e5200da72ada. Conflicts: Source/cmGeneratorExpressionEvaluator.cxx Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt Tests/CMakeCommands/target_include_directories/CMakeLists.txt
* Deduplicate the isGeneratorExpression method.Stephen Kelly2013-02-071-9/+1
| | | | This API seems like the most appropriate.
* Add the $<LINKED:...> generator expression.Stephen Kelly2013-01-311-6/+60
| | | | | | This is both a short form of using a TARGET_DEFINED expression together with a TARGET_PROPERTY definition, and a way to strip non-target content from interface properties when exporting.
* Add a way to exclude INTERFACE properties from exported targets.Stephen Kelly2013-01-311-3/+4
| | | | | | | | | | | | Projects set interface requirements upstream, and existing downstreams use of target_link_libraries will consume those interfaces. This can create a backward compatibility concern as the result may be changing the order of include directories of downstreams, or another side-effect of using the INTERFACE properties. Provide a way for them to emulate the behavior of a version-based policy in the config file.
* Advance more when preprocessing exported strings.Stephen Kelly2013-01-311-1/+1
| | | | | | When evaluating TARGET_PROPERTY here, we can skip to the comma location. We need to calculate it though as the string may have just been changed.
* Merge topic 'fix-TARGET_PROPERTY-extraction'Brad King2013-01-291-11/+3
|\ | | | | | | | | 5daaa5c Fix TARGET_PROPERTY target extractions.
| * Fix TARGET_PROPERTY target extractions.Stephen Kelly2013-01-291-11/+3
| | | | | | | | | | | | | | We need to make sure we can export targets which have content such as $<0:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES> That means making not finding a target non-fatal here.
* | Add the INSTALL_PREFIX genex.Stephen Kelly2013-01-271-0/+10
|/
* Add the COMPATIBLE_INTERFACE_STRING property.Stephen Kelly2013-01-241-0/+6
|
* Merge topic 'export-new-style-files'Brad King2013-01-231-61/+61
|\ | | | | | | | | 02d4e53 Generate new-style cmake code during export.
| * Generate new-style cmake code during export.Stephen Kelly2013-01-201-61/+61
| | | | | | | | Use empty end*() commands and lowercase commands.
* | Export the COMPATIBLE_INTERFACE_BOOL content propertiesStephen Kelly2013-01-211-0/+74
|/
* Export the INTERFACE_PIC property.Stephen Kelly2013-01-151-0/+12
|
* Move the exported check for dependencies of targetsStephen Kelly2013-01-151-2/+3
| | | | | Check only once, in the Config.cmake file, instead of once in each Config-<cfg>.cmake file.
* Only generate one check per missing target.Stephen Kelly2013-01-151-11/+15
|
* Don't write a comment in the export file without the code.Stephen Kelly2013-01-151-0/+4
|
* Allow generator expressions in LINK_INTERFACE_LIBRARIES.Stephen Kelly2013-01-101-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Config and IMPORTED_ variants may also contain generator expressions. If 'the implementation is the interface', then the result of evaluating the expressions at generate time is used to populate the IMPORTED_LINK_INTERFACE_LIBRARIES property. 1) In the case of non-static libraries, this is fine because the user still has the option to populate the LINK_INTERFACE_LIBRARIES with generator expressions if that is what is wanted. 2) In the case of static libraries, this prevents a footgun, enforcing that the interface and the implementation are really the same. Otherwise, the LINK_LIBRARIES could contain a generator expression which is evaluated with a different context at build time, and when used as an imported target. That would mean that the result of evaluating the INTERFACE_LINK_LIBRARIES property for a static library would not necessarily be the 'link implementation'. For example: add_library(libone STATIC libone.cpp) add_library(libtwo STATIC libtwo.cpp) add_library(libthree STATIC libthree.cpp) target_link_libraries(libtwo $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:libone>) target_link_libraries(libthree libtwo) If the LINK_LIBRARIES content was simply copied to the IMPORTED_LINK_INTERFACE_LIBRARIES, then libthree links to libone, but executables linking to libthree will not link to libone. 3) As the 'implementation is the interface' concept is to be deprecated in the future anyway, this should be fine.
* Split LINK_INTERFACE_LIBRARIES export handling into dedicated method.Stephen Kelly2013-01-101-3/+21
|
* Split the generator expression before extracting targets.Stephen Kelly2013-01-101-0/+45
| | | | | | | | | | | | Now that we're processing a LINK_INTERFACE_LIBRARIES string, it can contain targets. Make sure they are extracted for namespacing purposes. This needs to be restricted to strings which can actually have targets named in them. For example, this is not done for INTERFACE_COMPILE_DEFINITIONS, because even if there is a target named 'foo', the string 'foo' in that property means that '-Dfoo' will be set when compiling.
* Extract the AddTargetNamespace method.Stephen Kelly2013-01-101-95/+48
|
* Don't pass a position when determining if a target name is a literal.Stephen Kelly2013-01-101-1/+1
| | | | The lastPos refers to a position in a different string.
* Make linking APIs aware of 'head' targetStephen Kelly2013-01-081-1/+2
| | | | | | | | | | | The 'head' is the dependent target to be linked with the current target. It will be used to evaluate generator expressions with proper handling of mapped configurations and is used as the source target of properties. This requires that memoization is done with a key of a pair of target and config, instead of just config, because now the result also depends on the target. Removing the memoization entirely is not an option because it slows cmake down considerably.
* Add API to populate INTERFACE properties in exported targets.Stephen Kelly2013-01-051-0/+59
| | | | | The INTERFACE properties need to be preprocessed for context (build location or install location) and to extract target names etc.
* Add API to extract target names from a genex string.Stephen Kelly2013-01-051-0/+136
| | | | | | | The TARGET_NAME expression, which requires a literal, provides target names. $<TARGET_PROPERTY:tgt,prop> also provides target names in the cases where tgt is a literal, so that TARGET_NAME is not needed then in addition.
* Generate an early-return guard in target Export files.Stephen Kelly2012-11-301-0/+31
| | | | | | | | | | | | Previously it was necessary for writers of Config files which incude exported target files to write the guard themselves, but this was not immediately obvious or documented. Options for them would be to use a variable, or an INHERITED directory property in an effort to avoid accidental name clashes in all contexts in which find_package can be used. Getting this right requires boiler plate code, so generate a simpler check automatically instead.
* exports: define a CMAKE_FIND_PACKAGE_NAME var set by find_package()Alex Neundorf2012-09-301-1/+8
| | | | | | | | | This way the name of the searched package can be accessed in find-modules, config-files and more importantly in generated target export files. This is now used when a target export file detects that a required target does not exist. Alex