Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ target_include_directories(xmlwrapp
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# Always use -pthread under Linux: this is required to ensure that _REENTRANT
# is defined as libxml2 < 2.9.10 needs it to enable thread-safe operation.
#
# Note that using find_package(Threads) wouldn't work as it doesn't add any
# compilation flags on modern Linux systems deeming them unnecessary (which
# is formally correct but breaks using libxml2 in practice).
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_options(xmlwrapp
PRIVATE
-pthread
)
endif()

target_link_options(xmlwrapp
PUBLIC
${LIBXML2_LDFLAGS}
Expand Down
Loading