Skip to content

Commit

Permalink
Corrected BCrypt API detection check in CMakeLists.txt.
Browse files Browse the repository at this point in the history
The check depends on Boost.Predef and Boost.WinAPI. Unfortunately,
we cannot use their CMake targets in check_cxx_source_compiles because
they may not yet be defined at the point of inclusion of
filesystem/CMakeLists.txt by the superproject. Thus we have to manually
specify include path to the monolithic include tree. And bcrypt library.

We intentionally do not specify include paths for Boost.Predef and
Boost.WinAPI because that would require to also specify paths of their
dependencies, and this is not an acceptable maintenance burden.
  • Loading branch information
Lastique committed Jun 5, 2020
1 parent 31aacd5 commit a3e5173
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_mtimensec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_stat_st_mtimespec.cpp>" BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC)
if(WIN32)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_bcrypt.cpp" BOOST_FILESYSTEM_HAS_BCRYPT)
# Note: We can't use the Boost::library targets here as they may not yet be included by the superproject when this CMakeLists.txt is included.
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/../..")
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_bcrypt.cpp>" BOOST_FILESYSTEM_HAS_BCRYPT)
unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_REQUIRED_INCLUDES)
endif()

add_library(boost_filesystem
Expand Down

0 comments on commit a3e5173

Please sign in to comment.