1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 05:31:13 +02:00

modernize cmake packages (#149)

This commit is contained in:
Claus Klein 2022-03-23 12:52:34 +01:00 committed by GitHub
parent 2b5d0934c1
commit b3007ae14a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 12 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) cmake_minimum_required(VERSION 3.14...3.22)
# ---- Project ---- # ---- Project ----
@ -28,7 +28,7 @@ CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.8.0")
CPMAddPackage( CPMAddPackage(
NAME fmt NAME fmt
GIT_TAG 7.1.3 GIT_TAG 8.1.1
GITHUB_REPOSITORY fmtlib/fmt GITHUB_REPOSITORY fmtlib/fmt
OPTIONS "FMT_INSTALL YES" # create an installable target OPTIONS "FMT_INSTALL YES" # create an installable target
) )
@ -45,7 +45,6 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/
# Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface # Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface
# target: add_library(${PROJECT_NAME} INTERFACE) # target: add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME} ${headers} ${sources}) add_library(${PROJECT_NAME} ${headers} ${sources})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
# being a cross-platform target, we enforce standards conformance on MSVC # being a cross-platform target, we enforce standards conformance on MSVC
@ -75,5 +74,5 @@ packageProject(
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}" VERSION_HEADER "${VERSION_HEADER_LOCATION}"
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
DEPENDENCIES "fmt 7.1.3" DEPENDENCIES "fmt 8.1.1"
) )

View file

@ -1,7 +1,7 @@
# this script adds all subprojects to a single build to allow IDEs understand the full project # this script adds all subprojects to a single build to allow IDEs understand the full project
# structure. # structure.
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) cmake_minimum_required(VERSION 3.14...3.22)
project(BuildAll LANGUAGES CXX) project(BuildAll LANGUAGES CXX)

View file

@ -1,4 +1,4 @@
set(CPM_DOWNLOAD_VERSION 0.32.0) set(CPM_DOWNLOAD_VERSION 0.35.0)
if(CPM_SOURCE_CACHE) if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~) # Expand relative path. This is important if the provided path contains a tilde (~)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) cmake_minimum_required(VERSION 3.14...3.22)
project(GreeterDocs) project(GreeterDocs)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) cmake_minimum_required(VERSION 3.14...3.22)
project(GreeterStandalone LANGUAGES CXX) project(GreeterStandalone LANGUAGES CXX)
@ -12,7 +12,7 @@ include(../cmake/CPM.cmake)
CPMAddPackage( CPMAddPackage(
GITHUB_REPOSITORY jarro2783/cxxopts GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 2.2.1 VERSION 3.0.0
OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES" OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
) )

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) cmake_minimum_required(VERSION 3.14...3.22)
project(GreeterTests LANGUAGES CXX) project(GreeterTests LANGUAGES CXX)
@ -15,8 +15,8 @@ include(../cmake/tools.cmake)
include(../cmake/CPM.cmake) include(../cmake/CPM.cmake)
CPMAddPackage("gh:onqtam/doctest#2.4.5") CPMAddPackage("gh:onqtam/doctest@2.4.8")
CPMAddPackage("gh:TheLartians/Format.cmake@1.7.0") CPMAddPackage("gh:TheLartians/Format.cmake@1.7.3")
if(TEST_INSTALLED_VERSION) if(TEST_INSTALLED_VERSION)
find_package(Greeter REQUIRED) find_package(Greeter REQUIRED)