html-extract / hext

Domain-specific language for extracting structured data from HTML documents
https://hext.thomastrapp.com
Apache License 2.0
52 stars 3 forks source link

Fix cmake warning "Policy CMP0167 is not set: The FindBoost module is removed" #33

Closed thomastrapp closed 2 months ago

thomastrapp commented 2 months ago

Observed in cmake version 3.30.3 with Boost-1.86.0.

CMake Warning (dev) at libhext/CMakeLists.txt:31 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:28 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Other:

thomastrapp commented 2 months ago

This is fixed in https://github.com/html-extract/hext/commit/f04420f87edeb5f0f57274e0832eb91c7c798aca .

CMake no longer wants to ship its own version of find_package(Boost) and instead wants you to rely on the version that is provided when installing Boost.

https://cmake.org/cmake/help/latest/policy/CMP0167.html

Unfortunately, CMake projects that depend on Hext (or any other library that depends on Boost) will still receive the warning. And there is nothing I can do about it, because Hext cannot influence how CMake handles find_package(Boost) for other projects.

To suppress this warning you can do one of the following:

cmake_minimum_required(VERSION 3.30)

or

if(POLICY CMP0167)
  cmake_policy(SET CMP0167 NEW)
endif()