From 63d7f3d116955b06e99b04927eff93d19e1191c4 Mon Sep 17 00:00:00 2001 From: vitaut Date: Fri, 18 Mar 2016 08:10:06 -0700 Subject: [PATCH] Don't check for C++11 features if C++11 support is disabled --- CMakeLists.txt | 2 +- support/cmake/{testCxx11.cmake => cxx11.cmake} | 6 ++++++ test/CMakeLists.txt | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) rename support/cmake/{testCxx11.cmake => cxx11.cmake} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index efe3e286..797be705 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") -include(testCxx11) +include(cxx11) if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wshadow -pedantic) diff --git a/support/cmake/testCxx11.cmake b/support/cmake/cxx11.cmake similarity index 96% rename from support/cmake/testCxx11.cmake rename to support/cmake/cxx11.cmake index 5f06321e..fdda11be 100644 --- a/support/cmake/testCxx11.cmake +++ b/support/cmake/cxx11.cmake @@ -1,3 +1,9 @@ +# C++11 feature support detection + +if (NOT FMT_USE_CPP11) + return() +endif () + include(CheckCXXCompilerFlag) if (FMT_USE_CPP11) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 27d4d3fb..199923b6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -40,6 +40,8 @@ target_compile_definitions(test-main PUBLIC FMT_USE_FILE_DESCRIPTORS=$) target_link_libraries(test-main gmock cppformat) +include(CheckCXXCompilerFlag) + # Workaround GTest bug https://github.com/google/googletest/issues/705. check_cxx_compiler_flag( -fno-delete-null-pointer-checks HAVE_FNO_DELETE_NULL_POINTER_CHECKS)