Skip to content

Commit

Permalink
build: link boost modules as system libs
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Aug 16, 2024
1 parent 9b4dbd7 commit ba623da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,24 @@ file(GLOB_RECURSE BOOST_URL_SOURCES CONFIGURE_DEPENDS src/*.cpp)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_URL_HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "url" FILES ${BOOST_URL_SOURCES})

function(target_link_as_system_libraries target visibility)
foreach(linked_target IN LISTS ARGN)
get_target_property(OTHER_TARGET_INCLUDE_DIRS ${linked_target} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${target} SYSTEM ${visibility} ${OTHER_TARGET_INCLUDE_DIRS})
target_link_libraries(${target} PRIVATE ${linked_target})
endforeach()
endfunction()


function(boost_url_setup_properties target)
target_compile_features(${target} PUBLIC cxx_constexpr)
target_compile_definitions(${target} PUBLIC BOOST_URL_NO_LIB=1)
if (BOOST_URL_DISABLE_THREADS)
target_compile_definitions(${target} PUBLIC BOOST_URL_DISABLE_THREADS=1)
endif()
target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(${target} PUBLIC ${BOOST_URL_DEPENDENCIES})
target_link_as_system_libraries(${target} PUBLIC ${BOOST_URL_DEPENDENCIES})
target_compile_definitions(${target} PUBLIC $<IF:$<BOOL:${BUILD_SHARED_LIBS}>,BOOST_URL_DYN_LINK=1,BOOST_URL_STATIC_LINK=1>)
target_compile_definitions(${target} PRIVATE BOOST_URL_SOURCE)
target_compile_options(${target} PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/EHsc>)
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ project
<toolset>gcc:<cxxflags>"-Wno-unused-but-set-variable"
<toolset>gcc:<cxxflags>"-Wno-maybe-uninitialized"
<toolset>clang:<cxxflags>"-Wno-unused-but-set-variable"
<toolset>clang:<cxxflags>"-Wno-unused-parameter"
<toolset>gcc,<target-os>windows:<cxxflags>"-Wno-error=array-bounds"

# Different typeinfos confuse ubsan
Expand Down

0 comments on commit ba623da

Please sign in to comment.