Skip to content

Commit

Permalink
Cleanup CMake files
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Nov 20, 2024
1 parent f1402d6 commit 830a464
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 61 deletions.
28 changes: 6 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ cmake_minimum_required(VERSION 3.27...3.31)
project(beman_optional26 VERSION 0.0.0 LANGUAGES CXX)

# Includes
include(CPACK)
include(FetchContent)
include(CPack)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(TARGET_PACKAGE_NAME ${PROJECT_NAME})
set(TARGETS_EXPORT_NAME ${TARGET_PACKAGE_NAME}-targets)
Expand All @@ -22,7 +23,7 @@ option(

# Build the tests if enabled via the option OPTIONAL26_ENABLE_TESTING
if(OPTIONAL26_ENABLE_TESTING)
enable_testing()
include(FetchContent)

# Fetch GoogleTest
FetchContent_Declare(
Expand All @@ -33,6 +34,8 @@ if(OPTIONAL26_ENABLE_TESTING)
e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
)
FetchContent_MakeAvailable(googletest)

enable_testing()
endif()

set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)
Expand Down Expand Up @@ -64,8 +67,6 @@ add_subdirectory(include/beman/optional26)

add_subdirectory(examples)

include(CMakePackageConfigHelpers)

# install
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-config-version.cmake
Expand All @@ -86,23 +87,6 @@ install(
DESTINATION ${INSTALL_CONFIGDIR}
)

# # This will be used to replace @PACKAGE_cmakeModulesDir@
# set(cmakeModulesDir cmake)
# configure_package_config_file(
# cmake/Config.cmake.in
# beman_optional26-config.cmake
# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman_optional26/
# PATH_VARS cmakeModulesDir
# NO_SET_AND_CHECK_MACRO
# NO_CHECK_REQUIRED_COMPONENTS_MACRO
# )
#
# install(
# FILES ${CMAKE_CURRENT_BINARY_DIR}/beman_optional26-config.cmake
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman_optional26/
# COMPONENT beman_optional26_development
# )

# Coverage
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)

Expand Down
47 changes: 10 additions & 37 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 29,
"minor": 27,
"patch": 2
},
"configurePresets": [
Expand Down Expand Up @@ -88,35 +88,24 @@
"configuration": "Asan",
"targets": [
"all_verify_interface_header_sets",
"all"
"all",
"install"
]
},
{
"name": "system",
"inherits": "common",
"configurePreset": "system",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "system"
},
{
"name": "gcc-14",
"inherits": "common",
"configurePreset": "gcc-14",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "gcc-14"
},
{
"name": "gcc-13",
"inherits": "common",
"configurePreset": "gcc-13",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "gcc-13"
},
{
"name": "gcc-12",
Expand All @@ -131,38 +120,22 @@
{
"name": "clang-19",
"inherits": "common",
"configurePreset": "clang-19",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "clang-19"
},
{
"name": "clang-18",
"inherits": "common",
"configurePreset": "clang-18",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "clang-18"
},
{
"name": "clang-17",
"inherits": "common",
"configurePreset": "clang-17",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "clang-17"
},
{
"name": "clang-16",
"inherits": "common",
"configurePreset": "clang-16",
"targets": [
"all_verify_interface_header_sets",
"all"
]
"configurePreset": "clang-16"
}
],
"testPresets": [
Expand Down
2 changes: 0 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ if(PROJECT_IS_TOP_LEVEL)
find_package(beman_optional26 0.0.0 EXACT REQUIRED)
endif()

include(GNUInstallDirs)

# List of all buildable examples.
set(EXAMPLES
concept_checks
Expand Down

0 comments on commit 830a464

Please sign in to comment.