[mlpack-git] master: Use CMake to figure out if we need to link against libc++ or libstdc++. (a23e498)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Apr 2 14:44:36 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/06b6a04993aabe2a5ed902b6a9d35309f92d83fd...a23e498013dac6a99185fd8fd24ec859c3501975
>---------------------------------------------------------------
commit a23e498013dac6a99185fd8fd24ec859c3501975
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date: Thu Apr 2 20:44:31 2015 +0200
Use CMake to figure out if we need to link against libc++ or libstdc++.
>---------------------------------------------------------------
a23e498013dac6a99185fd8fd24ec859c3501975
CMakeLists.txt | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ef46a1..c990045 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,17 +36,19 @@ endif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# math.h functions, making -lm unnecessary with gcc, but it may still be
# necessary with clang.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- # Linking against libc++ instead of the GNU libstdc++ on OSX.
- if(APPLE)
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("-std=c++11 -stdlib=libc++" HAS_LIBCXX11)
+ # Linking against libc++ instead of the GNU libstdc++.
+ if (HAS_LIBCXX11)
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)
+ else(HAS_LIBCXX11)
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(HAS_LIBCXX11)
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Debugging CFLAGS. Turn optimizations off; turn debugging symbols on.
More information about the mlpack-git
mailing list