mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Introduce a mechanism for "immediate" evaluation of preset macros as
they are defined in the current JSON file, rather than deferring until
after the preset graph is merged. This allows `${fileDir}` to always
be expanded with the path to the directory containing the file which
contains the macro, instead of the path being dependent on the preset
in which the macro is used (which could be defined and inherited from
elsewhere).
Bump to presets version 12 to provide backwards compatibility with the
old behavior.
Fixes: #26982
Relates: #27329, #27639
10 lines
428 B
CMake
10 lines
428 B
CMake
include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake)
|
|
|
|
if (PRESET STREQUAL "FileDir")
|
|
test_variable(CMAKE_BINARY_DIR "" "${CMAKE_CURRENT_SOURCE_DIR}/subdir/build")
|
|
test_variable(TEST_FILE_DIR "" "${CMAKE_CURRENT_SOURCE_DIR}/subdir")
|
|
elseif (PRESET STREQUAL "FileDirExt")
|
|
test_variable(CMAKE_BINARY_DIR "" "${CMAKE_CURRENT_SOURCE_DIR}/build")
|
|
test_variable(TEST_FILE_DIR "" "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
endif()
|