Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't directly access CMake cache variables from the ctest -S script.</p> <p>However, you could possibly:</p> <ol> <li>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)</li> <li>read the CMakeCache.txt file after the configure step to pull out the cache variable of interest</li> <li>add code to your CMakeLists.txt file to write out a mini-script that contains just the information you're looking for</li> </ol> <p>For (1), the code would be something like:</p> <pre><code>include(${CTEST_SOURCE_DIRECTORY}/path/to/3rdParty/script.cmake) </code></pre> <p>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.</p> <p>For (2):</p> <pre><code>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}'") </code></pre> <p>For (3):</p> <p>In the CMakeLists.txt file:</p> <pre><code>file(WRITE "${CMAKE_BINARY_DIR}/mini-script.cmake" " set(supp_file \"${supp_file_location}\") ") </code></pre> <p>In your ctest -S script, after the ctest_configure call:</p> <pre><code>include("${CTEST_BINARY_DIRECTORY}/mini-script.cmake") message("supp_file='${supp_file}'") # use supp_file as needed in the rest of your script </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload