From 2d3149157f03a458c253e398148798afb0899944 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 27 Sep 2017 20:04:43 +0200 Subject: [PATCH] Fix clang compiler detection on Fedora and macOS fixes #5257 --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee769503..52c698bb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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")