diff options
author | Brad King <brad.king@kitware.com> | 2022-03-08 21:02:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-03-08 21:03:14 (GMT) |
commit | 11c25ae6aeeec94bcaad471a76ed0d76d30d8d8d (patch) | |
tree | 073f7fa16d98f64654a898f7987674a2059297a3 /Tests | |
parent | ba695c87e16b7bdc3b1948bf3382d40585905da7 (diff) | |
parent | f54507c2f6826e9b2b021dbf3b3fa75dcdce22fe (diff) | |
download | CMake-11c25ae6aeeec94bcaad471a76ed0d76d30d8d8d.zip CMake-11c25ae6aeeec94bcaad471a76ed0d76d30d8d8d.tar.gz CMake-11c25ae6aeeec94bcaad471a76ed0d76d30d8d8d.tar.bz2 |
Merge topic 'cmake-presets-file-dir' into release-3.23
f54507c2f6 CMakePresets.json: Add ${fileDir} macro
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Gerhard Olsson <gerhard.nospam@gmail.com>
Merge-request: !7051
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakePresets/FileDir.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/FileDir.json.in | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/FileDirFuture-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/FileDirFuture-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/FileDirFuture.json.in | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/subdir/FileDir.json.in | 13 |
7 files changed, 49 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakePresets/FileDir.cmake b/Tests/RunCMake/CMakePresets/FileDir.cmake new file mode 100644 index 0000000..c7298cd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FileDir.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(TEST_FILE_DIR "" "${CMAKE_CURRENT_SOURCE_DIR}/subdir") diff --git a/Tests/RunCMake/CMakePresets/FileDir.json.in b/Tests/RunCMake/CMakePresets/FileDir.json.in new file mode 100644 index 0000000..899e5f3 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FileDir.json.in @@ -0,0 +1,6 @@ +{ + "version": 4, + "include": [ + "subdir/FileDir.json" + ] +} diff --git a/Tests/RunCMake/CMakePresets/FileDirFuture-result.txt b/Tests/RunCMake/CMakePresets/FileDirFuture-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FileDirFuture-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/FileDirFuture-stderr.txt b/Tests/RunCMake/CMakePresets/FileDirFuture-stderr.txt new file mode 100644 index 0000000..ba85f0f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FileDirFuture-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/FileDirFuture: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/FileDirFuture.json.in b/Tests/RunCMake/CMakePresets/FileDirFuture.json.in new file mode 100644 index 0000000..75d6622 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FileDirFuture.json.in @@ -0,0 +1,13 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "FileDirFuture", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_FILE_DIR": "${fileDir}" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 955cf53..449132a 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -53,7 +53,7 @@ function(run_cmake_presets name) ) string(REGEX REPLACE "\\.in$" "" _extra_file_out_relative "${_extra_file_relative}") set(_extra_file_out "${RunCMake_TEST_SOURCE_DIR}/${_extra_file_out_relative}") - configure_file("${_extra_file}" "${_extra_file_out}") + configure_file("${_extra_file}" "${_extra_file_out}" @ONLY) list(APPEND _CMakePresets_EXTRA_FILES_OUT "${_extra_file_out}") list(APPEND _CMakePresets_EXTRA_FILES_SCHEMA_EXPECTED_RESULTS 0) endforeach() @@ -317,6 +317,16 @@ run_cmake_presets(HostSystemName) set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemNameFuture.json.in") run_cmake_presets(HostSystemNameFuture) +# Test ${fileDir} macro +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/FileDir.json.in") +set(CMakePresets_EXTRA_FILES + "${RunCMake_SOURCE_DIR}/subdir/FileDir.json.in" + ) +run_cmake_presets(FileDir) +unset(CMakePresets_EXTRA_FILES) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/FileDirFuture.json.in") +run_cmake_presets(FileDirFuture) + # Test conditions set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Conditions.json.in") run_cmake_presets(ListConditions --list-presets) diff --git a/Tests/RunCMake/CMakePresets/subdir/FileDir.json.in b/Tests/RunCMake/CMakePresets/subdir/FileDir.json.in new file mode 100644 index 0000000..00282a7 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/subdir/FileDir.json.in @@ -0,0 +1,13 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "FileDir", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_FILE_DIR": "${fileDir}" + } + } + ] +} |