Open
Conversation
fae2ad5 to
61a216e
Compare
Using targets is the modern CMake way. Boost::system has been a header-only library since Boost 1.69, so let's make it conditional.
It has been perfectly normal for it not to exist since it was made a header-only library in Boost 1.69.
2fe2856 to
d54b9d6
Compare
That was a Irix-specific variable removed in CMake 3.14. The original intention was likely to set THREADS_PREFER_PTHREAD_FLAG, but the user should be able to decide.
Targets are the modern CMake way.
Boost::headers has always existed in the upstream version, and has been in CMake since 3.15. Boost::boost has only existed as a compatibility target upstream, and FindBoost is deprecated. I don't look for the "headers" component because it's not defined as such in CMake's FindBoost.cmake.
They are only needed if something is actually built, not just to install the interface library. Adding the empty IMPORTED libraries in case somebody uses CMAKE_LINK_LIBRARIES_ONLY_TARGETS.
It makes no sense to look for components that are not included in target_link_libraries. I have seen some #include <boost/thread/XXX> in the code, but I'm supposing only the header-only part of Boost.Thread is used. In my project it works, and as long as it's not included in target_link_libraries too, I am not breaking anything.
It's the correct way, and I guess the reason include(CMakeFindDependencyMacro) was added in the first place.
When using target_link_libraries, the ALIAS target is resolved. So the
generated azmqTargets.cmake can end up with something like
set_target_properties(Azmq::azmq PROPERTIES
...
INTERFACE_LINK_LIBRARIES "PkgConfig::LIBZMQ;...
making the
include(${CMAKE_CURRENT_LIST_DIR}/FindAzmqLibzmq.cmake)
in azmqConfig.cmake meaningless. We want that PkgConfig::LIBZMQ to stay
as Azmq::libzmq, so it can be resolved to the correct target at use
time.
…D_FLAG CMAKE_THREAD_PREFER_PTHREAD was a Irix-specific variable removed in CMake 3.14. The original intention was likelt to use THREADS_PREFER_PTHREAD_FLAG.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have not tested the Boost::system part. An easier fix would be to simply increase the minimum Boost version from 1.68 to 1.69, but I see no reason why the version here would cause problems.