diff --git a/cmake/module-config.cmake.in b/cmake/module-config.cmake.in index b7215f3a..5cc12b01 100644 --- a/cmake/module-config.cmake.in +++ b/cmake/module-config.cmake.in @@ -1,9 +1,11 @@ @PACKAGE_INIT@ -if(NOT TARGET oatpp::oatpp) +if(NOT TARGET oatpp::@OATPP_MODULE_NAME@) include("${CMAKE_CURRENT_LIST_DIR}/@OATPP_MODULE_NAME@Targets.cmake") endif() set_and_check(@OATPP_MODULE_NAME@_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/oatpp-@OATPP_MODULE_VERSION@/@OATPP_MODULE_NAME@/") -set_and_check(@OATPP_MODULE_NAME@_LIBRARIES_DIRS "${PACKAGE_PREFIX_DIR}/lib/@OATPP_MODULE_NAME@-@OATPP_MODULE_VERSION@/") +set_and_check(@OATPP_MODULE_NAME@_LIBRARIES_DIRS "${PACKAGE_PREFIX_DIR}/@OATPP_MODULE_LIBDIR@/oatpp-@OATPP_MODULE_VERSION@/") + set(@OATPP_MODULE_NAME@_LIBRARIES @OATPP_MODULE_LIBRARIES@) +set(OATPP_BASE_DIR "${PACKAGE_PREFIX_DIR}/include/oatpp-@OATPP_MODULE_VERSION@/") diff --git a/cmake/module-install.cmake b/cmake/module-install.cmake index 09b28ff4..4506ea6e 100644 --- a/cmake/module-install.cmake +++ b/cmake/module-install.cmake @@ -37,12 +37,15 @@ message("\n##################################################################### ## Set cache variables to configure module-config.cmake.in template ## via call to configure_package_config_file +include(GNUInstallDirs) + set(OATPP_MODULE_NAME ${OATPP_THIS_MODULE_NAME} CACHE STRING "oatpp module name") set(OATPP_MODULE_VERSION "${OATPP_THIS_MODULE_VERSION}" CACHE STRING "oatpp module version") set(OATPP_MODULE_LIBRARIES "${OATPP_THIS_MODULE_LIBRARIES}" ## list libraries to find when find_package is called CACHE INTERNAL "oatpp module libraries" ) +set(OATPP_MODULE_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "lib folder name") ####################################################################################### ## calc directories to install (relative to this script) @@ -54,8 +57,6 @@ endforeach() ####################################################################################### -include(GNUInstallDirs) - install(TARGETS ${OATPP_THIS_MODULE_TARGETS} EXPORT "${OATPP_MODULE_NAME}Targets" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/oatpp-${OATPP_MODULE_VERSION}" @@ -93,6 +94,7 @@ configure_package_config_file( OATPP_MODULE_NAME OATPP_MODULE_VERSION OATPP_MODULE_LIBRARIES + OATPP_MODULE_LIBDIR NO_CHECK_REQUIRED_COMPONENTS_MACRO )