Skip to content

Commit

Permalink
allow even more static linking
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Maas committed Nov 22, 2024
1 parent cac4538 commit 096e241
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,29 +271,33 @@ if (KAHYPAR_ENABLE_TESTING)
endif()


if(NOT BUILD_SHARED_LIBS AND KAHYPAR_STATIC_LINK_DEPENDENCIES)
set(Boost_USE_STATIC_LIBS ON)
endif()
if(NOT KAHYPAR_DISABLE_BOOST)
if(KAHYPAR_DOWNLOAD_BOOST)
# Download Boost program options
set(BOOST_INCLUDE_LIBRARIES program_options)
set(BOOST_ENABLE_CMAKE ON)
FetchContent_Declare(
Boost EXCLUDE_FROM_ALL SYSTEM
URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.gz
)
FetchContent_MakeAvailable(Boost)
else()
# Find Boost program options system library
find_package(Boost 1.69 REQUIRED COMPONENTS program_options)
if(NOT Boost_FOUND)
message(FATAL_ERROR "
Boost not found. Install Boost on your system or
add -DKAHYPAR_DOWNLOAD_BOOST=On to the cmake build command.")
block()
if(KAHYPAR_STATIC_LINK_DEPENDENCIES AND (NOT BUILD_SHARED_LIBS OR KAHYPAR_DOWNLOAD_BOOST))
set(Boost_USE_STATIC_LIBS ON)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
message(STATUS "Boost Include: ${Boost_INCLUDE_DIRS}, Boost Library: ${Boost_LIBRARY_DIRS}")
endif()
if(KAHYPAR_DOWNLOAD_BOOST)
# Download Boost program options
set(BOOST_INCLUDE_LIBRARIES program_options)
set(BOOST_ENABLE_CMAKE ON)
FetchContent_Declare(
Boost EXCLUDE_FROM_ALL SYSTEM
URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.gz
)
FetchContent_MakeAvailable(Boost)
else()
# Find Boost program options system library
find_package(Boost 1.69 REQUIRED COMPONENTS program_options)
if(NOT Boost_FOUND)
message(FATAL_ERROR "
Boost not found. Install Boost on your system or
add -DKAHYPAR_DOWNLOAD_BOOST=On to the cmake build command.")
endif()
message(STATUS "Boost Include: ${Boost_INCLUDE_DIRS}, Boost Library: ${Boost_LIBRARY_DIRS}")
endif()
endblock()
target_link_libraries(MtKaHyPar-Include INTERFACE Boost::program_options)
endif()

Expand All @@ -307,7 +311,10 @@ if(KAHYPAR_DOWNLOAD_TBB)
GIT_SHALLOW FALSE # TBB seems to assume that a git repo is present
)
block()
if(NOT KAHYPAR_STATIC_LINK_TBB)
if(KAHYPAR_STATIC_LINK_TBB)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
set(BUILD_SHARED_LIBS ON)
endif()
FetchContent_MakeAvailable(TBB)
Expand Down

0 comments on commit 096e241

Please sign in to comment.