diff --git a/CMakeLists.txt b/CMakeLists.txt index e734714..6d665dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -397,7 +397,7 @@ add_subdirectory(devapi) # Generate the main connector library. merge_libraries(connector xapi devapi) -target_include_directories(connector PUBLIC "${PROJECT_SOURCE_DIR}/include") +target_include_directories(connector PRIVATE "${PROJECT_SOURCE_DIR}/include") # @@ -472,32 +472,23 @@ set_target_properties(connector PROPERTIES SOVERSION "${ABI_VERSION_MAJOR}" ) - -install(TARGETS connector - CONFIGURATIONS Release RelWithDebInfo - ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}" COMPONENT XDevAPIDev - RUNTIME DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll -) - -install(TARGETS connector - CONFIGURATIONS Debug - ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}/debug" COMPONENT XDevAPIDev - RUNTIME DESTINATION "${INSTALL_LIB_DIR}/debug" COMPONENT XDevAPIDll - LIBRARY DESTINATION "${INSTALL_LIB_DIR}/debug" COMPONENT XDevAPIDll +install(TARGETS connector EXPORT unofficial-mysql-connector-cpp-targets + ARCHIVE DESTINATION lib COMPONENT XDevAPIDev + RUNTIME DESTINATION bin COMPONENT XDevAPIDll + LIBRARY DESTINATION lib COMPONENT XDevAPIDll ) if(MSVC AND NOT BUILD_STATIC) install(FILES $ CONFIGURATIONS RelWithDebInfo - DESTINATION "${INSTALL_LIB_DIR}" + DESTINATION bin COMPONENT Debuginfo ) install(FILES $ CONFIGURATIONS Debug - DESTINATION "${INSTALL_LIB_DIR}/debug" + DESTINATION bin COMPONENT Debuginfo ) @@ -604,3 +595,15 @@ endif() show_config_options() + +include(CMakePackageConfigHelpers) +configure_package_config_file( + "${CMAKE_SOURCE_DIR}/mysql-connector-cpp-config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-mysql-connector-cpp-config.cmake" + INSTALL_DESTINATION "share/unofficial-mysql-connector-cpp" +) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-mysql-connector-cpp-config.cmake" DESTINATION "share/unofficial-mysql-connector-cpp") +install(EXPORT unofficial-mysql-connector-cpp-targets + NAMESPACE unofficial::mysql-connector-cpp:: + DESTINATION share/unofficial-mysql-connector-cpp +) \ No newline at end of file