From e562f51f63237b41c0b8f791a06c5d12ce1dac7f Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 7 Jun 2016 10:29:45 +0200 Subject: [PATCH] No need for pthread lib in examples and tests --- CMakeLists.txt | 4 ++++ example/CMakeLists.txt | 6 +++--- test/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16f0dc1..caef12b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(warning_options /W4 /wd4503 /wd4512) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(add_link_deps pthread) +endif() + enable_testing() add_subdirectory(lint) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 46b3621..82c0a58 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -3,10 +3,10 @@ include_directories(..) add_compile_options(${cxx11_options} ${warning_options}) add_executable(calc calc.cc) -target_link_libraries(calc pthread) +target_link_libraries(calc ${add_link_deps}) add_executable(calc2 calc2.cc) -target_link_libraries(calc2 pthread) +target_link_libraries(calc2 ${add_link_deps}) add_executable(calc3 calc3.cc) -target_link_libraries(calc3 pthread) +target_link_libraries(calc3 ${add_link_deps}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d57012..3911957 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,6 +3,6 @@ include_directories(..) add_compile_options(${cxx11_options} ${warning_options}) add_executable(test-main test.cc) -target_link_libraries(test-main pthread) +target_link_libraries(test-main ${add_link_deps}) add_test(TestMain test-main)