]> granicus.if.org Git - icinga2/commitdiff
Fix clang compiler detection on Fedora and macOS 5258/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Sep 2017 18:04:43 +0000 (20:04 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Sep 2017 18:04:43 +0000 (20:04 +0200)
fixes #5257

CMakeLists.txt

index 0ee7695035d73c357e12bcf65b9ef72f75953ccc..52c698bb0f70d0bf3c959de4e50482ef8c775ea6 100644 (file)
@@ -148,6 +148,13 @@ set(CMAKE_MACOSX_RPATH 1)
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -g")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -g")
+
+  # Clang on Fedora requires -pthread, Apple Clang does not
+  # AppleClang is available since CMake 3.0.0
+  if (NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+  endif()
 endif()
 
 if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")