-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make find_package work for rmqcpp #15
Make find_package work for rmqcpp #15
Conversation
* find_package? * cmake_install_libdir * use CMAKE_CURRENT_SOURCE_DIR for BUILD_INTERFACE * export target command * export config * export dest * test install to multiple locations * export config to prefix/share/rmqcpp * rm export and only install * export targets * add Config.cmake.in * make target_link_libraries interface instead of public * find_dependency ZLIB * find_dependency in cmake.in, change ns * revert explicit find_dependency * find_package in cmake.in * namespace rmqcpp::
target_include_directories(rmq PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rmqt>) | ||
target_include_directories(rmq PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rmqp>) | ||
target_include_directories(rmq PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rmqa>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These generator expressions are required if we are creating a relocatable package (with no absolute paths) which uses install(TARGETS)
and install(EXPORT)
later to produce the rmqcppTargets.cmake
file.
foreach(dep bal;OpenSSL;ZLIB) | ||
find_package(${dep}) | ||
endforeach() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are needed so that the consuming upstream application does not need to explicitly do find_package(dep)
for deps of rmqcpp.
NAMESPACE rmqcpp::) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses Config.cmake.in
as input and produces the rmqcppConfig.cmake
which find_package
looks for.
install(EXPORT rmqcppTargets | ||
FILE rmqcppTargets.cmake | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/rmqcpp | ||
NAMESPACE rmqcpp::) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to go with rmqcpp::rmq
be how users link to rmqcpp, with rmqcpp::rmqtestmocks
a possibility in future.
Problem statement
Make
find_package(rmqcpp REQUIRED)
work for applications installing rmqcpp using a package manager like vcpkg.Proposed changes
rmqcppTargets.cmake
andrmqcppConfig.cmake
[generated using theConfig.cmake.in
] files.rmqperftest
with a local vcpkg registry overlay with armqcpp
port to installrmqcpp
.