-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Description
The c4 CMake scripts automatically take care of creating the CMake config files. Based on my (ever incomplete) understanding of CMake, I think that somewhere in this process there is a missing export()
. I have seen it done in other libraries (fmtlib, pugixml, etc.)
For example, in c4Project.cmake
:
#
# cfg_dst is the path relative to install root where the export
# should be installed; cfg_dst_rel is the path from there to
# the install root
macro(__c4_install_exports cfg_dst cfg_dst_rel)
# make sure that different exports are staged in different directories
set(case ${CMAKE_CURRENT_BINARY_DIR}/export_cases/${cfg_dst})
file(MAKE_DIRECTORY ${case})
#
install(EXPORT "${_TARGET}"
FILE "${targets_file}"
NAMESPACE "${_NAMESPACE}"
DESTINATION "${cfg_dst}")
export(EXPORT "${_TARGET}") # <---- this line is missing
#...
Without it, if I use rapidyaml in a library of my own and want to create an install target for my library, with exports, CMake currently complains that
CMake Error in CMakeLists.txt:
export called with target "mylib" which requires target "rapidyaml" that is not
in any export set.
This error is fixed by adding the export()
command as above. I'm happy to create a PR to suggest the modification, but I don't know if there's perhaps a better place to do this within the c4 scripts.
Metadata
Metadata
Assignees
Labels
No labels