Generate and install cmake config files for Okteta Core and Gui

parent cfbe775e
......@@ -10,6 +10,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" $
include(ECMInstallIcons)
include(ECMGenerateHeaders)
include(ECMSetupVersion)
include(ECMPackageConfigHelpers)
include(FeatureSummary)
include(GenerateExportHeader)
......
project( oktetacore )
ecm_setup_version( ${OKTETALIBS_LIB_VERSION}
VARIABLE_PREFIX OKTETACORE
SOVERSION ${OKTETALIBS_LIB_SOVERSION}
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/OktetaCoreConfigVersion.cmake"
)
add_definitions(-DTRANSLATION_DOMAIN=\"liboktetacore\")
set( libcontroller_SRCS
......@@ -114,12 +120,13 @@ PRIVATE
target_include_directories(${oktetacore_LIB} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/okteta>")
set_target_properties( ${oktetacore_LIB} PROPERTIES
EXPORT_NAME "OktetaCore"
OUTPUT_NAME ${oktetacore_LIB_NAME}
VERSION ${OKTETALIBS_LIB_VERSION}
SOVERSION ${OKTETALIBS_LIB_SOVERSION}
VERSION ${OKTETACORE_VERSION}
SOVERSION ${OKTETACORE_SOVERSION}
)
install( TARGETS ${oktetacore_LIB} ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( TARGETS ${oktetacore_LIB} EXPORT OktetaCoreTargets ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( FILES
${oktetacore_LIB_HDRS}
......@@ -133,6 +140,27 @@ install( FILES ${oktetacore_LIB_CCHDRS}
COMPONENT Devel
)
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Okteta")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/OktetaCoreConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/OktetaCoreConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install( FILES
"${CMAKE_CURRENT_BINARY_DIR}/OktetaCoreConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/OktetaCoreConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT OktetaCoreTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE OktetaCoreTargets.cmake
)
if(BUILD_TESTING)
add_library( testoktetacore STATIC ${oktetacore_LIB_OBJS} )
......
@PACKAGE_INIT@
find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/OktetaCoreTargets.cmake")
project( oktetagui )
ecm_setup_version( ${OKTETALIBS_LIB_VERSION}
VARIABLE_PREFIX OKTETAGUI
SOVERSION ${OKTETALIBS_LIB_SOVERSION}
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/OktetaGuiConfigVersion.cmake"
)
add_definitions(-DTRANSLATION_DOMAIN=\"liboktetagui\")
include_directories(
......@@ -138,9 +144,10 @@ target_link_libraries( ${oktetagui_LIB} LINK_PRIVATE
KF5::ConfigWidgets
)
set_target_properties( ${oktetagui_LIB} PROPERTIES
EXPORT_NAME "OktetaGui"
OUTPUT_NAME ${oktetagui_LIB_NAME}
VERSION ${OKTETALIBS_LIB_VERSION}
SOVERSION ${OKTETALIBS_LIB_SOVERSION}
VERSION ${OKTETAGUI_VERSION}
SOVERSION ${OKTETAGUI_SOVERSION}
LABELS OktetaLabel
)
......@@ -155,6 +162,27 @@ install( FILES ${oktetagui_LIB_CCHDRS}
COMPONENT Devel
)
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Okteta")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/OktetaGuiConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/OktetaGuiConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install( FILES
"${CMAKE_CURRENT_BINARY_DIR}/OktetaGuiConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/OktetaGuiConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT OktetaCoreTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE OktetaCoreTargets.cmake
)
add_subdirectory( test )
# add_library( testoktetacore STATIC ${oktetagui_LIB_SRCS} )
......
@PACKAGE_INIT@
find_dependency(OktetaCore @OKTETALIBS_LIB_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/OktetaGuiTargets.cmake")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment