From 4dce26bba4a14fc5398780697504eb7ea3fba245 Mon Sep 17 00:00:00 2001 From: redfish Date: Sun, 10 Jul 2016 18:54:48 -0400 Subject: [PATCH] cmake: do not pass -stdlib=c++ to clang >=3.7 Tested on Linux (Arch) with clang 3.7 and 3.8 i686 and ARM: if -stdlib=c++ is passed to clang, then the build errors out with ,,etc. headers not found. Simply not passing the arg fixes the problem. **NOTE**: not tested on OSX. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b9c8189..d266671c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -392,8 +392,10 @@ else() # There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable set(USE_LTO false) # explicitly define stdlib for older versions of clang - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") + if(CMAKE_C_COMPILER_VERSION VERSION_LESS 3.7) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") + endif() endif()