From 8c4059766e88626ad1213d40e05c308f62644d01 Mon Sep 17 00:00:00 2001 From: Eli Fidler Date: Mon, 13 Jun 2016 07:29:34 -0700 Subject: [PATCH] test for no-double-promotion instead of just checking compiler version --- test/unittest/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index fae09cd..b3204d6 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -1,3 +1,5 @@ +include(CheckCXXCompilerFlag) + set(UNITTEST_SOURCES allocatorstest.cpp bigintegertest.cpp @@ -41,7 +43,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # If the user is running a newer version of Clang that includes the # -Wdouble-promotion, we will ignore that warning. if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion") + CHECK_CXX_COMPILER_FLAG("-Wno-double-promotion" HAS_NO_DOUBLE_PROMOTION) + if (HAS_NO_DOUBLE_PROMOTION) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion") + endif() endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Force to always compile with /W4