Skip to content

Commit 0c3e7e9

Browse files
committed
explicit detection of libstdc++
1 parent c981527 commit 0c3e7e9

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

cmake/modules/clang.cmake

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(CheckCXXSymbolExists)
2+
13
if(WIN32)
24
mgis_enable_cxx_compiler_flag(VISIBILITY_FLAGS "EHsc")
35
endif(WIN32)
@@ -80,20 +82,19 @@ if(enable-libcxx)
8082
endif(enable-libcxx)
8183

8284
if(enable-parallel-stl-algorithms)
83-
# This is a poor test to check of libstc++ is used
84-
if(UNIX AND NOT APPLE)
85-
if(NOT enable-libcxx)
86-
find_package(TBB)
87-
if(NOT TBB_FOUND)
88-
message(FATAL_ERROR "Intel Threading Building Blocks library (TBB) is required by libstdc++ to support parallel STL algorithms. You may want to disable support for those parallel algorithms by passing -Denable-parallel-stl-algorithms=OFF to cmake")
89-
endif(NOT TBB_FOUND)
90-
list(APPEND MGIS_REQUIRED_ADDITIONAL_PACKAGES "TBB")
91-
list(APPEND MGIS_ADDITIONAL_LIBRARIES "TBB::tbb")
92-
endif(NOT enable-libcxx)
93-
endif(UNIX AND NOT APPLE)
85+
if(NOT enable-libcxx)
86+
check_cxx_symbol_exists(__GLIBCXX__ version MGIS_GLIBCXX)
87+
if(MGIS_GLIBCXX)
88+
find_package(TBB)
89+
if(NOT TBB_FOUND)
90+
message(FATAL_ERROR "Intel Threading Building Blocks library (TBB) is required by libstdc++ to support parallel STL algorithms. You may want to disable support for those parallel algorithms by passing -Denable-parallel-stl-algorithms=OFF to cmake")
91+
endif(NOT TBB_FOUND)
92+
list(APPEND MGIS_REQUIRED_ADDITIONAL_PACKAGES "TBB")
93+
list(APPEND MGIS_ADDITIONAL_LIBRARIES "TBB::tbb")
94+
endif()
95+
endif(NOT enable-libcxx)
9496
endif(enable-parallel-stl-algorithms)
9597

96-
9798
option(enable-sanitize-options "enable various clang sanitize options (undefined, address,...)" OFF)
9899

99100
if(enable-sanitize-options)

0 commit comments

Comments
 (0)