diff options
Diffstat (limited to 'Tests/RunCMake')
-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}" + } + } + ] +} |