summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Add $<SEMICOLON> generator expression.Jean-Christophe Fillion-Robin2013-03-121-0/+18
| | | | | This expression is useful to put a ';' in a command line argument without dividing the argument during CMake list expansion.
* Merge topic 'remove-TARGET_DEFINED-genex'Brad King2013-03-041-18/+0
|\ | | | | | | | | | | | | | | cbf0756 Revert "Add the TARGET_DEFINED generator expression" 21a342c Remove use of TARGET_DEFINED from the target_link_libraries test. 47b8d32 Remove use of TARGET_DEFINED from the ExportImport test. 2e39d21 Remove use of TARGET_DEFINED from target_include_directories test.
| * Revert "Add the TARGET_DEFINED generator expression"Stephen Kelly2013-02-251-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2bee6f5ba5b3f33817cc00e056a7df60d05c9399. This expression is not used, and has a semantic which is not completely optimal (namely considering utility targets to be targets, though usually we are interested in linkable targets). Remove it so that we have more freedom to define better expressions in the future. Conflicts: Source/cmGeneratorExpressionEvaluator.cxx Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt Tests/CMakeCommands/target_compile_definitions/consumer.cpp
* | Merge topic 'interface-property-external-read'Brad King2013-02-251-36/+61
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 8dfdf1c Fix the tests for evaluating includes and defines. 98a6725 Fix constness of accessors. 7e70744 Expand includes and defines transitively in 'external' genexes. d1a2729 Fix DAG checker finding cycling dependencies. e72eaad Workaround broken code where a target has itself in its link iface. ec2c67b Strip stray semicolons when evaluating generator expressions.
| * | Expand includes and defines transitively in 'external' genexes.Stephen Kelly2013-02-231-36/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means that we can use expressions of the form $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES> to get a list of the interface include directories of foo, including those coming from dependencies. We can't have a test of a target which has a single include directory in its INCLUDE_DIRECTORIES because the shell on the MSYS platforms transforms a single include directory to include a prefix, which is not what the test expects. We test a target with two directories instead as a means to test a target with no link dependencies.
| * | Workaround broken code where a target has itself in its link iface.Stephen Kelly2013-02-231-0/+7
| | | | | | | | | | | | | | | | | | | | | There is a test for this since commit 8e756d2b (Tolerate cycles in shared library link interfaces (#12647), 2012-01-12), so make sure it continues to pass, even as we require no self-references in new INTERFACE_ property generator expressions.
| * | Strip stray semicolons when evaluating generator expressions.Stephen Kelly2013-02-181-0/+3
| |/
* | Keep track of all targets seen while evaluating a genex.Stephen Kelly2013-02-221-1/+3
|/ | | | | As dependencies of the generator expression, these will re-exported in try_compile generated code.
* Revert "Add the $<LINKED:...> generator expression."Stephen Kelly2013-02-131-94/+0
| | | | | | | | | This reverts commit 0b92602b816e2584db3781b120a1e5200da72ada. Conflicts: Source/cmGeneratorExpressionEvaluator.cxx Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt Tests/CMakeCommands/target_include_directories/CMakeLists.txt
* Revert "Don't allow utility or global targets in the LINKED expression."Stephen Kelly2013-02-131-8/+0
| | | | This reverts commit 9712362b4580fb92394ecf8ff57be186571f4319.
* Use the link information as a source of compile definitions and includes.Stephen Kelly2013-02-131-6/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After evaluating the INTERFACE_INCLUDE_DIRECTORIES, of a target in a generator expression, also read the INTERFACE_INCLUDE_DIRECTORIES of its link interface dependencies. That means that code such as this will result in the 'user' target using /bar/include and /foo/include: add_library(foo ...) target_include_directories(foo INTERFACE /foo/include) add_library(bar ...) target_include_directories(bar INTERFACE /bar/include) target_link_libraries(bar LINK_PUBLIC foo) add_executable(user ...) target_include_directories(user PRIVATE $<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>) Also process the interface include directories from direct link dependencies for in-build targets. The situation is similar for the INTERFACE_COMPILE_DEFINITIONS. The include directories related code is currently more complex because we also need to store a backtrace at configure-time for the purpose of debugging includes. The compile definitions related code will use the same pattern in the future. This is not a change in behavior, as existing code has the same effect, but that existing code will be removed in follow-up commits.
* Don't allow utility or global targets in the LINKED expression.Stephen Kelly2013-02-081-0/+8
| | | | | | The LINKED expression is exclusively for handling INTERFACE content and it does not make sense for utility targets to have INTERFACE content.
* Don't keep track of content determined by target property values.Stephen Kelly2013-02-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This tracking was added during the development of commit 042ecf04 (Add API to calculate link-interface-dependent bool properties or error., 2013-01-06), but was never used. It was not necessary to use the content because what is really useful in that logic is to determine if a property has been implied to be null by appearing in a LINK_LIBRARIES genex. I think the motivating usecase for developing the feature of keeping track of the targets relevant to a property was that I thought it would make it possible to allow requiring granular compatibility of interface properties only for targets which depended on the interface property. Eg: add_library(foo ...) add_library(bar ...) add_executable(user ...) # Read the INTERFACE_POSITION_INDEPENDENT_CODE from bar, but not # from foo: target_link_libraries(user foo $<$<TARGET_PROPERTY:POSTITION_INDEPENDENT_CODE>:bar>) This obviously doesn't make sense. We require that INTERFACE properties are consistent across all linked targets instead.
* Move a special case for PIC from the genex to the cmTarget code.Stephen Kelly2013-02-071-6/+0
|
* Only use early evaluation termination for transitive properties.Stephen Kelly2013-02-071-2/+11
| | | | | | We need to make sure expressions which evaluate TARGET_PROPERTY:TYPE multiple times for example get the correct result each time, and not an empty string instead.
* De-duplicate validation of genex target names.Stephen Kelly2013-02-071-9/+2
|
* Cache context-independent includes on evaluation.Stephen Kelly2013-02-031-2/+23
| | | | | | | | | | Generator expressions whose output depends on the configuration now record that fact. The GetIncludeDirectories method can use that result to cache the include directories for later calls. GetIncludeDirectories is called multiple times for a target for each configuration, so this should restore performance for multi-config generators.
* Optimize genex evaluation for includes and defines.Stephen Kelly2013-02-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | While porting boost to use these features, the generation step took too long (several minutes before I stopped it). The reason was that the boost libraries form a large interdependent mesh. The libraries list their dependencies in their INTERFACE such as: $<LINKED:boost::core>;$<LINKED:boost::config>;$<LINKED:boost::mpl> As boost::core already depends on the boost::config libraries, that expression has no impact on the end-content, as it is removed after the generation step. There is no DAG issue though, so the generator expression evaluation would fully evaluate them. In the case of the config library, it also depends on the core library, so all depends are followed through that again, despite the fact that they've just been evaluated. After this patch, the evaluation skips libraries if they have already been seen via depends or directly in the content. This patch keeps track of targets whose INTERFACE has been consumed already. The INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS properties are whitelisted because repeated content will be stripped out later during generation. For other properties now and in the future, that may not be the case.
* Add the $<LINKED:...> generator expression.Stephen Kelly2013-01-311-0/+85
| | | | | | 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.
* Make it an error for INSTALL_PREFIX to be evaluated.Stephen Kelly2013-01-311-3/+6
| | | | | | An empty string is not likely going to produce expected results in any evaluation context. It is replaced by preprocessing currently.
* Handle reading empty properties defined by the link interface.Stephen Kelly2013-01-311-1/+3
| | | | This was segfaulting before.
* Add the INSTALL_PREFIX genex.Stephen Kelly2013-01-271-0/+20
|
* Add the COMPATIBLE_INTERFACE_STRING property.Stephen Kelly2013-01-241-0/+7
|
* Merge topic 'qt4-autolink-qtmain'Brad King2013-01-231-0/+101
|\ | | | | | | | | | | e3b5eb6 Automatically link to the qtmain library when linking to QtCore. 6c8d8af Add the $<TARGET_POLICY> expression
| * Automatically link to the qtmain library when linking to QtCore.Stephen Kelly2013-01-231-2/+5
| | | | | | | | | | When using QAxServer, ensure that the qtmain library is excluded by reporting an error at CMake time if it is not.
| * Add the $<TARGET_POLICY> expressionStephen Kelly2013-01-171-0/+98
| | | | | | | | | | | | This new expression allows checking how a policy was set when a target was created. That information is only recorded for a subset of policies, so a whitelist is used.
* | Make INTERFACE determined properties readable in generator expressions.Stephen Kelly2013-01-201-0/+21
|/ | | | | The properties are evaluated as link-dependent interface properties when evaluating the generator expressions.
* Add the TARGET_DEFINED generator expressionStephen Kelly2013-01-131-0/+18
| | | | This tests whether the parameter is a usable target.
* Keep track of properties used to determine linker libraries.Stephen Kelly2013-01-081-0/+8
| | | | | Those properties can't later be implicitly defined by the interface of those link libraries.
* Merge topic 'interface-includes-defines'Brad King2013-01-071-5/+106
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 894f52f Handle INTERFACE properties transitively for includes and defines. f5b1980 Populate the ExportedTargets member early in GenerateMainFile c67b812 Make cycles in target properties ignored, not an error. d0f950f Use mapped config properties to evaluate $<CONFIG> 26def17 Make all relevant targets available in the genex context. 0c657dc Add API to populate INTERFACE properties in exported targets. e04f737 Add API to extract target names from a genex string. b0c8f73 Add the TARGET_NAME generator expression. 77475fe Allow generator expressions to require literals. b2f1700 GenEx: Add expressions to specify build- or install-only values
| * Handle INTERFACE properties transitively for includes and defines.Stephen Kelly2013-01-051-1/+29
| | | | | | | | | | Contextually, the behavior is as if the properties content from another target is included in the string and then the result is evaluated.
| * Make cycles in target properties ignored, not an error.Stephen Kelly2013-01-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Constructs such as these are an error as they are direct self-references: set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>) set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:INCLUDE_DIRECTORIES>) However, this is an indirect self-reference in a cycle, and not an error: set_property(TARGET foo APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:bar,INCLUDE_DIRECTORIES>) set_property(TARGET bar APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>)
| * Use mapped config properties to evaluate $<CONFIG>Stephen Kelly2013-01-051-2/+18
| |
| * Make all relevant targets available in the genex context.Stephen Kelly2013-01-051-1/+1
| | | | | | | | | | The current node being evaluated transitively in the generator expression must be available to resolve mapped configs.
| * Add the TARGET_NAME generator expression.Stephen Kelly2013-01-051-0/+24
| | | | | | | | It will be used as a preprocessing marker.
| * Allow generator expressions to require literals.Stephen Kelly2013-01-051-0/+17
| |
| * GenEx: Add expressions to specify build- or install-only valuesStephen Kelly2013-01-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is for specifying INCLUDE_DIRECTORIES relevant to the build-location or the install location for example: set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>" ) A 'bar' target can then use: set_property(TARGET bar PROPERTY INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES>" ) and it will work whether foo is in the same project, or an imported target from an installation location, or an imported target from a build location generated by the export() command. Because the generator expressions are only evaluated at build-time, these new expressions are equivalent to the ZeroNode and OneNode. The GeneratorExpression test is split into parts. Some shells can't run the custom command as it is getting too long.
* | Don't crash when a target is expected but is not available.Stephen Kelly2013-01-031-0/+15
|/
* Replace some 'if' with 'else if'Stephen Kelly2012-12-231-4/+4
| | | | For consistency with the rest of the method.
* Merge topic 'generator-expression-fixes'Brad King2012-11-271-3/+34
|\ | | | | | | | | | | | | b581be0 Genex: Don't segfault on $<FOO,> 07749e3 Genex: Ensure that $<0:...> has a parameter. ee96dc7 Genex: Extract a method to parse parameters.
| * Genex: Ensure that $<0:...> has a parameter.Stephen Kelly2012-11-271-0/+16
| |
| * Genex: Extract a method to parse parameters.Stephen Kelly2012-11-261-3/+18
| |
* | Port cmGeneratorExpression to cmTarget from cmGeneratorTarget.Stephen Kelly2012-11-201-2/+2
|/ | | | | | | | | | | Following from the discussion here: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/3615/focus=5170 (Re: Generator expressisons in target properties, 26 Oct 12:10) we can't split cmTarget API for linking into cmGeneratorTarget. In the future we will probably also need to move the include and compile definitions API back to cmTarget so that it can be used by export().
* GenEx: Use case insensitive comparison for $<CONFIG:...>Stephen Kelly2012-11-051-1/+4
| | | | | This fixes a regression introduced by commit f1eacf0e (cmGeneratorExpression: Re-write for multi-stage evaluation).
* GexEx: Validate Target names and property names differently.Stephen Kelly2012-10-221-6/+11
| | | | | In the unit test, use the same IMPORTED_LOCATION trick that the ExportImport test uses.
* Attempt to fix the compile of cmake on Sun CC.Stephen Kelly2012-10-111-1/+4
| | | | | The problem may be that the reportError method is static, so make it non-static on that platform.
* GenEx: Don't use std::vector::at(int).Stephen Kelly2012-10-091-3/+3
| | | | It might not exist with GCC 2.9.
* GenEx: Ensure that the empty CONFIGURATION can be used conditionally.Stephen Kelly2012-10-091-5/+5
| | | | | The CONFIGURATION can not be manipulated at unit testing time, so this is not unit tested further.
* GenEx: Validate target and property names.Stephen Kelly2012-10-091-1/+46
| | | | They must be non-empty, and match a restrictive regexp.
* GenEx: Report actual target name not found, not "0" each time.Stephen Kelly2012-10-091-2/+3
|