Skip to content

Some CMake improvements#224

Open
reddwarf69 wants to merge 11 commits intozeromq:masterfrom
reddwarf69:master
Open

Some CMake improvements#224
reddwarf69 wants to merge 11 commits intozeromq:masterfrom
reddwarf69:master

Conversation

@reddwarf69
Copy link
Copy Markdown

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.

@reddwarf69 reddwarf69 force-pushed the master branch 2 times, most recently from fae2ad5 to 61a216e Compare February 19, 2026 14:30
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.
@reddwarf69 reddwarf69 force-pushed the master branch 2 times, most recently from 2fe2856 to d54b9d6 Compare February 19, 2026 20:26
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant