diff --git a/cmake/install-config.cmake b/cmake/install-config.cmake index 0022412..5f3e647 100644 --- a/cmake/install-config.cmake +++ b/cmake/install-config.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/livox_sdkTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/livox-sdkTargets.cmake") diff --git a/cmake/install-rules.cmake b/cmake/install-rules.cmake index 3af7c17..9c49d34 100644 --- a/cmake/install-rules.cmake +++ b/cmake/install-rules.cmake @@ -1,15 +1,17 @@ include(GNUInstallDirs) include(CMakePackageConfigHelpers) -# Name of the package to use when calling find_package() in consumer code -set(package livox_sdk) +# Name of the package to use when calling find_package() in consumer code. We use +# kebap-case because vcpkg uses that for its port names. +set(package livox-sdk) set(livox_sdk_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${package}") set(livox_sdk_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${package}") -set(livox_sdk_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}") +# Set the install directory for the *config.cmake files to the path where vcpkg looks by default +set(livox_sdk_INSTALL_CMAKEDIR "share/${package}") # Install target types to the given destinations and create an export. -install(TARGETS ${SDK_LIBRARY} EXPORT livox_sdkTargets +install(TARGETS ${SDK_LIBRARY} EXPORT livox-sdkTargets ARCHIVE DESTINATION "${livox_sdk_INSTALL_LIBDIR}" LIBRARY DESTINATION "${livox_sdk_INSTALL_LIBDIR}" PUBLIC_HEADER DESTINATION "${livox_sdk_INSTALL_INCLUDEDIR}") @@ -28,6 +30,6 @@ install(FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" DESTINATION ${livox_sdk_INSTALL_CMAKEDIR}) # Generate and install a CMake file with code for installing targets from the given export -install(EXPORT livox_sdkTargets +install(EXPORT livox-sdkTargets NAMESPACE livox_sdk:: DESTINATION ${livox_sdk_INSTALL_CMAKEDIR})