Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (60 sloc) 3.03 KB
cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR) # CONTRIBUTIONS WELCOME: Tests of previous/future versions which work or not
project(Compsky CXX) # Important that it is set before find_package is called
set(COMPSKY_MAJOR_VERSION 0)
set(COMPSKY_MINOR_VERSION 3)
set(COMPSKY_PATCH_VERSION 0)
set(COMPSKY_VERSION ${COMPSKY_MAJOR_VERSION}.${COMPSKY_MINOR_VERSION}.${COMPSKY_PATCH_VERSION})
include(GNUInstallDirs)
set(INC_DIR "${PROJECT_SOURCE_DIR}/include")
add_library(compsky INTERFACE)
target_compile_features(compsky INTERFACE cxx_std_17)
target_include_directories(compsky INTERFACE
$<BUILD_INTERFACE:${INC_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/CompskyConfigVersion.cmake"
VERSION "${COMPSKY_VERSION}"
COMPATIBILITY SameMinorVersion
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/CompskyConfig.cmake.in"
"${PROJECT_BINARY_DIR}/CompskyConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Compsky"
)
install(FILES "${PROJECT_BINARY_DIR}/CompskyConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/CompskyConfig.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Compsky")
install(DIRECTORY "${INC_DIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
add_subdirectory(mysql)
if(BUILD_PACKAGES)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
SET(CPACK_RPM_COMPONENT_INSTALL ON)
SET(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
if("${BUILD_PACKAGES}" STREQUAL "1")
set(CPACK_COMPONENTS_ALL asciify asciify-dev mysql mysql-dev regex-dev security security-dev)
message(STATUS "Note: You can specify the packages to build with -DBUILD_PACKAGES=<package_name>")
else()
set(CPACK_COMPONENTS_ALL ${BUILD_PACKAGES})
endif()
set(CPACK_COMPONENT_ASCIIFY_DESCRIPTION
"C++ library for rapid stringification prioritising speed above all")
set(CPACK_COMPONENT_ASCIIFY_DEV_DESCRIPTION
"C++ header files")
set(CPACK_COMPONENT_MYSQL_DESCRIPTION
"C++ library for interacting with MySQL/MariaDB prioritising speed and usability")
set(CPACK_COMPONENT_MYSQL_DEV_DESCRIPTION
"C++ header files")
set(CPACK_COMPONENT_REGEX_DEV_DESCRIPTION
"C++ library for pre-processing regex, in particular assigning named groups in a flexible manner")
set(CPACK_COMPONENT_SECURITY_DESCRIPTION
"C++ library with secure memset")
set(CPACK_COMPONENT_SECURITY_DEV_DESCRIPTION
"C++ header files")
set(Boost_USE_STATIC_LIBS ON) # Different repos have different libboost-regex versions that different repositories include, just easier to avoid this dependency for packages.
set(CPACK_DEBIAN_MYSQL_PACKAGE_DEPENDS "compsky-asciify (= ${COMPSKY_VERSION}), compsky-security (= ${COMPSKY_VERSION})")
set(CPACK_DEBIAN_MYSQL_DEV_PACKAGE_DEPENDS "compsky-asciify-dev (= ${COMPSKY_VERSION}), compsky-security-dev (= ${COMPSKY_VERSION})")
add_subdirectory(packaging)
endif()
You can’t perform that action at this time.