Permalink
Browse files

Fix static linking (#1758)

  • Loading branch information...
jackgerrits authored and JohnLangford committed Feb 11, 2019
1 parent 18bddab commit f78a199a576be341df9cb6f8415efc80e7e710a9
Showing with 7 additions and 2 deletions.
  1. +6 −1 CMakeLists.txt
  2. +1 −1 vowpalwabbit/CMakeLists.txt
@@ -104,10 +104,15 @@ set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(LINK_THREADS Threads::Threads)
if(STATIC_LINK_VW)
set(LINK_THREADS -Wl,--whole-archive -lpthread -Wl,--no-whole-archive)
endif()

# Align and foreach are also required, for some reason they can't be specified as components though.
find_package(Boost REQUIRED COMPONENTS program_options system thread unit_test_framework)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)

add_subdirectory(cluster)
@@ -63,7 +63,7 @@ source_group(explore FILES ${explore_all_headers})

add_library(vw ${vw_all_sources} ${vw_all_headers} ${explore_all_headers})

target_link_libraries(vw PUBLIC rapidjson Boost::program_options Threads::Threads ZLIB::ZLIB allreduce ${CMAKE_DL_LIBS})
target_link_libraries(vw PUBLIC rapidjson Boost::program_options ${LINK_THREADS} ZLIB::ZLIB allreduce ${CMAKE_DL_LIBS})

if(GCOV)
target_link_libraries(vw PUBLIC gcov)

0 comments on commit f78a199

Please sign in to comment.