Skip to content

Commit 830a464

Browse files
committed
Cleanup CMake files
1 parent f1402d6 commit 830a464

File tree

3 files changed

+16
-61
lines changed

3 files changed

+16
-61
lines changed

CMakeLists.txt

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ cmake_minimum_required(VERSION 3.27...3.31)
77
project(beman_optional26 VERSION 0.0.0 LANGUAGES CXX)
88

99
# Includes
10-
include(CPACK)
11-
include(FetchContent)
10+
include(CPack)
11+
include(GNUInstallDirs)
12+
include(CMakePackageConfigHelpers)
1213

1314
set(TARGET_PACKAGE_NAME ${PROJECT_NAME})
1415
set(TARGETS_EXPORT_NAME ${TARGET_PACKAGE_NAME}-targets)
@@ -22,7 +23,7 @@ option(
2223

2324
# Build the tests if enabled via the option OPTIONAL26_ENABLE_TESTING
2425
if(OPTIONAL26_ENABLE_TESTING)
25-
enable_testing()
26+
include(FetchContent)
2627

2728
# Fetch GoogleTest
2829
FetchContent_Declare(
@@ -33,6 +34,8 @@ if(OPTIONAL26_ENABLE_TESTING)
3334
e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
3435
)
3536
FetchContent_MakeAvailable(googletest)
37+
38+
enable_testing()
3639
endif()
3740

3841
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)
@@ -64,8 +67,6 @@ add_subdirectory(include/beman/optional26)
6467

6568
add_subdirectory(examples)
6669

67-
include(CMakePackageConfigHelpers)
68-
6970
# install
7071
write_basic_package_version_file(
7172
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-config-version.cmake
@@ -86,23 +87,6 @@ install(
8687
DESTINATION ${INSTALL_CONFIGDIR}
8788
)
8889

89-
# # This will be used to replace @PACKAGE_cmakeModulesDir@
90-
# set(cmakeModulesDir cmake)
91-
# configure_package_config_file(
92-
# cmake/Config.cmake.in
93-
# beman_optional26-config.cmake
94-
# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman_optional26/
95-
# PATH_VARS cmakeModulesDir
96-
# NO_SET_AND_CHECK_MACRO
97-
# NO_CHECK_REQUIRED_COMPONENTS_MACRO
98-
# )
99-
#
100-
# install(
101-
# FILES ${CMAKE_CURRENT_BINARY_DIR}/beman_optional26-config.cmake
102-
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman_optional26/
103-
# COMPONENT beman_optional26_development
104-
# )
105-
10690
# Coverage
10791
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
10892

CMakePresets.json

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": 6,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 29,
5+
"minor": 27,
66
"patch": 2
77
},
88
"configurePresets": [
@@ -88,35 +88,24 @@
8888
"configuration": "Asan",
8989
"targets": [
9090
"all_verify_interface_header_sets",
91-
"all"
91+
"all",
92+
"install"
9293
]
9394
},
9495
{
9596
"name": "system",
9697
"inherits": "common",
97-
"configurePreset": "system",
98-
"targets": [
99-
"all_verify_interface_header_sets",
100-
"all"
101-
]
98+
"configurePreset": "system"
10299
},
103100
{
104101
"name": "gcc-14",
105102
"inherits": "common",
106-
"configurePreset": "gcc-14",
107-
"targets": [
108-
"all_verify_interface_header_sets",
109-
"all"
110-
]
103+
"configurePreset": "gcc-14"
111104
},
112105
{
113106
"name": "gcc-13",
114107
"inherits": "common",
115-
"configurePreset": "gcc-13",
116-
"targets": [
117-
"all_verify_interface_header_sets",
118-
"all"
119-
]
108+
"configurePreset": "gcc-13"
120109
},
121110
{
122111
"name": "gcc-12",
@@ -131,38 +120,22 @@
131120
{
132121
"name": "clang-19",
133122
"inherits": "common",
134-
"configurePreset": "clang-19",
135-
"targets": [
136-
"all_verify_interface_header_sets",
137-
"all"
138-
]
123+
"configurePreset": "clang-19"
139124
},
140125
{
141126
"name": "clang-18",
142127
"inherits": "common",
143-
"configurePreset": "clang-18",
144-
"targets": [
145-
"all_verify_interface_header_sets",
146-
"all"
147-
]
128+
"configurePreset": "clang-18"
148129
},
149130
{
150131
"name": "clang-17",
151132
"inherits": "common",
152-
"configurePreset": "clang-17",
153-
"targets": [
154-
"all_verify_interface_header_sets",
155-
"all"
156-
]
133+
"configurePreset": "clang-17"
157134
},
158135
{
159136
"name": "clang-16",
160137
"inherits": "common",
161-
"configurePreset": "clang-16",
162-
"targets": [
163-
"all_verify_interface_header_sets",
164-
"all"
165-
]
138+
"configurePreset": "clang-16"
166139
}
167140
],
168141
"testPresets": [

examples/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ if(PROJECT_IS_TOP_LEVEL)
1313
find_package(beman_optional26 0.0.0 EXACT REQUIRED)
1414
endif()
1515

16-
include(GNUInstallDirs)
17-
1816
# List of all buildable examples.
1917
set(EXAMPLES
2018
concept_checks

0 commit comments

Comments
 (0)