Fix bug in CMake installation that prevented users from finding the headers via cmake/pkgconfig

This commit is contained in:
2026-01-12 08:32:29 -05:00
parent cb9af93e0b
commit 6acae958ff
2 changed files with 11 additions and 1 deletions

View File

@@ -34,6 +34,16 @@ target_link_libraries(test_err_trace PRIVATE akerror)
set(main_lib_dest "lib/my_library-${MY_LIBRARY_VERSION}") set(main_lib_dest "lib/my_library-${MY_LIBRARY_VERSION}")
install(TARGETS akerror EXPORT akerror DESTINATION "lib/") install(TARGETS akerror EXPORT akerror DESTINATION "lib/")
install(TARGETS akerror
EXPORT akerrorTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT akerror FILE akerrorTargets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/akerror)
install(FILES "include/akerror.h" DESTINATION "include/") install(FILES "include/akerror.h" DESTINATION "include/")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akerror.pc DESTINATION "lib/pkgconfig/") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akerror.pc DESTINATION "lib/pkgconfig/")

View File

@@ -2,4 +2,4 @@
include(CMakeFindDependencyMacro) # If your library has dependencies include(CMakeFindDependencyMacro) # If your library has dependencies
# find_dependency(AnotherDependency REQUIRED) # Example dependency # find_dependency(AnotherDependency REQUIRED) # Example dependency
include("${CMAKE_CURRENT_LIST_DIR}/akerror.cmake") include("${CMAKE_CURRENT_LIST_DIR}/akerrorTargets.cmake")