From c6adc57e518ffdb1beb11bfa575cadbe729d201d Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Fri, 13 Dec 2024 06:57:14 +0100 Subject: [PATCH 1/2] Cleanup the cmake files --- CMakeLists.txt | 28 +++++++++++-------- CMakePresets.json | 6 ++-- .../beman/iterator_interface/CMakeLists.txt | 13 +++++---- tests/beman/iterator_interface/CMakeLists.txt | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 477ae42..0df6353 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,16 +67,20 @@ target_sources( TYPE HEADERS BASE_DIRS - src - include) - -target_include_directories( - beman.iterator_interface - PUBLIC - $ - $ - $ -) + # XXX src + ${PROJECT_BINARY_DIR}/include + ${PROJECT_SOURCE_DIR}/include + FILES + ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp + ) + +# target_include_directories( +# beman.iterator_interface +# PUBLIC +# $ +# $ +# $ +# ) add_subdirectory(src/beman/iterator_interface) add_subdirectory(include/beman/iterator_interface) @@ -100,5 +104,5 @@ add_custom_target( COMMAND mkdir -p coverage COMMAND gcovr --config gcovr.cfg .) -install(FILES ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/beman/iterator_interface) +# install(FILES ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp +# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/beman/iterator_interface) diff --git a/CMakePresets.json b/CMakePresets.json index d035bef..ddf75df 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -14,16 +14,14 @@ "name": "_debug-base", "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined" + "CMAKE_BUILD_TYPE": "Debug" } }, { "name": "_release-base", "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_CXX_FLAGS": "-O3" + "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { diff --git a/include/beman/iterator_interface/CMakeLists.txt b/include/beman/iterator_interface/CMakeLists.txt index 749ac46..281b603 100644 --- a/include/beman/iterator_interface/CMakeLists.txt +++ b/include/beman/iterator_interface/CMakeLists.txt @@ -9,9 +9,12 @@ target_sources( beman_iterator_interface_headers TYPE HEADERS + BASE_DIRS + ${PROJECT_BINARY_DIR}/include + ${PROJECT_SOURCE_DIR}/include FILES - iterator_interface.hpp - iterator_interface_access.hpp - detail/stl_interfaces/config.hpp - detail/stl_interfaces/fwd.hpp - detail/stl_interfaces/iterator_interface.hpp) + ${CMAKE_CURRENT_SOURCE_DIR}/iterator_interface.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/iterator_interface_access.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/config.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/fwd.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/iterator_interface.hpp) diff --git a/tests/beman/iterator_interface/CMakeLists.txt b/tests/beman/iterator_interface/CMakeLists.txt index 9d2a629..3cd3b47 100644 --- a/tests/beman/iterator_interface/CMakeLists.txt +++ b/tests/beman/iterator_interface/CMakeLists.txt @@ -15,7 +15,7 @@ target_sources( PRIVATE FILE_SET beman_iterator_interface_tests_headers TYPE HEADERS) target_link_libraries( - beman.iterator_interface.tests PRIVATE beman::iterator_interface GTest::gtest + beman.iterator_interface.tests PRIVATE beman::iterator_interface # XXX GTest::gtest GTest::gtest_main) # [Issue #18](https://github.com/bemanproject/iterator_interface/issues/18): Re-enable ASAN run CI/clang-19. From 6884b2bb30c3d915a6f1855581a18c04cb7858a2 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 6 Jan 2025 22:33:35 +0100 Subject: [PATCH 2/2] Respect review comment Cleanup and format --- CMakeLists.txt | 29 +++++++------------ Makefile | 0 .../beman/iterator_interface/CMakeLists.txt | 27 ++++++++--------- tests/beman/iterator_interface/CMakeLists.txt | 5 ++-- 4 files changed, 27 insertions(+), 34 deletions(-) mode change 100755 => 100644 Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 0df6353..4c7aa2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # cmake-format: on -cmake_minimum_required(VERSION 3.27) +cmake_minimum_required(VERSION 3.27...3.31) project( beman.iterator_interface @@ -23,15 +23,19 @@ beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS) set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets) -option(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS +option( + BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS "Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers." ${COMPILER_SUPPORTS_DEDUCING_THIS}) -option(BEMAN_ITERATOR_INTERFACE_BUILD_TESTS - "Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL}) +option( + BEMAN_ITERATOR_INTERFACE_BUILD_TESTS + "Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}." + ${PROJECT_IS_TOP_LEVEL}) option(BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES - "Enable building examples. Default: ON. Values: {ON, OFF}." ${PROJECT_IS_TOP_LEVEL}) + "Enable building examples. Default: ON. Values: {ON, OFF}." + ${PROJECT_IS_TOP_LEVEL}) if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS AND NOT COMPILER_SUPPORTS_DEDUCING_THIS) @@ -67,20 +71,10 @@ target_sources( TYPE HEADERS BASE_DIRS - # XXX src ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/include FILES - ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp - ) - -# target_include_directories( -# beman.iterator_interface -# PUBLIC -# $ -# $ -# $ -# ) + ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp) add_subdirectory(src/beman/iterator_interface) add_subdirectory(include/beman/iterator_interface) @@ -103,6 +97,3 @@ add_custom_target( COMMENT "Running gcovr to process coverage results" COMMAND mkdir -p coverage COMMAND gcovr --config gcovr.cfg .) - -# install(FILES ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp -# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/beman/iterator_interface) diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/include/beman/iterator_interface/CMakeLists.txt b/include/beman/iterator_interface/CMakeLists.txt index 281b603..697cd03 100644 --- a/include/beman/iterator_interface/CMakeLists.txt +++ b/include/beman/iterator_interface/CMakeLists.txt @@ -5,16 +5,17 @@ target_sources( beman.iterator_interface - PUBLIC FILE_SET - beman_iterator_interface_headers - TYPE - HEADERS - BASE_DIRS - ${PROJECT_BINARY_DIR}/include - ${PROJECT_SOURCE_DIR}/include - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/iterator_interface.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/iterator_interface_access.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/config.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/fwd.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/detail/stl_interfaces/iterator_interface.hpp) + PUBLIC + FILE_SET + beman_iterator_interface_headers + TYPE + HEADERS + BASE_DIRS + ${PROJECT_BINARY_DIR}/include + ${PROJECT_SOURCE_DIR}/include + FILES + iterator_interface.hpp + iterator_interface_access.hpp + detail/stl_interfaces/config.hpp + detail/stl_interfaces/fwd.hpp + detail/stl_interfaces/iterator_interface.hpp) diff --git a/tests/beman/iterator_interface/CMakeLists.txt b/tests/beman/iterator_interface/CMakeLists.txt index 3cd3b47..75b566d 100644 --- a/tests/beman/iterator_interface/CMakeLists.txt +++ b/tests/beman/iterator_interface/CMakeLists.txt @@ -15,10 +15,11 @@ target_sources( PRIVATE FILE_SET beman_iterator_interface_tests_headers TYPE HEADERS) target_link_libraries( - beman.iterator_interface.tests PRIVATE beman::iterator_interface # XXX GTest::gtest + beman.iterator_interface.tests PRIVATE beman::iterator_interface GTest::gtest GTest::gtest_main) -# [Issue #18](https://github.com/bemanproject/iterator_interface/issues/18): Re-enable ASAN run CI/clang-19. +# [Issue #18](https://github.com/bemanproject/iterator_interface/issues/18): +# Re-enable ASAN run CI/clang-19. # # Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some # platforms. Temporary switch to gtest_add_tests and skip some Asan checks.