[MacPorts] #71871: pg boost: for cmake projects, add boost to module path

MacPorts noreply at macports.org
Tue Feb 4 15:23:07 UTC 2025


#71871: pg boost: for cmake projects, add boost to module path
-----------------------+-----------------------
  Reporter:  dershow   |      Owner:  mascguy
      Type:  defect    |     Status:  assigned
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.10.5
Resolution:            |   Keywords:  portgroup
      Port:  pg-boost  |
-----------------------+-----------------------

Comment (by mvieth):

 I think it is very important to have the BoostConfig.cmake (and
 BoostConfigVersion.cmake) installed at a location where CMake can easily
 find it, without having to set CMAKE_PREFIX_PATH or Boost_DIR manually.
 This is especially important for user projects (that are not macports
 themselves).
 Some macports seem to create redirection files in locations where CMake
 searches by default, for example Qt6 creates
 /opt/local/lib/cmake/Qt6/Qt6Config.cmake which "redirects" to the actual
 CMake config file at /opt/local/libexec/qt6/lib/cmake/Qt6/Qt6Config.cmake
 , see https://github.com/macports/macports-
 ports/blob/c03064414e44f263230e5ad7ceb4d39d8e40faae/aqua/qt6/Portfile#L1204

 For reference, CMake searches in these locations:
 https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-
 search-procedure . Note that the paths have wildcards (<name>*) to allow
 for multiple versions of the same package.

 So perhaps it could be a solution to copy the behaviour of Qt6 and create
 a BoostConfig.cmake "redirection file" in a location such as
 /opt/local/lib/cmake/Boost176/BoostConfig.cmake
 (alternatively, /opt/local/lib/Boost176/BoostConfig.cmake or
 /opt/local/lib/Boost176/cmake/BoostConfig.cmake should work as well). Same
 for BoostConfigVersion.cmake. This would also work if multiple Boost
 versions are installed, for example the BoostConfig.cmake from Boost187
 would then be installed in
 /opt/local/lib/cmake/Boost187/BoostConfig.cmake.
 Since CMake (in newer versions) removed the FindBoost module in favour of
 BoostConfig.cmake (see
 https://cmake.org/cmake/help/latest/module/FindBoost.html and
 https://cmake.org/cmake/help/latest/policy/CMP0167.html ) more and more
 project will depend on BoostConfig.cmake being easily findable by CMake.

-- 
Ticket URL: <https://trac.macports.org/ticket/71871#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list