From 1c31b42e1aba768523fd1c025516be54fb6993dd Mon Sep 17 00:00:00 2001 From: "Kevin M. Godby" Date: Fri, 17 Jun 2016 01:07:40 -0500 Subject: [PATCH] Use CMake Threads package instead of manually specifying -pthread. --- example/CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 6ef158e1..d63b7c97 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -32,16 +32,13 @@ else() find_package(spdlog CONFIG REQUIRED) endif() -if (CMAKE_COMPILER_IS_GNUCXX) - set ( CMAKE_CXX_FLAGS "--std=c++11 -pthread") - set ( CMAKE_EXE_LIKKER_FLAGS "-pthread") -endif () +find_package(Threads) add_executable(example example.cpp) -target_link_libraries(example spdlog::spdlog) +target_link_libraries(example spdlog::spdlog ${CMAKE_THREAD_LIBS_INIT}) add_executable(benchmark bench.cpp) -target_link_libraries(benchmark spdlog::spdlog) +target_link_libraries(benchmark spdlog::spdlog ${CMAKE_THREAD_LIBS_INIT}) enable_testing() file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")