Skip to content
Snippets Groups Projects
Commit 03c394e3 authored by Ammar Nejati's avatar Ammar Nejati
Browse files

CMake: Correct C++ Boost dependencies for Windows

With the new compiled Boost on the Windows machine, there is no need to add
zlib, bzip2, lzma, and zstd as extra dependencies. The compiled Boost binaries
include `libboost_zlib` and `libboost_bzip2` (lzma and zstd are not required).

Related to issue #133
parent 1d9ea98e
No related branches found
No related tags found
1 merge request!391CMake: Correct C++ Boost dependencies for Windows
......@@ -58,33 +58,20 @@ add_definitions(-DBOOST_UUID_FORCE_AUTO_LINK) # line is needed to link bcrypt fo
# Boost component libraries (do not list headers here)
set(boost_libraries_required iostreams program_options)
# NOTE: `FindBoost` CMake module internally adds Boost::regex as an extra dependency for Boost::iostream
if(WIN32)
# system seems to be indirectly required
list(APPEND boost_libraries_required system)
find_package(BZip2 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(LibLZMA REQUIRED)
find_library(ZSTD_LIBRARY NAMES zstd)
# On Windows, additional libaries are required for Boost::iostream
list(APPEND boost_libraries_required zlib bzip2)
endif()
message(STATUS "Boost required libraries: ${boost_libraries_required}")
find_package(Boost 1.65.1 COMPONENTS ${boost_libraries_required})
message(STATUS "Boost: includes at ${Boost_INCLUDE_DIRS}, libraries at ${Boost_LIBRARY_DIRS}")
if(NOT Boost_FOUND)
message(FATAL_ERROR "Not all required Boost component libraries were found")
endif()
# requires these libs in target_link_libraries for win only
set(Boost_Additional_Libraries "")
if(WIN32)
list(APPEND Boost_Additional_Libraries ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBLZMA_LIBRARIES} ${ZSTD_LIBRARY})
endif()
if(Boost_Additional_Libraries)
message(STATUS "Additional libraries required for Boost:")
foreach(lib ${Boost_Additional_Libraries})
message(" ${lib}")
endforeach()
endif()
# === optional packages ===
# --- MPI support ---
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment