diff --git a/CMake/3rd/boost.cmake b/CMake/3rd/boost.cmake index b1446128602ccba67695c7abb38c59264e395967..74f6f165cda1ef93f64dd326c961b2663bc6ea67 100644 --- a/CMake/3rd/boost.cmake +++ b/CMake/3rd/boost.cmake @@ -1,4 +1,10 @@ -function(linkBoost components) +function(linkBoost) + + set( options ) + set( oneValueArgs ) + set( multiValueArgs COMPONENTS) + cmake_parse_arguments( ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + if(BUILD_SHARED_LIBS) if (WIN32) set(Boost_USE_STATIC_LIBS ON) @@ -20,8 +26,16 @@ function(linkBoost components) # add_definitions( -DBOOST_ALL_DYN_LINK ) endif() - vf_get_library_name(library_name) - find_package( Boost REQUIRED COMPONENTS ${components}) + vf_get_library_name(library_name) + if(DEFINED ARG_COMPONENTS) + find_package( Boost REQUIRED COMPONENTS ${ARG_COMPONENTS}) + target_link_libraries(${library_name} PRIVATE ${Boost_LIBRARIES}) + message("here") + else() + find_package( Boost REQUIRED) + message("or here") + endif() + + target_include_directories(${library_name} PRIVATE ${Boost_INCLUDE_DIR}) - target_link_libraries(${library_name} PRIVATE ${Boost_LIBRARIES}) endfunction() diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt index f533c37993a0eaf97e40b51502058dc97ae32c72..06bee95fa2a050a790d91c34b36bf99450b29a14 100644 --- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt +++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt @@ -11,7 +11,7 @@ vf_add_library(PRIVATE_LINK ${libsToLink}) linkMPI() linkCUDA() -linkBoost("serialization") +linkBoost(COMPONENTS "serialization") #SET(TPN_WIN32 "/EHsc") #https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake