From 15bc960e21bbdc414026ef36701b4cf510ba73e8 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 1 Aug 2014 10:11:55 -0700 Subject: [PATCH] Correcting invalid linker flag for clang on other platforms --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23bd8de62..542f20fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,13 @@ set(autowiring_VERSION_PATCH 0) # Clang needs special additional flags to build with C++11 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") message("Clang C++11") - set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++") + if (APPLE) + # Apple needs us to tell it that we're using libc++, or it will try to use libstdc++ instead + set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++") + else() + set(CMAKE_CXX_FLAGS "-std=c++11") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++") + endif() elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") message("GCC C++11") set(CMAKE_CXX_FLAGS "-std=c++11")