diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index cc54682e716fe6e0451c87866fbd478a9ede575c..f4d0a3fca08949fcd7ed9215904361e8bff21a35 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -190,20 +190,21 @@ if(OGS_USE_MFRONT) endif() endif() +# Boost libraries used by ogs, can be linked with Boost::[lib_name] +set(BOOST_INCLUDE_LIBRARIES + math + property_tree + algorithm + smart_ptr + tokenizer + assign + dynamic_bitset + range + variant +) if(GUIX_BUILD) find_package(Boost REQUIRED) else() - # Boost libraries used by ogs, can be linked with Boost::[lib_name] - set(BOOST_INCLUDE_LIBRARIES - math - property_tree - algorithm - smart_ptr - tokenizer - assign - dynamic_bitset - range - ) CPMFindPackage( NAME Boost VERSION ${ogs.minimum_version.boost} @@ -211,6 +212,13 @@ else() OPTIONS "BOOST_ENABLE_CMAKE ON" ) endif() +if(NOT Boost_ADDED) + # Boost from system found. There are only Boost::headers and Boost::boost + # targets. + foreach(lib ${BOOST_INCLUDE_LIBRARIES}) + add_library(Boost::${lib} ALIAS Boost::headers) + endforeach() +endif() CPMFindPackage( NAME LibXml2