mirror of
https://github.com/mat007/turtle.git
synced 2026-08-20 21:09:46 +00:00
Some checks failed
CI / Formatting (push) Has been cancelled
CI / Build (17, MinGW Makefiles, windows-2022, gcc) (push) Has been cancelled
CI / Build (20, Visual Studio 17 2022, windows-2022, msvc-14.3) (push) Has been cancelled
CI / Build (20, Visual Studio 18 2026, windows-2025-vs2026, msvc-14.5) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-14, 14,17,20, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-18, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-19, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-20, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-21, 14,17,20,23,2c, ubuntu-26.04) (push) Has been cancelled
CI / Build (boost-1.86.0, clang-22, -Wno-c2y-extensions, 14,17,20,23,2c, ubuntu-26.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-10, 14,17,20, ubuntu-22.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-13, yes, 14,2b, Collect coverage, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-14, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-15, 14,17,20,23,2c, ubuntu-26.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-16, 14,17,20,23,26, ubuntu-26.04) (push) Has been cancelled
CI / Build (boost-1.86.0, gcc-7, ubuntu:20.04, 14,17, ubuntu-latest) (push) Has been cancelled
CI / Build (latest, Visual Studio 18 2026, windows-2025-vs2026, msvc-14.5) (push) Has been cancelled
CI / Build (master, clang-18, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (master, clang-22, -Wno-c2y-extensions, 14,17,20,23,2c, ubuntu-26.04) (push) Has been cancelled
CI / Build (master, gcc-12, 14,17,20, ubuntu-22.04) (push) Has been cancelled
CI / Build (master, gcc-14, 14,17,20,23,2c, ubuntu-24.04) (push) Has been cancelled
CI / Build (master, gcc-16, 14,17,20,23,26, ubuntu-26.04) (push) Has been cancelled
Release / Create Release (push) Has been cancelled
83 lines
2.8 KiB
CMake
83 lines
2.8 KiB
CMake
# Copyright 2019-2025 Alexander Grund
|
|
# Distributed under the Boost Software License, Version 1.0.
|
|
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
|
|
|
|
cmake_minimum_required(VERSION 3.16...3.20)
|
|
project(turtle VERSION 2.0.0 LANGUAGES CXX)
|
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
set(IS_ROOT_PROJECT ON)
|
|
include(CTest)
|
|
else()
|
|
set(IS_ROOT_PROJECT OFF)
|
|
endif()
|
|
|
|
option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT})
|
|
|
|
# Default boost libs are static on windows and dynamic on linux
|
|
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
endif()
|
|
|
|
# Allows boost to be build by parent project
|
|
if(NOT TARGET Boost::boost)
|
|
find_package(Boost 1.58 REQUIRED)
|
|
endif()
|
|
|
|
set(MOCK_VERSION "\"${PROJECT_VERSION}\"")
|
|
set(_turtleVersionFile ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp)
|
|
configure_file(version.hpp.cmake ${_turtleVersionFile} @ONLY)
|
|
|
|
add_library(turtle INTERFACE)
|
|
add_library(turtle::turtle ALIAS turtle)
|
|
target_include_directories(turtle INTERFACE $<BUILD_INTERFACE:include;${CMAKE_CURRENT_BINARY_DIR}/include>)
|
|
target_compile_features(turtle INTERFACE cxx_std_14)
|
|
|
|
target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking)
|
|
|
|
if(NOT CMAKE_VERSION VERSION_LESS 3.19)
|
|
file(GLOB _turtleHeaders include/turtle/*.hpp)
|
|
file(GLOB _turtleHeadersDetail include/turtle/detail/*.hpp)
|
|
source_group(turtle FILES ${_turtleHeaders} ${_turtleVersionFile})
|
|
source_group(turtle/detail FILES ${_turtleHeadersDetail})
|
|
target_sources(turtle PRIVATE ${_turtleHeaders} ${_turtleVersionFile} ${_turtleHeadersDetail})
|
|
endif()
|
|
|
|
if(BUILD_TESTING)
|
|
add_subdirectory(test)
|
|
endif()
|
|
|
|
if(TURTLE_INSTALL)
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
target_include_directories(turtle INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
|
|
install(TARGETS turtle
|
|
EXPORT ${PROJECT_NAME}Targets
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
)
|
|
install(DIRECTORY include/ ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
set(configFile ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake)
|
|
set(versionFile ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake)
|
|
set(configInstallDestination lib/cmake/${PROJECT_NAME})
|
|
|
|
configure_package_config_file(
|
|
${PROJECT_SOURCE_DIR}/Config.cmake.in
|
|
${configFile}
|
|
INSTALL_DESTINATION ${configInstallDestination}
|
|
)
|
|
|
|
write_basic_package_version_file(${versionFile} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
|
|
|
|
install(FILES ${configFile} ${versionFile} DESTINATION ${configInstallDestination})
|
|
|
|
install(
|
|
EXPORT ${PROJECT_NAME}Targets
|
|
NAMESPACE "turtle::"
|
|
DESTINATION ${configInstallDestination}
|
|
)
|
|
endif()
|