Merge pull request #105 from XinzhaoZHU/master

Use CMake's Threads library to provide '-pthread` for Linux
This commit is contained in:
yhirose 2020-05-17 12:07:55 -04:00 committed by GitHub
commit a37c609802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.1.0)
project("cpp-peglib")
find_package(Threads)
# Check if a supported compiler is used to setup the C++ standard to use:
get_property(known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
list(FIND known_features "cxx_std_17" found)
@ -31,7 +32,7 @@ elseif(MSVC)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(add_link_deps pthread)
set(add_link_deps Threads::Threads)
endif()
enable_testing()

View File

@ -5,5 +5,5 @@ add_definitions("-std=c++11")
add_executable(peglint peglint.cc)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(peglint pthread)
target_link_libraries(peglint ${add_link_deps})
endif()