I have two packages that are under the same catkin workspace
I have package A and package B where B needs to get include files and library files of A.
in CMakeLists.txt
of A, I had
set(TEST_VAR "TEST")
configure_package_config_file(
fooConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/fooConfig.cmake
INSTALL_DESTINATION ...
PATH_VARS
TEST_VAR)
and defined fooConfig.cmake.in
as following
set(foo_VERSION 0.0.1)
@PACKAGE_INIT@
set_and_check(foo_TEST "@PACKAGE_TEST_VAR@")
check_required_components(foo)
With the above set of codes, I should be able to use find_package
keywords from B
find_package(foo REQUIRED)
In the scenario that I expect,
foo_LIBRARIES
should not be empty (filled in automatically) and
foo_TEST
should not be empty as I provided it through PATH_VARS
But I was seeing the following results
${foo_FOUND} - TRUE
${foo_TEST} - EMPTY !!!
${foo_INCLUDE_DIRS} - .../build/foo/usr/include
${foo_LIBRARIES} - EMPTY !!!
To understand the behavior in more depth, I have directly added message
to generated fooConfig.cmake
and printed out foo_TEST
variable. However, I noticed that it was empty.
To summarize, I want to understand
- why
${foo_LIBRARIES}
is not set correctly - whether
${foo_TEST}
being empty inside CMakeLists.txt of B is expected or not. - why
${foo_TEST}
is unavailable insidecmake.in
Thank you