From c35c94798a3fc760cede18efb7c51231f2e3355b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 29 Mar 2019 16:09:04 +0100 Subject: [PATCH] [clang] force -pthread flag on linux to avoid some cmake bugs --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cc384cc..e4157464 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,9 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + if (UNIX AND NOT APPLE) + set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}") #force pthread to avoid bugs in some cmake setups + endif() set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-writable-strings ${CMAKE_CXX_FLAGS}") string(REGEX REPLACE "-O0" "-Og" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) string(REGEX REPLACE "-O3" "-Ofast" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})