Skip to content

Commit 8e9d7d4

Browse files
committed
Use pthread required package when building on Windows.
Add ZLIB as a requirement.
1 parent 4da2378 commit 8e9d7d4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ find_package(LibXslt REQUIRED)
143143
find_package(BZip2)
144144

145145
# PThread
146+
if (WIN32)
147+
find_package(ZLIB REQUIRED)
148+
find_package(pthread CONFIG REQUIRED)
149+
set(CMAKE_THREAD_LIBS_INIT ${PThreads4W_LIBRARY})
150+
else()
151+
find_package(Threads REQUIRED)
152+
endif()
146153
set(CMAKE_THREAD_PREFER_PTHREAD)
147154
set(THREADS_PREFER_PTHREAD_FLAG)
148-
set(THREADS_USE_PTHREADS_WIN32 true)
149-
find_package(Threads REQUIRED)
155+
set(THREADS_USE_PTHREADS_WIN32 TRUE)
150156
check_library_exists(pthread pthread_timedjoin_np "" HAVE_PTHREAD_TIMEDJOIN_NP)
151157
check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)
152158
check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP)

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ image: Visual Studio 2017
77
configuration: Release
88
clone_folder: c:\projects\openscap
99
install:
10-
- cmd: vcpkg install curl libxml2 libxslt bzip2 pcre pthreads
10+
- cmd: vcpkg install curl libxml2 libxslt bzip2 pcre pthreads zlib
1111
cache: c:\tools\vcpkg\installed\
1212
before_build:
1313
- cmd: >-

0 commit comments

Comments
 (0)