Skip to content
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

Put libconfig++ into libconfig export #234

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,38 +123,28 @@ target_include_directories(${libname}++
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

install(TARGETS ${libname}
install(TARGETS ${libname} ${libname}++
EXPORT libconfigTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(TARGETS ${libname}++
EXPORT libconfig++Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)


include(CMakePackageConfigHelpers)
foreach(target_name libconfig libconfig++)
write_basic_package_version_file("${target_name}ConfigVersion.cmake"
write_basic_package_version_file("libconfigConfigVersion.cmake"
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
)

install(EXPORT ${target_name}Targets
FILE "${target_name}Config.cmake"
install(EXPORT libconfigTargets
FILE "libconfigConfig.cmake"
NAMESPACE libconfig::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libconfig
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${target_name}ConfigVersion.cmake"
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/libconfigConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libconfig"
)
endforeach()