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)