diff options
author | Zoran Angelov <baldzar@gmail.com> | 2023-04-06 18:38:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-26 14:03:53 (GMT) |
commit | f552ba6e6d4571213afdc8afdd063637ac0cbee7 (patch) | |
tree | 7498447afb89df59d600eab0dff0b221bb210bd1 /Tests | |
parent | 1df24df01f0053d07ac2083c4ea8fa915cbb5e65 (diff) | |
download | CMake-f552ba6e6d4571213afdc8afdd063637ac0cbee7.zip CMake-f552ba6e6d4571213afdc8afdd063637ac0cbee7.tar.gz CMake-f552ba6e6d4571213afdc8afdd063637ac0cbee7.tar.bz2 |
presets: add support for macro expansion to includes
Only `$penv{}` can be expanded when processing includes.
Diffstat (limited to 'Tests')
6 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt new file mode 100644 index 0000000..e0f858a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyPenvInInclude: +Error: @3,15: Invalid "include" field + "include": \["\$penv\{\}"\], + \^$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in new file mode 100644 index 0000000..651b0de --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in @@ -0,0 +1,11 @@ +{ + "version": 7, + "include": ["$penv{}"], + "configurePresets": [ + { + "name": "EmptyPenvInInclude", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt b/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt new file mode 100644 index 0000000..d3f1afc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt @@ -0,0 +1,5 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "Include" + "IncludeCommon"$ diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in b/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in new file mode 100644 index 0000000..b4f8292 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in @@ -0,0 +1,10 @@ +{ + "version": 7, + "include": ["$penv{TEST_ENV_INCLUDE_DIR}/IncludeCommon.json"], + "configurePresets": [ + { + "name": "Include", + "inherits": ["IncludeCommon"] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index d67e8b1..c4a8b3f 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -146,6 +146,7 @@ run_cmake_presets(NoSuchMacro) run_cmake_presets(EnvCycle) run_cmake_presets(EmptyEnv) run_cmake_presets(EmptyPenv) +run_cmake_presets(EmptyPenvInInclude) run_cmake_presets(InvalidRegex) set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_presets(ConditionFuture) @@ -393,6 +394,12 @@ set(CMakePresets_EXTRA_FILES "${RunCMake_SOURCE_DIR}/subdir/CMakePresets.json.in" ) run_cmake_presets(Include --list-presets) +set(CMakePresets_EXTRA_FILES + "${RunCMake_SOURCE_DIR}/IncludeCommon.json.in" + ) +set(ENV{TEST_ENV_INCLUDE_DIR} ${RunCMake_BINARY_DIR}/IncludeExpansion) +run_cmake_presets(IncludeExpansion --list-presets) +unset(ENV{TEST_ENV_INCLUDE_DIR}) unset(CMakePresets_EXTRA_FILES) run_cmake_presets(IncludeNotFound) run_cmake_presets(IncludeCycle) |