CMake: demote failure to compile IEEE 754 test from error to warning

Apparently due to a CMake bug, some (but not all) CMake versions attempt to
compile the test with default flags, which means C++98 mode with GCC < 6.
As a result, compiling the test fails, and the whole game fails to build.

@gfgtdf pointed out to me that CMake reports the compile and run status
separately, and therefore it's possible to detect the situation where the
test fails to compile. Thus, I decided to allow building in that situation.
This commit is contained in:
Jyrki Vesterinen 2017-03-13 21:37:44 +02:00
parent bf3c70b9a6
commit cd79780b68

View file

@ -57,8 +57,11 @@ option(ENABLE_HISTORY "Enable using GNU history for history in lua console" ON)
if(NOT CMAKE_CROSSCOMPILING)
try_run(IEEE754_TEST_RETURN_CODE IEEE754_TEST_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src/compile_time_tests/ieee_754.cpp
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11")
if(NOT IEEE754_TEST_RETURN_CODE EQUAL 0)
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11" COMPILE_OUTPUT_VARIABLE IEEE754_TEST_COMPILE_OUTPUT)
if(NOT IEEE754_TEST_COMPILED)
message(WARNING "Failed to compile the IEEE 754 test. Skipping it.")
message(${IEEE754_TEST_COMPILE_OUTPUT})
elseif(NOT IEEE754_TEST_RETURN_CODE EQUAL 0)
message(FATAL_ERROR "Your platform does not represent floating point numbers in the IEEE 754 format.")
endif()
else()