diff options
author | Brad King <brad.king@kitware.com> | 2017-04-18 19:05:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-18 19:05:59 (GMT) |
commit | f1e51ec3a5b3ed54dec054aa422fdd7a81b078b3 (patch) | |
tree | 78af90861747476753a420a7ea33b5c335f13cca /Tests/CMakeTestAllGenerators | |
parent | afc492d58f0af07d57256be3ac45ac70afecc256 (diff) | |
download | CMake-f1e51ec3a5b3ed54dec054aa422fdd7a81b078b3.zip CMake-f1e51ec3a5b3ed54dec054aa422fdd7a81b078b3.tar.gz CMake-f1e51ec3a5b3ed54dec054aa422fdd7a81b078b3.tar.bz2 |
Tests: Fix CMakeTestAllGenerators generator list
Since `cmake --help` output now uses `[arch]` placeholders for the VS
generators, this test has been extracting invalid generator names.
Switch to using `cmake -E capabilities` to get a more robust listing of
the generators that does not depend on parsing human-readable help
output.
Diffstat (limited to 'Tests/CMakeTestAllGenerators')
-rw-r--r-- | Tests/CMakeTestAllGenerators/RunCMake.cmake | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/Tests/CMakeTestAllGenerators/RunCMake.cmake b/Tests/CMakeTestAllGenerators/RunCMake.cmake index 6d27d3b..768c689 100644 --- a/Tests/CMakeTestAllGenerators/RunCMake.cmake +++ b/Tests/CMakeTestAllGenerators/RunCMake.cmake @@ -9,42 +9,23 @@ endif() # Analyze 'cmake --help' output for list of available generators: # execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}) -execute_process(COMMAND ${CMAKE_COMMAND} --help +execute_process(COMMAND ${CMAKE_COMMAND} -E capabilities RESULT_VARIABLE result OUTPUT_VARIABLE stdout ERROR_VARIABLE stderr WORKING_DIRECTORY ${dir}) -string(REPLACE ";" "\\;" stdout "${stdout}") -string(REPLACE "\n" "E;" stdout "${stdout}") - -set(collecting 0) set(generators) -foreach(eline ${stdout}) - string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}") - if(collecting AND NOT line STREQUAL "") - if(line MATCHES "=") - string(REGEX REPLACE "^ (.+)= (.*)$" "\\1" gen "${line}") - if(gen MATCHES "[A-Za-z]") - string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}") - if(gen) - set(generators ${generators} ${gen}) - endif() - endif() - else() - if(line MATCHES "^ [A-Za-z0-9]") - string(REGEX REPLACE "^ (.+)$" "\\1" gen "${line}") - string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}") - if(gen) - set(generators ${generators} ${gen}) - endif() - endif() +string(REGEX MATCHALL [["name":"[^"]+","platformSupport"]] generators_json "${stdout}") +foreach(gen_json IN LISTS generators_json) + if("${gen_json}" MATCHES [["name":"([^"]+)"]]) + set(gen "${CMAKE_MATCH_1}") + if(NOT gen MATCHES " (Win64|IA64|ARM)$") + list(APPEND generators "${gen}") endif() endif() - if(line STREQUAL "The following generators are available on this platform:") - set(collecting 1) - endif() endforeach() +list(REMOVE_DUPLICATES generators) # Also call with one non-existent generator: # |