2019-01-25 11:22:01 +08:00
|
|
|
#######################################################################################
|
|
|
|
## Set module properties
|
|
|
|
## all oatpp modules should have the same installation procedure
|
|
|
|
##
|
|
|
|
## installation tree:
|
|
|
|
##
|
|
|
|
## prefix/
|
|
|
|
## |
|
|
|
|
## |- include/oatpp-<version>/<module-name>
|
|
|
|
## - lib/
|
|
|
|
## |
|
|
|
|
## |- cmake/<module-name>-<version>/
|
|
|
|
## | |
|
|
|
|
## | |- <module-name>Config.cmake
|
|
|
|
## | - <module-name>ConfigVersion.cmake
|
|
|
|
## |
|
|
|
|
## - oatpp-<version>/
|
|
|
|
## |
|
|
|
|
## |- lib1.a
|
|
|
|
## |- lib2.a
|
|
|
|
## - ...
|
|
|
|
##
|
|
|
|
######################################################################################
|
|
|
|
|
|
|
|
message("\n############################################################################")
|
|
|
|
message("## oatpp-module-install.cmake\n")
|
|
|
|
|
|
|
|
message("OATPP_THIS_MODULE_NAME=${OATPP_THIS_MODULE_NAME}")
|
|
|
|
message("OATPP_THIS_MODULE_VERSION=${OATPP_THIS_MODULE_VERSION}")
|
|
|
|
message("OATPP_THIS_MODULE_LIBRARIES=${OATPP_THIS_MODULE_LIBRARIES}")
|
|
|
|
message("OATPP_THIS_MODULE_TARGETS=${OATPP_THIS_MODULE_TARGETS}")
|
|
|
|
message("OATPP_THIS_MODULE_DIRECTORIES=${OATPP_THIS_MODULE_DIRECTORIES}")
|
|
|
|
|
|
|
|
message("\n############################################################################\n")
|
|
|
|
|
|
|
|
#######################################################################################
|
|
|
|
## Set cache variables to configure module-config.cmake.in template
|
|
|
|
## via call to configure_package_config_file
|
|
|
|
|
2019-01-29 00:16:07 +08:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2019-01-25 11:22:01 +08:00
|
|
|
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"
|
|
|
|
)
|
2019-01-29 00:16:07 +08:00
|
|
|
set(OATPP_MODULE_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "lib folder name")
|
2019-01-25 11:22:01 +08:00
|
|
|
|
2019-01-25 22:38:19 +08:00
|
|
|
#######################################################################################
|
|
|
|
## calc directories to install (relative to this script)
|
|
|
|
## dirs should be in ( relative ../src/<dirs>)
|
|
|
|
|
|
|
|
foreach(CURR_DIR ${OATPP_THIS_MODULE_DIRECTORIES})
|
|
|
|
list(APPEND OATPP_DIRS_TO_INSTALL ${CMAKE_CURRENT_LIST_DIR}/../src/${CURR_DIR})
|
|
|
|
endforeach()
|
|
|
|
|
2019-01-25 11:22:01 +08:00
|
|
|
#######################################################################################
|
|
|
|
|
2021-11-26 16:38:47 +08:00
|
|
|
install(
|
|
|
|
TARGETS ${OATPP_THIS_MODULE_TARGETS}
|
|
|
|
EXPORT "${OATPP_MODULE_NAME}Targets"
|
|
|
|
ARCHIVE
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/oatpp-${OATPP_MODULE_VERSION}"
|
|
|
|
COMPONENT Devel
|
|
|
|
LIBRARY
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/oatpp-${OATPP_MODULE_VERSION}"
|
|
|
|
COMPONENT Library
|
|
|
|
RUNTIME
|
|
|
|
DESTINATION "${CMAKE_INSTALL_BINDIR}/oatpp-${OATPP_MODULE_VERSION}"
|
|
|
|
COMPONENT Library
|
|
|
|
INCLUDES
|
|
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/oatpp-${OATPP_MODULE_VERSION}/${OATPP_MODULE_NAME}"
|
2019-01-25 11:22:01 +08:00
|
|
|
)
|
|
|
|
|
2019-01-25 22:38:19 +08:00
|
|
|
install(DIRECTORY ${OATPP_DIRS_TO_INSTALL}
|
2019-01-25 11:22:01 +08:00
|
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/oatpp-${OATPP_MODULE_VERSION}/${OATPP_MODULE_NAME}"
|
2021-11-26 16:38:47 +08:00
|
|
|
COMPONENT Devel
|
2019-01-25 11:22:01 +08:00
|
|
|
FILES_MATCHING PATTERN "*.hpp"
|
|
|
|
)
|
|
|
|
|
|
|
|
install(EXPORT "${OATPP_MODULE_NAME}Targets"
|
|
|
|
FILE "${OATPP_MODULE_NAME}Targets.cmake"
|
|
|
|
NAMESPACE oatpp::
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${OATPP_MODULE_NAME}-${OATPP_MODULE_VERSION}"
|
2021-11-26 16:38:47 +08:00
|
|
|
COMPONENT Devel
|
2019-01-25 11:22:01 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
|
|
|
write_basic_package_version_file("${OATPP_MODULE_NAME}ConfigVersion.cmake"
|
|
|
|
VERSION ${OATPP_MODULE_VERSION}
|
|
|
|
COMPATIBILITY ExactVersion ## Use exact version matching.
|
|
|
|
)
|
|
|
|
|
|
|
|
## Take module-config.cmake.in file in this direcory as a template
|
|
|
|
|
|
|
|
configure_package_config_file(
|
2019-01-25 22:38:19 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/module-config.cmake.in"
|
2019-01-25 11:22:01 +08:00
|
|
|
"${OATPP_MODULE_NAME}Config.cmake"
|
|
|
|
INSTALL_DESTINATION
|
|
|
|
"${CMAKE_INSTALL_LIBDIR}/cmake/${OATPP_MODULE_NAME}-${OATPP_MODULE_VERSION}"
|
|
|
|
PATH_VARS
|
|
|
|
OATPP_MODULE_NAME
|
|
|
|
OATPP_MODULE_VERSION
|
|
|
|
OATPP_MODULE_LIBRARIES
|
2019-01-29 00:16:07 +08:00
|
|
|
OATPP_MODULE_LIBDIR
|
2019-01-25 11:22:01 +08:00
|
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${OATPP_MODULE_NAME}Config.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${OATPP_MODULE_NAME}ConfigVersion.cmake"
|
|
|
|
DESTINATION
|
|
|
|
"${CMAKE_INSTALL_LIBDIR}/cmake/${OATPP_MODULE_NAME}-${OATPP_MODULE_VERSION}"
|
2021-11-26 16:38:47 +08:00
|
|
|
COMPONENT Devel
|
|
|
|
)
|