From e6b7f8d4ff05af551746ac2d8807ce8fce0b728d Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 17 Sep 2016 12:42:55 -0500 Subject: [PATCH] ENH: This adds new compiler specific flags Compiler flags are optionally set for usign clang on linux with different glibc versions. These flags have been migrated from the makefile to the CMakeLists.txt file. This resolves #18. --- CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 389eb0c..f165861 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,31 @@ elseif (UNIX) set(DISABLE_RTTI "-fno-rtti -fno-exceptions ") endif () +##-------- +# - Added TBB_USE_GLIBCXX_VERSION macro to specify the version of GNU +# libstdc++ when it cannot be properly recognized, e.g. when used +# with Clang on Linux* OS. Inspired by a contribution from David A. +if(NOT TBB_USE_GLIBCXX_VERSION AND UNIX AND NOT APPLE) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # using Clang + string(REPLACE "." "0" TBB_USE_GLIBCXX_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + message(STATUS "TBB_USE_GLIBCXX_VERSION:${TBB_USE_GLIBCXX_VERSION}:") + + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Do nothing using GCC + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + # Do nothing when using Intel C++ + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Do nothgin when using Visual Studio C++ + endif() +endif() +if(TBB_USE_GLIBCXX_VERSION) + message(STATUS "ADDING: -DTBB_USE_GLIBCXX_VERSION=${TBB_USE_GLIBCXX_VERSION}") + add_definitions(-DTBB_USE_GLIBCXX_VERSION=${TBB_USE_GLIBCXX_VERSION}) +endif() + +##------- + # Linker export definitions if (APPLE) set (ARCH_PREFIX "mac")