Skip to content

Boost always installs even though package exists on system #43

Closed
@FabienPean

Description

@FabienPean

find_package(
${PACKAGE} QUIET
HINTS ${DEPENDENCY_INSTALL_PREFIX} ${CMAKE_INSTALL_PREFIX}
)
if(NOT ${${PACKAGE}_FOUND})

The call to find_package in the script forces to the CONFIG mode due to HINTS manually inserted. It means it skips the FindBoost module, thus does not find any pre-installed Boost leading to always downloading the package.

Hence the vcpkg patch there https://github.com/microsoft/vcpkg/blob/b4a3d89125e45bc8f80fb94bef9761d4f4e14fb9/ports/yomm2/fix_install.patch#L9-L10
which could also be replaced by

diff --git a/cmake/find_or_download_package.cmake b/cmake/find_or_download_package.cmake
index 7e8a282..f550c2d 100644
--- a/cmake/find_or_download_package.cmake
+++ b/cmake/find_or_download_package.cmake
@@ -7,6 +7,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
   set(DEPENDENCY_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/dependencies/${PACKAGE})
   find_package(
     ${PACKAGE} QUIET
-     HINTS ${DEPENDENCY_INSTALL_PREFIX} ${CMAKE_INSTALL_PREFIX}
   )
  if(NOT ${${PACKAGE}_FOUND})

The best would be to clear out the CMake scripts related to Boost and rely on find_package + FetchContent https://github.com/boostorg/cmake

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions