Skip to content

Commit 8df329f

Browse files
committed
Use Boost's own CMake configuration file instead of CMake's module
Otherwise, breaks builds with newer Boost versions. Also set policy CMP0167 to NEW and forcing CMake to use the Config package and not the built-in module. Will now require Boost 1.70, but this should be available everywhere.
1 parent 37a92f6 commit 8df329f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmake/FilesystemSupport.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ if(NOT ENABLE_BOOST_FILESYSTEM AND STD_FILESYSTEM_EXISTS)
2222
set(PROJECTM_FILESYSTEM_INCLUDE <filesystem>)
2323
set(PROJECTM_FILESYSTEM_USE_BOOST FALSE)
2424
else()
25-
find_package(Boost REQUIRED COMPONENTS Filesystem)
25+
# Requires Boost 1.70 or higher (which was released back in 2019)
26+
if(POLICY CMP0167)
27+
cmake_policy(SET CMP0167 NEW)
28+
endif()
29+
30+
find_package(Boost CONFIG NO_MODULE REQUIRED COMPONENTS Filesystem)
2631

2732
set(PROJECTM_FILESYSTEM_NAMESPACE boost)
2833
set(PROJECTM_FILESYSTEM_INCLUDE <boost/filesystem.hpp>)

0 commit comments

Comments
 (0)