Change how thread flags are handled
@@ -104,9 +104,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SystemResources.in.cpp
${CMAKE_CURRENT_BINARY_DIR}/SystemResources.cpp @ONLY)
list(APPEND LIME_SUITE_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/SystemResources.cpp)
-if(CMAKE_COMPILER_IS_GNUCXX)
- list(APPEND LIME_SUITE_LIBRARIES -pthread)
-endif(CMAKE_COMPILER_IS_GNUCXX)
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+find_package(Threads REQUIRED)
+list(APPEND LIME_SUITE_LIBRARIES Threads::Threads)
include(CheckAtomic)
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
