Skip to content

Commit

Permalink
cmake: use modern Threads::Threads linker target
Browse files Browse the repository at this point in the history
  • Loading branch information
axxel committed Sep 14, 2020
1 parent fad045f commit 229d335
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/CMakeLists.txt
Expand Up @@ -428,7 +428,9 @@ source_group (Sources\\pdf417 FILES ${PDF417_FILES})
source_group (Sources\\qrcode FILES ${QRCODE_FILES})
source_group (Sources\\textcodec FILES ${TEXT_CODEC_FILES})

find_package (Threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

add_library (ZXing
${COMMON_FILES}
Expand Down Expand Up @@ -464,7 +466,7 @@ endif()
# the lib needs a c++-17 compiler but can be used with a c++-11 compiler (see examples)
target_compile_features(ZXing PRIVATE cxx_std_17 INTERFACE cxx_std_11)

target_link_libraries (ZXing PUBLIC ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (ZXing PRIVATE Threads::Threads)

add_library(ZXing::ZXing ALIAS ZXing)
# add the old alias as well, to keep old clients compiling
Expand Down

0 comments on commit 229d335

Please sign in to comment.