boostorg / cmake

CMake support infrastructure Boost submodule
87 stars 26 forks source link

drop REQUIRED from all find_package #34

Open marakew opened 1 year ago

marakew commented 1 year ago

can you please drop it let rewrite it by CMAKE_DISABLE_FINDPACKAGE thanks

pdimov commented 1 year ago

What specific problem are you having?

marakew commented 1 year ago

i want set manual external library instead use find_package

as example set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB 1) set(ZLIB_FOUND 1) add_library(ZLIB::ZLIB UNKNOWN IMPORTED) ...etc

but with REQUIRED keyword i got always fail to processing cmake

pdimov commented 1 year ago

Does this refer to a Boost built with b2 or to one built with CMake?

pdimov commented 1 year ago

If with CMake, the config files don't use find_package or REQUIRED; they use find_dependency (e.g. find_dependency(ZLIB). This macro automatically sets QUIET or REQUIRED to match the parent find_package call. So if you call find_package(boost_iostreams REQUIRED), it will invoke find_package(ZLIB REQUIRED), but if you call find_package(boost_iostreams), it will invoke find_package(ZLIB). This is standard CMake behavior.

pdimov commented 1 year ago

Opened a CMake issue about this at https://gitlab.kitware.com/cmake/cmake/-/issues/24293.

marakew commented 1 year ago

you seems dont understand me i don't want use find_package at all i want rewrite it by my own infrastructure with REQUIRED in boost it will impossible

my above example will work it REQUIRED will drop from find_package and users will able to rewrite by own env settings without using find_package for searching

2023-01-08 19:57 GMT+02:00, Peter Dimov @.***>:

If with CMake, the config files don't use find_package or REQUIRED; they use find_dependency (e.g. find_dependency(ZLIB). This macro automatically sets QUIET or REQUIRED to match the parent find_package call. So if you call find_package(boost_iostreams REQUIRED), it will invoke find_package(ZLIB REQUIRED), but if you call find_package(boost_iostreams), it will invoke find_package(ZLIB). This is standard CMake behavior.

-- Reply to this email directly or view it on GitHub: https://github.com/boostorg/cmake/issues/34#issuecomment-1374891778 You are receiving this because you authored the thread.

Message ID: @.***>

pdimov commented 1 year ago

So, your complaint is not about find_dependency(ZLIB) in the installed CMake config files, but (for example) about this use of find_package:

https://github.com/boostorg/iostreams/blob/d1c1114a611afb090a007c9ff3e94efbcb914ef3/CMakeLists.txt#L30

marakew commented 1 year ago

yes and all another "required" with may present or will present in boost/cmake infrastructure just remove it to allow users ovewrite by own libs settings

2023-01-09 1:25 GMT+02:00, Peter Dimov @.***>:

So, your complaint is not above find_dependency(ZLIB) in the installed CMake config files, but (for example) about this use of find_package:

https://github.com/boostorg/iostreams/blob/d1c1114a611afb090a007c9ff3e94efbcb914ef3/CMakeLists.txt#L30

-- Reply to this email directly or view it on GitHub: https://github.com/boostorg/cmake/issues/34#issuecomment-1374958322 You are receiving this because you authored the thread.

Message ID: @.***>