summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpression
Commit message (Collapse)AuthorAgeFilesLines
* Genex: Allow COMPILE_LANGUAGE to name a language that is not loadedHenry Schreiner2018-05-033-10/+1
| | | | | | | | Evaluate to false on `$<COMPILE_LANGUAGE:Lang>` if language `Lang` is not loaded. This is helpful in exported targets consumed in other projects that may not enable all the same languages. Fixes: #17952
* Genex: Add $<TARGET_GENEX_EVAL:...> and $<GENEX_EVAL:...>Marc Chevrier2018-04-2326-0/+219
| | | | Fixes: #17884
* genex: Add TARGET_NAME_IF_EXISTS expressionAlex Turbov2018-03-2811-0/+43
| | | | | Define `$<TARGET_NAME_IF_EXISTS:tgt>` to mean `tgt` if the target exists and otherwise an empty string.
* genex: Add TARGET_EXISTS to check for target existenceAlex Turbov2018-03-0911-0/+43
| | | | | Define `$<TARGET_EXISTS:a>` to `1` if `a` is an existed target name, else `0`.
* Tests: Speed up RunCMake.GeneratorExpressionBrad King2018-01-2525-71/+30
| | | | Avoid enabling languages in cases that do not need them.
* GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in TestsCraig Scott2017-12-291-1/+2
|
* VS,Xcode: Add CMakeLists.txt sources without mutating targetsBrad King2017-10-181-3/+0
| | | | | | | | | | | | Rather than injecting `CMakeLists.txt` files into each target's `SOURCES`, teach the generators to add them during generation using dedicated code. This avoids mutating the original targets, and avoids polluting `$<TARGET_PROPERTY:foo,SOURCES>` with generator-specific content. This also avoids listing the `CMakeLists.txt` sources in the results of `CMAKE_DEBUG_TARGET_PROPERTIES==SOURCES` so the `RunCMake.TargetSources` test no longer needs a separate case for IDEs.
* Merge topic 'fix-genex-SOURCES'Brad King2017-09-015-0/+15
|\ | | | | | | | | | | | | 068cc545 Genex: Fix TARGET_PROPERTY value of SOURCES Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1218
| * Genex: Fix TARGET_PROPERTY value of SOURCESBrad King2017-09-015-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit v3.8.0-rc1~445^2~2 (cmTarget: Move sanity checks and computed property access to callers, 2016-10-13) exposed a typo in commit v3.8.0-rc1~445^2~3 (cmGeneratorTarget: Implement cmTargetPropertyComputer interface, 2016-10-13). Together they broke the `$<TARGET_PROPERTY:mytgt,SOURCES>` generator expression in the case that the `SOURCES` target property is populated in part by the `target_sources` command. Add the missing `;`-separator. Fixes: #17243
* | cmGeneratorExpressionNode: add some missing commasBen Boeckel2017-08-037-14/+14
|/
* Genex: Add `TARGET_BUNDLE_[CONTENT_]_DIR` generator expressionsGregor Jasny2017-03-3013-0/+62
| | | | Closes #16733
* Genex: Add `IF` generator expressionColby Pike2017-01-264-0/+22
| | | | | | | | This allows a single condition to be used to choose between two alternatives. Without this the condition must be duplicated with one surrounded by `NOT`. Closes: #15585
* cmTarget: Move sanity checks and computed property access to callersStephen Kelly2016-10-161-1/+3
| | | | | | | | | | | | | | | The GetProperty method is now just accessing contained data, meaning it can be implemented in cmState. Remove the cmMakefile context from the signature as a result and remove the overload with the same signature. Add a GetComputedProperty to cmTarget so that templates can be properly instantiated. Otherwise the Commands would need to be able to reach the specializations which are currently in cmTarget.cxx. As a side-effect, the CMP0026 warning now gives a backtrace to the target when issued from a generator expression.
* Genex: Diagnose invalid LINK_ONLY usage instead of crashingBrad King2016-09-054-0/+11
| | | | | | | | When `$<LINK_ONLY:...>` is used outside of linking we may evaluate it without a `dagChecker`. Do not dereference the NULL pointer and issue a diagnostic instead. Closes: #16287
* Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)Brad King2016-06-023-0/+14
| | | | | | | | | | | | | | | | | | Policy CMP0026 deprecated the LOCATION property, and we have long provided a $<TARGET_FILE:...> generator expression. However, if a project tries to use $<TARGET_PROPERTY:...,LOCATION> we should at least not crash. The compatibility implementation of the LOCATION property uses cmGlobalGenerator::CreateGenerationObjects to create the structures needed to evaluate the property before generation starts. The implementation assumed that accessing the property could only be done during configuration (via the typical get_property command use case). The $<TARGET_PROPERTY:...,LOCATION> genex causes the LOCATION property to be accessed during generation. Calling CreateGenerationObjects during generation blows away all the objects currently being used for generation and is not safe. Add a condition to call it only when configuration is not finished.
* Genex: Add a SHELL_PATH expressionStefan Kislinskiy2015-09-284-0/+23
| | | | | | | | | Some commands on Windows do not understand forward slash paths and require backslashes. In order to help projects generate shell invocations of such commands, provide a generator expression to convert paths to the shell-preferred path format for the current generator. This will allow custom commands to generate paths the same way CMake does for compiler command invocations.
* cmGeneratorTarget: Avoid recursion in GetOutputName methodRobert Goulet2015-08-205-0/+10
| | | | | | Since support for generator expressions was added to OUTPUT_NAME it is possible for project code to cause recursion in this method by using a $<TARGET_FILE> genex. Detect and reject such cases.
* Add generator expression support to OUTPUT_DIRECTORY target propertiesRobert Goulet2015-08-124-0/+9
| | | | | | | If {ARCHIVE,LIBRARY,RUNTIME}_OUTPUT_DIRECTORY is set with a genex then do not add the per-config subdirectory on multi-config generators. This will allow projects to use $<CONFIG> to place the per-config part of the directory path somewhere other than the end.
* Reject TARGET_PDB_FILE for imported targets instead of crashingBrad King2015-08-064-0/+12
| | | | Reported-by: Justin Borodinsky <justin.borodinsky@gmail.com>
* Tests: Add case for rejecting $<TARGET_FILE:...> on an INTERFACE libraryBrad King2015-05-264-0/+34
| | | | | Add an explicit test for this existing error. We already cover it for an OBJECT library but INTERFACE libraries are not allowed either.
* Genex: Enable use of COMPILE_LANGUAGE for compile options.Stephen Kelly2015-03-094-0/+14
| | | | | | Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators.
* Genex: Add a COMPILE_LANGUAGE generator expression.Stephen Kelly2015-03-0722-0/+119
|
* RunCMake: Remove unneeded files.Stephen Kelly2015-02-091-1/+0
| | | | | The default expectation of RunCMake tests is empty content, so there is no need to specify it.
* Encoding: Modify tests to work using non-ascii paths.Clinton Stimpson2015-01-091-1/+1
| | | | | | | | | | For complex*, CustomCommand and OutDir tests, non-ascii paths are avoided in test code by using relative paths, and setting the working when running the test. This also avoids the need to internationalize the test code. For RunCMake.GeneratorExpression, use a UTF-8 encoding in file(STRINGS) to retrieve the compiled absolute path correctly.
* Genex: Implement generator expressions for target PDB files.Nils Gladitz2014-07-3110-0/+80
|
* Genex: Clarify error message on use with non-binary targets (#14899).Stephen Kelly2014-05-2919-0/+116
|
* Genex: Use case-sensitive comparison for COMPILER_ID.Stephen Kelly2014-01-084-0/+26
|
* Genex: Add a nullary form for CONFIGStephen Kelly2014-01-072-11/+1
| | | | | | | | | | | | | This is consistent with other similar expressions such as PLATFORM_ID, and makes the CONFIGURATION expression obsolete. Fix an off-by-one error in GeneratorExpressionContent::EvaluateParameters exposed by a unit test. Remove the test for 'bad' nullary use of $<CONFIG>. Add a unit test to verify that $<CONFIG> and $<CONFIGURATION> have the same value.
* Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)Brad King2013-11-015-0/+35
| | | | | | | | | Teach the cmGeneratorExpressionEvaluator filesystem artifact logic to reject OBJECT_LIBRARY targets since they have no main artifact. Without the explicit rejection evaluation falls through to an internal CMake error message in cmTarget::GetOutputInfo. Extend the RunCMake.GeneratorExpression test to cover these cases.
* Cygwin: Avoid legacy warnings in RunCMake.* testsBrad King2013-08-131-1/+1
| | | | | | Set the minimum required version of CMake high enough to avoid the warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr and breaks the expected output matching.
* Make it an error for INSTALL_PREFIX to be evaluated.Stephen Kelly2013-01-314-0/+14
| | | | | | An empty string is not likely going to produce expected results in any evaluation context. It is replaced by preprocessing currently.
* Add the TARGET_NAME generator expression.Stephen Kelly2013-01-054-0/+13
| | | | It will be used as a preprocessing marker.
* Genex: Don't segfault on $<FOO,>Stephen Kelly2012-11-272-0/+10
| | | | | | Treat the comma as part of the identifier here. It will later not resolve to a generator expression and the user gets a proper error message.
* Genex: Ensure that $<0:...> has a parameter.Stephen Kelly2012-11-274-0/+14
|
* GenEx: Test early determination of AND and ORStephen Kelly2012-10-204-0/+20
| | | | | | | | | | | | | | | | It should be possible for example to do this: "$<AND:${FOO},$<BOOL:${TGT}>,$<BOOL:$<TARGET_PROPERTY:${TGT},PROP>" such that it works simliarly to the C code: if (foo && tgt && tgt->prop()) { } The example of generator expression code is a little bit contrived as it could be written other ways with the same functionality. Nevertheless, as these cases already work and are intentional, test for them.
* GenEx: Parse comma after colon tokens speciallyStephen Kelly2012-10-095-1/+47
| | | | | | | | | | | | | | | Otherwise the comma is treated as plain text by ParseContent. $<STREQUAL:,> should be valid and true. $<STREQUAL:,something> should be valid and false. $<STREQUAL:,,> should be non-valid as it is 3 parameters. $<STREQUAL:something,,> should be non-valid as it is 3 parameters. Additionally, this allows reporting the correct error for other expressions. For example $<TARGET_PROPERTY:,> should be invalid because it has an empty target and empty property. It shouldn't attempt to read the property ',' on the 'implicit this' target.
* cmGeneratorExpression: Re-write for multi-stage evaluationStephen Kelly2012-09-188-7/+136
| | | | | | | | The expressions may be parsed and then cached and evaluated multiple times. They are evaluated lazily so that literals such as ',' can be treated as universal parameter separators, and can be processed from results without appearing literally, and without interfering with the parsing/evaluation of the entire expression.
* Add $<CONFIG:...> boolean query generator expressionBrad King2012-08-154-0/+13
| | | | | | | This expression evaluates to '1' or '0' to indicate whether the build configuration for which the expression is evaluated matches tha named configuration. In combination with the "$<0:...>" and "$<1:...>" expressions this allows per-configuration content to be generated.
* Add boolean generator expressionsBrad King2012-08-1511-0/+84
Add generator expressions that combine and use boolean test results: $<0:...> = empty string (ignores "...") $<1:...> = content of "..." $<AND:?[,?]...> = '1' if all '?' are '1', else '0' $<OR:?[,?]...> = '0' if all '?' are '0', else '1' $<NOT:?> = '0' if '?' is '1', else '1' These will be useful to evaluate (future) boolean query expressions and condition content on the results. Include tests and documentation.