Commit 131d4461 authored by Dean Moldovan's avatar Dean Moldovan

Fix compile tests not clearing the cache after an error

The cache bug meant that a failed test would appear forever broken,
even if the proper fix was applied.
parent 40421982
...@@ -20,22 +20,28 @@ function (expect_compile code) ...@@ -20,22 +20,28 @@ function (expect_compile code)
generate_source(source "${code}") generate_source(source "${code}")
check_cxx_source_compiles("${source}" compiles) check_cxx_source_compiles("${source}" compiles)
if (NOT compiles) if (NOT compiles)
message(FATAL_ERROR "Compile error for: ${code}") set(error_msg "Compile error for: ${code}")
endif () endif ()
# Unset the CMake cache variable compiles. Otherwise the compile test will # Unset the CMake cache variable compiles. Otherwise the compile test will
# just use cached information next time it runs. # just use cached information next time it runs.
unset(compiles CACHE) unset(compiles CACHE)
if (error_msg)
message(FATAL_ERROR ${error_msg})
endif ()
endfunction () endfunction ()
function (expect_compile_error code) function (expect_compile_error code)
generate_source(source "${code}") generate_source(source "${code}")
check_cxx_source_compiles("${source}" compiles) check_cxx_source_compiles("${source}" compiles)
if (compiles) if (compiles)
message(FATAL_ERROR "No compile error for: ${code}") set(error_msg "No compile error for: ${code}")
endif () endif ()
# Unset the CMake cache variable compiles. Otherwise the compile test will # Unset the CMake cache variable compiles. Otherwise the compile test will
# just use cached information next time it runs. # just use cached information next time it runs.
unset(compiles CACHE) unset(compiles CACHE)
if (error_msg)
message(FATAL_ERROR ${error_msg})
endif ()
endfunction () endfunction ()
# check if the source file skeleton compiles # check if the source file skeleton compiles
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment