Change installation directories for library

I prefer putting the headers and library files not directly into the
lib or include directory, but into a package-specific subdirectory.
This commit is contained in:
Patrick Kappl
2024-01-11 13:27:44 +01:00
parent 583b2f382d
commit 758113809c
+8 -7
View File
@@ -4,14 +4,15 @@ include(CMakePackageConfigHelpers)
# Name of the package to use when calling find_package(<package>) in consumer code # Name of the package to use when calling find_package(<package>) in consumer code
set(package livox_sdk) set(package livox_sdk)
# Install target types (ARCHIVE, LIBRARY, PUBLIC_HEADER, ...) to default locations (lib, include) set(livox_sdk_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${package}")
# and create an export. set(livox_sdk_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${package}")
install(TARGETS ${SDK_LIBRARY} EXPORT livox_sdkTargets) set(livox_sdk_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}")
# Allow package maintainers to freely override the path for the configs # Install target types to the given destinations and create an export.
set(livox_sdk_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}" install(TARGETS ${SDK_LIBRARY} EXPORT livox_sdkTargets
CACHE PATH "CMake package config location relative to the install prefix") ARCHIVE DESTINATION "${livox_sdk_INSTALL_LIBDIR}"
mark_as_advanced(livox_sdk_INSTALL_CMAKEDIR) LIBRARY DESTINATION "${livox_sdk_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${livox_sdk_INSTALL_INCLUDEDIR}")
# Copy the package config file to the install location and give it the correct name # Copy the package config file to the install location and give it the correct name
install(FILES ../cmake/install-config.cmake install(FILES ../cmake/install-config.cmake