-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
57 lines (47 loc) · 2.05 KB
/
Copy pathCMakeLists.txt
File metadata and controls
57 lines (47 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Generic Process Information
# Copyright 2024 Abdulkareem Siddiq. All rights reserved.
# See LICENSE file
#
# When building from our CI server, the following options must be set:
# - string2map_BUILD_TESTS=ON
# - CI_BUILDID must be set to the gitversion
#
cmake_minimum_required(VERSION 3.29)
# Version detection must precede project() declaration
# Figures out ${CURRENT_PROJECT_VERSION} and brings in CPM module
include(pack/CMakeCommonHelpers.cmake)
# Project metadata
project(string2map
VERSION "${CURRENT_PROJECT_VERSION}"
LANGUAGES CXX
HOMEPAGE_URL "%%myurl%%"
DESCRIPTION "Header only C++17 library to parse a string containing delimited key-value pairs into a map container including the feature to convert from std::string to std::wstring and vice-versa.")
# Set C++ standard globally
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Build options
option(${PROJECT_NAME}_BUILD_TESTS "Build tests for ${PROJECT_NAME}" OFF)
option(CI_BUILDID "Build ID for CI builds" "0.0.0")
# Library definition
add_library(${PROJECT_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
# Include directories
target_include_directories(${PROJECT_NAME}
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
# Compile features and options
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_23)
# ____________________________________
# Dependencies
# Here we explicitly declare that we depend on the nlohmann_json package and that
# the client will only need to depend on our file where the nlohmann_json will
# automatically included.
# Testing configuration
if(${PROJECT_NAME}_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests" AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests")
message(STATUS "${PROJECT_NAME}: Building tests (${PROJECT_NAME}_BUILD_TESTS=ON)")
enable_testing()
add_subdirectory(tests)
endif()