Open sstarosz opened 3 weeks ago
From CMake version 3.30 it looks like execution of find_package(Boost REQUIRED) looks for BoostConfig.cmake or boost-config.cmake. Even if CONFIG is not specified in find package.
It is normal that CMake tries config mode after module mode.
cmake_minimum_required(VERSION 3.30)
FTR this disables CMake's FindBoost.cmake
.
@sstarosz , Thanks for your issue. At present, the latest camke does not provide FindBoost module. We use boost components in the way of findpackage(Boost REQUIRED [COMPONENTS ...]). The latest version of vcpkg provides boost[***]-config.cmake.
As a workaround, you can set cmake_minimum_required(VERSION 3.29),
Actually you only have to change a single policy to enable the old behavior.
if(POLICY CMP0167)
cmake_policy(SET CMP0167 OLD)
endif()
Operating system
Windows 10
Compiler
MSVC
Steps to reproduce the behavior
Failure logs
Output From CMake:
Additional context
It looks like CMake in version 3.30 remove FindBoost module: CMP0167
From CMake version 3.30 it looks like execution of find_package(Boost REQUIRED) looks for BoostConfig.cmake or boost-config.cmake. Even if CONFIG is not specified in find package.
So when user try to use find_package(Boost REQUIRED [COMPONENTS...]) just like vcpkg sugest, the missing file causes an error in CMake.
As a workaround, you can set cmake_minimum_required(VERSION 3.29), but this still produce a warning in the newest CMake.
I tried to find BoostConfig.cmake or boost-config.cmake in the folders where vcpkg install Boost but I didn't find them. Maybe they are not generated by vpckg or I missed them, or vcpkg doesn't set the paths where they can be found. I think vcpkg should provide these files to be able to use boost in latest CMake.
This problem also applies to single boost libraries dependencies for example boost-algorithm or boost-filesystem
Content of files for reproduction
Manifest mode
CMakePresets.json
CMakeLists.txt
main.cpp