vcpkg/ports/boost-container/posix-threads.diff
Kai Pastor b361950b5a
[boost-container] Fix deps and emscripten (#38806)
Fixes #38679. ([No longer uses
Boost::static_assert.](https://www.boost.org/doc/libs/1_85_0/doc/html/container/release_notes.html#container.release_notes.release_notes_boost_1_85_00))
Fixes #38469. (Needs threads, so [emscripten needs to use
`-pthread`](https://emscripten.org/docs/porting/pthreads.html#compiling-with-pthreads-enabled).)
Change homepage link to something more useful. The update to the
generator script and the other ports will be in a separate PR.
2024-05-22 18:15:41 -07:00

22 lines
685 B
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01e97c5..faf17d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,16 @@ add_library(boost_container
src/synchronized_pool_resource.cpp
src/unsynchronized_pool_resource.cpp
)
+if(NOT WIN32)
+ set(THREADS_PREFER_PTHREAD_FLAG 1)
+ find_package(Threads REQUIRED)
+ target_link_libraries(boost_container PUBLIC Threads::Threads)
+ if(EMSCRIPTEN)
+ # Boost config needs `-pthread` to see `_POSIX_THREADS`,
+ # but FindTheads.cmake finishes with `CMAKE_HAVE_LIBC_PTHREAD`.
+ target_compile_options(boost_container PUBLIC -pthread)
+ endif()
+endif()
add_library(Boost::container ALIAS boost_container)