Skip to content

Commit 23e7658

Browse files
committed
Add a configuration option for threadapi=pthread/win32, set the default properly on Cygwin
1 parent 190ec21 commit 23e7658

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CMakeLists.txt

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ project(boost_thread VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
1010
set(THREADS_PREFER_PTHREAD_FLAG ON)
1111
find_package(Threads REQUIRED)
1212

13-
if(WIN32)
13+
set(_default_threadapi pthread)
14+
15+
if(WIN32 AND NOT CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
16+
set(_default_threadapi win32)
17+
endif()
18+
19+
set(BOOST_THREAD_THREADAPI ${_default_threadapi} CACHE STRING "Boost.Thread threading API (pthread or win32)")
20+
set_property(CACHE BOOST_THREAD_THREADAPI PROPERTY STRINGS pthread win32)
21+
22+
unset(_default_threadapi)
23+
24+
message(STATUS "Boost.Thread: threading API is ${BOOST_THREAD_THREADAPI}")
25+
26+
if(BOOST_THREAD_THREADAPI STREQUAL win32)
1427

1528
set(THREAD_SOURCES
1629
src/win32/thread.cpp

0 commit comments

Comments
 (0)