Alexander Grund wrote:
Hi Peter,
thanks, yes this fixes the issue, although I'd used an "elseif" to reduce the nesting.
Another possible issue is pretty much every use of `if(NOT Boost_*`, e.g. `if(NOT Boost_USE_STATIC_RUNTIME)`. The CMake FindModule documents this as "Set to ON or OFF to specify whether to use libraries linked statically to the C++ runtime ('s' tag). Default is platform dependent.". The current implementation is "Default is OFF".
Yes, this is intentional. https://github.com/boostorg/boost_install/blob/develop/BoostConfig.cmake#L30... Both `b2 install` and autolink default to shared runtime under Windows.
This should be checked for all other variables too. E.g. "Boost_USE_DEBUG_RUNTIME" should default to "ON". Currently it seems to be kinda random: Depending on which variant file gets sourced last, that's the one that wins. Not sure how to solve this other than ordering the variant includes appropriately.
It's very rare for there to be two variants that only differ by the debugness / debugity of the runtime; the typical case is a debug build using the debug runtime, and a release build using the release runtime. I'm not even sure if it's possible to mix debug/release with the "other" runtime. So this shouldn't be a problem in practice.
Finally: All uses of `message` should be reevaluated and either removed or guarded by `Boost_DEBUG` or `*_FIND_QUIETLY`.
This was one of the first things to be fixed; the current master/develop should not issue any messages at all unless Boost_DEBUG or Boost_VERBOSE are set, per established CMake practices (of which I wasn't aware previously).
- Adding the _BOOST_INCLUDEDIR is not required. All targets depend on Boost::headers which has them. Same for BOOST_ALL_NO_LIB definition
Shouldn't hurt.
- Regarding: "find_dependency doesn't forward arguments until 3.9, so we have to roll our own". This does not seem correct: https://cmake.org/cmake/help/v3.0/module/CMakeFindDependencyMacro.html
The comment is no longer correct, so I've already removed it. It used to be correct though; CMake 3.9+ forward additional arguments (${ARGN}) from find_dependency, such as `HINTS ...`.