You can't directly access CMake cache variables from the ctest -S script.
However, you could possibly:
- include the third party CMake script in the ctest -S script with
"include" (after the update step, so the source tree is up to date)
- read the CMakeCache.txt file after the configure step to pull out the
cache variable of interest
- add code to your CMakeLists.txt file to write out a mini-script that
contains just the information you're looking for
For (1), the code would be something like:
include(${CTEST_SOURCE_DIRECTORY}/path/to/3rdParty/script.cmake)
This would only be realistically possible if the script does only simple things like set variable values that you can then reference. If it does any CMake-configure-time things like find_library or add_executable, then you shouldn't do this.
For (2):
file(STRINGS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt result
REGEX "^CURSES_LIBRARY:FILEPATH=(.*)$")
message("result='${result}'")
string(REGEX REPLACE "^CURSES_LIBRARY:FILEPATH=(.*)$" "\\1"
filename "${result}")
message("filename='${filename}'")
For (3):
In the CMakeLists.txt file:
file(WRITE "${CMAKE_BINARY_DIR}/mini-script.cmake" "
set(supp_file \"${supp_file_location}\")
")
In your ctest -S script, after the ctest_configure call:
include("${CTEST_BINARY_DIRECTORY}/mini-script.cmake")
message("supp_file='${supp_file}'")
# use supp_file as needed in the rest of your script