Tests: Select RunCMake.Ninja test cases based on ninja version
Some test cases need features not available in Ninja < 1.6, so check the version before running them.
This commit is contained in:
parent
8a862a4d4b
commit
eb07669245
|
@ -1,5 +1,20 @@
|
|||
include(RunCMake)
|
||||
|
||||
# Detect ninja version so we know what tests can be supported.
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" --version
|
||||
OUTPUT_VARIABLE ninja_out
|
||||
ERROR_VARIABLE ninja_out
|
||||
RESULT_VARIABLE ninja_res
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+")
|
||||
set(ninja_version "${ninja_out}")
|
||||
message(STATUS "ninja version: ${ninja_version}")
|
||||
else()
|
||||
message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}")
|
||||
endif()
|
||||
|
||||
function(run_CMP0058 case)
|
||||
# Use a single build tree for a few tests without cleaning.
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build)
|
||||
|
@ -169,6 +184,11 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa
|
|||
|
||||
endfunction(run_sub_cmake)
|
||||
|
||||
if("${ninja_version}" VERSION_LESS 1.6)
|
||||
message(WARNING "Ninja is too old; skipping rest of test.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(ninja_output_path_prefix "sub space" "sub")
|
||||
run_sub_cmake(Executable "${ninja_output_path_prefix}")
|
||||
run_sub_cmake(StaticLib "${ninja_output_path_prefix}")
|
||||
|
|
Loading…
Reference in New Issue