new_alterator/alterator/CMakeLists.txt
2022-07-18 21:39:54 +04:00

93 lines
3.1 KiB
CMake

cmake_minimum_required(VERSION 3.14)
project(alteratorlib
LANGUAGES CXX
VERSION 0.0.1
DESCRIPTION "lib for new alterator's front")
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INSTALL_PREFIX
"/home/SMB.BASEALT.RU/kozyrevid/work/new_alterator/install")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick QuickWidgets DBus Xml)
option(ALTERATOR_LIBDIR "Destination directory for alteratorlib"
"/lib64")
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/alterator_loader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dbus_connector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dbus_interface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/dbus_property_map.cpp)
set(HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/alterator_loader.h
${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_connector.h
${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_property_map.h)
set(ALTERATORLIB_VERSION 0.0.1)
set(ALTERATORLIB_SOVERSION 1)
configure_file(alteratorlibConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/alterator/include/alteratorlibConfig.h)
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(alteratorlib STATIC ${SOURCES} ${HEADERS})
target_include_directories(alteratorlib
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_link_libraries(alteratorlib
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::QuickWidgets
Qt${QT_VERSION_MAJOR}::DBus
Qt${QT_VERSION_MAJOR}::Xml)
set_target_properties(alteratorlib PROPERTIES
VERSION ${ALTERATORLIB_VERSION}
SOVERSION ${ALTERATORLIB_SOVERSION})
install(TARGETS alteratorlib
EXPORT alteratorlib
LIBRARY DESTINATION ${ALTERATOR_LIBDIR})
install(FILES ${HEADERS}
DESTINATION include)
install(FILES "${PROJECT_BINARY_DIR}/include/config.h"
DESTINATION include)
install(EXPORT alteratorlib
FILE alteratorlib.cmake
DESTINATION lib/cmake/alteratorlib)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/alteratorlibConfig.cmake"
INSTALL_DESTINATION "lib/cmake/example"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/alteratorlibConfigVersion.cmake"
VERSION "${ALTERATORLIB_VERSION}"
COMPATIBILITY AnyNewerVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/alteratorlibConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/alteratorlibConfigVersion.cmake
DESTINATION lib/cmake/alteratorlib
)
export(EXPORT alteratorlib
FILE "${CMAKE_CURRENT_BINARY_DIR}/alteratorlib.cmake"
)