Created
March 27, 2015 19:16
-
-
Save zoq/5f228a6ec89078872108 to your computer and use it in GitHub Desktop.
Link against libc++ on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
# Linking against libc++ instead of the GNU libstdc++ on OSX. | |
if(APPLE) | |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lm") | |
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} | |
-stdlib=libc++ -lm") | |
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} | |
-stdlib=libc++ -lm") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | |
else(APPLE) | |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++ -lm") | |
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lstdc++ -lm") | |
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lstdc++ -lm") | |
endif(APPLE) | |
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment