From 007006a3a6d96f77f08f621bd95b9d43da87da1c Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 9 Mar 2025 15:46:40 -0400 Subject: [PATCH 1/6] Redirect find_package to FetchContent Reuse the exemplar infrastructure for find_package integration. --- CMakeLists.txt | 13 --- Makefile | 1 + cmake/use-fetch-content.cmake | 175 ++++++++++++++++++++++++++++ lockfile.json | 10 ++ tests/beman/optional/CMakeLists.txt | 5 +- 5 files changed, 188 insertions(+), 16 deletions(-) create mode 100644 cmake/use-fetch-content.cmake create mode 100644 lockfile.json diff --git a/CMakeLists.txt b/CMakeLists.txt index ee7e390e..a6996a24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,19 +18,6 @@ option( ${PROJECT_IS_TOP_LEVEL} ) -# Build the tests if enabled via the option OPTIONAL_ENABLE_TESTING -if(OPTIONAL_ENABLE_TESTING) - # Fetch GoogleTest - FetchContent_Declare( - googletest - EXCLUDE_FROM_ALL - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG - e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0 - ) - FetchContent_MakeAvailable(googletest) -endif() - set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON) # Create the library target and named header set for beman_optional diff --git a/Makefile b/Makefile index f68c1f91..d19cfc5d 100755 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ define run_cmake = -DCMAKE_CONFIGURATION_TYPES=$(_configuration_types) \ -DCMAKE_INSTALL_PREFIX=$(abspath $(INSTALL_PREFIX)) \ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ + -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="./cmake/use-fetch-content.cmake" \ $(_cmake_args) \ $(CURDIR) endef diff --git a/cmake/use-fetch-content.cmake b/cmake/use-fetch-content.cmake new file mode 100644 index 00000000..098e279e --- /dev/null +++ b/cmake/use-fetch-content.cmake @@ -0,0 +1,175 @@ +cmake_minimum_required(VERSION 3.24) + +if(NOT BEMAN_OPTIONAL_LOCKFILE) + set(BEMAN_OPTIONAL_LOCKFILE + "lockfile.json" + CACHE FILEPATH + "Path to the dependency lockfile for the Beman Optional." + ) +endif() + +set(BemanOptional_projectDir "${CMAKE_CURRENT_LIST_DIR}/..") +message(TRACE "BemanOptional_projectDir=\"${BemanOptional_projectDir}\"") + +message(TRACE "BEMAN_OPTIONAL_LOCKFILE=\"${BEMAN_OPTIONAL_LOCKFILE}\"") +file( + REAL_PATH + "${BEMAN_OPTIONAL_LOCKFILE}" + BemanOptional_lockfile + BASE_DIRECTORY "${BemanOptional_projectDir}" + EXPAND_TILDE +) +message(DEBUG "Using lockfile: \"${BemanOptional_lockfile}\"") + +# Force CMake to reconfigure the project if the lockfile changes +set_property( + DIRECTORY "${BemanOptional_projectDir}" + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS "${BemanOptional_lockfile}" +) + +# For more on the protocol for this function, see: +# https://cmake.org/cmake/help/latest/command/cmake_language.html#provider-commands +function(BemanOptional_provideDependency method package_name) + # Read the lockfile + file(READ "${BemanOptional_lockfile}" BemanOptional_rootObj) + + # Get the "dependencies" field and store it in BemanOptional_dependenciesObj + string( + JSON + BemanOptional_dependenciesObj + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_rootObj}" + "dependencies" + ) + if(BemanOptional_error) + message(FATAL_ERROR "${BemanOptional_lockfile}: ${BemanOptional_error}") + endif() + + # Get the length of the libraries array and store it in BemanOptional_dependenciesObj + string( + JSON + BemanOptional_numDependencies + ERROR_VARIABLE BemanOptional_error + LENGTH "${BemanOptional_dependenciesObj}" + ) + if(BemanOptional_error) + message(FATAL_ERROR "${BemanOptional_lockfile}: ${BemanOptional_error}") + endif() + + # Loop over each dependency object + math(EXPR BemanOptional_maxIndex "${BemanOptional_numDependencies} - 1") + foreach(BemanOptional_index RANGE "${BemanOptional_maxIndex}") + set(BemanOptional_errorPrefix + "${BemanOptional_lockfile}, dependency ${BemanOptional_index}" + ) + + # Get the dependency object at BemanOptional_index + # and store it in BemanOptional_depObj + string( + JSON + BemanOptional_depObj + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_dependenciesObj}" + "${BemanOptional_index}" + ) + if(BemanOptional_error) + message( + FATAL_ERROR + "${BemanOptional_errorPrefix}: ${BemanOptional_error}" + ) + endif() + + # Get the "name" field and store it in BemanOptional_name + string( + JSON + BemanOptional_name + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_depObj}" + "name" + ) + if(BemanOptional_error) + message( + FATAL_ERROR + "${BemanOptional_errorPrefix}: ${BemanOptional_error}" + ) + endif() + + # Get the "package_name" field and store it in BemanOptional_pkgName + string( + JSON + BemanOptional_pkgName + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_depObj}" + "package_name" + ) + if(BemanOptional_error) + message( + FATAL_ERROR + "${BemanOptional_errorPrefix}: ${BemanOptional_error}" + ) + endif() + + # Get the "git_repository" field and store it in BemanOptional_repo + string( + JSON + BemanOptional_repo + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_depObj}" + "git_repository" + ) + if(BemanOptional_error) + message( + FATAL_ERROR + "${BemanOptional_errorPrefix}: ${BemanOptional_error}" + ) + endif() + + # Get the "git_tag" field and store it in BemanOptional_tag + string( + JSON + BemanOptional_tag + ERROR_VARIABLE BemanOptional_error + GET "${BemanOptional_depObj}" + "git_tag" + ) + if(BemanOptional_error) + message( + FATAL_ERROR + "${BemanOptional_errorPrefix}: ${BemanOptional_error}" + ) + endif() + + if(method STREQUAL "FIND_PACKAGE") + if(package_name STREQUAL BemanOptional_pkgName) + string( + APPEND + BemanOptional_debug + "Redirecting find_package calls for ${BemanOptional_pkgName} " + "to FetchContent logic fetching ${BemanOptional_repo} at " + "${BemanOptional_tag} according to ${BemanOptional_lockfile}." + ) + message(DEBUG "${BemanOptional_debug}") + FetchContent_Declare( + "${BemanOptional_name}" + GIT_REPOSITORY "${BemanOptional_repo}" + GIT_TAG "${BemanOptional_tag}" + EXCLUDE_FROM_ALL + ) + set(INSTALL_GTEST OFF) # Disable GoogleTest installation + FetchContent_MakeAvailable("${BemanOptional_name}") + + # Important! _FOUND tells CMake that `find_package` is + # not needed for this package anymore + set("${BemanOptional_pkgName}_FOUND" TRUE PARENT_SCOPE) + endif() + endif() + endforeach() + + set(GTest_FOUND TRUE PARENT_SCOPE) +endfunction() + +cmake_language( + SET_DEPENDENCY_PROVIDER BemanOptional_provideDependency + SUPPORTED_METHODS FIND_PACKAGE +) diff --git a/lockfile.json b/lockfile.json new file mode 100644 index 00000000..7b1d3868 --- /dev/null +++ b/lockfile.json @@ -0,0 +1,10 @@ +{ + "dependencies": [ + { + "name": "googletest", + "package_name": "GTest", + "git_repository": "https://github.com/google/googletest.git", + "git_tag": "e39786088138f2749d64e9e90e0f9902daa77c40" + } + ] +} diff --git a/tests/beman/optional/CMakeLists.txt b/tests/beman/optional/CMakeLists.txt index b3bf63e1..b2264101 100644 --- a/tests/beman/optional/CMakeLists.txt +++ b/tests/beman/optional/CMakeLists.txt @@ -3,11 +3,9 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # cmake-format: on -include(GoogleTest) +find_package(GTest REQUIRED) # Tests -# add_executable(beman_optional_test) - target_sources( beman_optional_test PRIVATE @@ -37,6 +35,7 @@ target_link_libraries( # Note: clang-19 + gtest_discover_tests + Asan setup causes errors on some # platforms. Temporary switch to gtest_add_tests and skip some Asan checks. # Change also applied for CI flows. +include(GoogleTest) gtest_add_tests(TARGET beman_optional_test "" AUTO) add_library(constructor_fails test_constructor_fail.cpp) From b4a0d47b58d21ae3b239c6402ff84bc76d1d43c6 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 9 Mar 2025 15:51:52 -0400 Subject: [PATCH 2/6] Add fetch-content to cmake config in CI Add CMAKE_PROJECT_TOP_LEVEL_INCLUDES to the config step in CI. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af0622a1..7abeb6c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,12 @@ jobs: echo ${{ matrix.config.cmake_args }} echo ${{ matrix.config.toolchain }} rm -rf .build - cmake ${{ matrix.config.cmake_args }} -DCMAKE_INSTALL_PREFIX=.install -DCMAKE_TOOLCHAIN_FILE="etc/${{ matrix.config.toolchain }}-toolchain.cmake" -B .build -S . + cmake ${{ matrix.config.cmake_args }} \ + -DCMAKE_INSTALL_PREFIX=.install \ + -DCMAKE_TOOLCHAIN_FILE="etc/${{ matrix.config.toolchain }}-toolchain.cmake" \ + -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="./cmake/use-fetch-content.cmake" \ + -B .build \ + -S . - name: CMake ASAN Build run: | set -x From 1fd602895ba9c8d6824938734280424701e3c3c9 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Mon, 10 Mar 2025 09:30:31 -0400 Subject: [PATCH 3/6] Add find_package directions in README Add directions for connecting find_package to FetchContent with the cmake code in use-fetch-content.cmake. --- .markdownlint.yaml | 5 +---- README.md | 48 +++++++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 3a59869e..d8341a57 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -3,10 +3,7 @@ MD033: false # MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md -# Conforms to .clang-format ColumnLimit -# Update the comment in .clang-format if we no-longer tie these two column limits. -MD013: - line_length: 119 +MD013: false # MD024/no-duplicate-heading : https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md # Supress warning about the same heading twice unless they are in the same block diff --git a/README.md b/README.md index 9d78a9eb..d79e3f87 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,7 @@ SPDX-License-Identifier: 2.0 license with LLVM exceptions ![CI Tests](https://github.com/bemanproject/optional/actions/workflows/ci.yml/badge.svg) [![Coverage](https://coveralls.io/repos/github/bemanproject/optional/badge.svg?branch=main)](https://coveralls.io/github/bemanproject/optional?branch=main) -This repository implements `std::optional` extensions targeting C++26. The `beman.optional` library aims to evaluate -the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21 -into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in -major standard library compilers. +This repository implements `std::optional` extensions targeting C++26. The `beman.optional` library aims to evaluate the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21 into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in major standard library compilers. **Implements**: [Give *std::optional* Range Support (P3168R2)](https://wg21.link/P3168R2) and [`std::optional` (P2988R5)](https://wg21.link/P2988R5) @@ -27,11 +24,9 @@ Documentation and associated papers are licensed with the Creative Commons Attri // SPDX-License-Identifier: CC-BY-4.0 -The intent is that the source and documentation are available for use by people implementing their own optional types -as well as people using the optional presented here as-is. +The intent is that the source and documentation are available for use by people implementing their own optional types as well as people using the optional presented here as-is. -The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see -fit. +The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see fit. // SPDX-License-Identifier: CC0-1.0 @@ -68,7 +63,7 @@ Full code can be found in [./examples/range_loop.cpp](./examples/range_loop.cpp) ### optional_ref The next code snippet shows optional reference support added in [`std::optional` -(P2988R5)](https://wg21.link/P2988R5): +(P2988)](https://wg21.link/P2988): ```cpp #include @@ -107,8 +102,7 @@ Default build: `C++23`. Please check `etc/${compiler}-flags.cmake`. ### Dependencies -This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it should be as portable as CMake is. This -project has no C or C++ dependencies. +This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it should be as portable as CMake is. This project has no C or C++ dependencies. Build-time dependencies: @@ -128,14 +122,29 @@ apt-get install \ clang-18 clang++-18 clang-17 clang++-17 ``` +
+ Build GoogleTest dependency from github.com + +If you do not have GoogleTest installed on your development system, you may +optionally configure this project to download a known-compatible release of +GoogleTest from source and build it as well. + +```shell +cmake -B build -S . -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/use-fetch-content.cmake +``` + +The precise version of GoogleTest that will be used is maintained in +`./lockfile.json`. + +
+ ### Instructions Full set of supported toolchains can be found in [.github/workflows/ci.yml](.github/workflows/ci.yml). #### Preset CMake Flows -This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will -work, producing a static `beman_optional` library, ready to package: +This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will work, producing a static `beman_optional` library, ready to package: ```shell # List available preset configurations: @@ -238,14 +247,9 @@ No tests were found!!! #### Pre-Commit for Linting -Various linting tools are configured and installed via the [pre-commit](https://pre-commit.com/) framework. This -requires a working python environment, but also allows the tools, such as clang-format and cmake-lint, to be versioned -on a per project basis rather than being installed globally. Version changes in lint checks often means differences in -success or failure between the versions in CI and the versions used by a developer. By using the same configurations, -this problem is avoided. +Various linting tools are configured and installed via the [pre-commit](https://pre-commit.com/) framework. This requires a working python environment, but also allows the tools, such as clang-format and cmake-lint, to be versioned on a per project basis rather than being installed globally. Version changes in lint checks often means differences in success or failure between the versions in CI and the versions used by a developer. By using the same configurations, this problem is avoided. -In order to set up a python environment, using a python virtual environment can simplify maintaining different -configurations between projects. There is no particular dependency on a particular python3 version. +In order to set up a python environment, using a python virtual environment can simplify maintaining different configurations between projects. There is no particular dependency on a particular python3 version. ##### Creating and configuring a venv @@ -258,8 +262,7 @@ python3 -m venv .venv . .venv/bin/activate && exec bash ``` -This will create the venv, install the python and python development tools, and run bash with the PATH and other -environment variables set to use the venv preferentially. +This will create the venv, install the python and python development tools, and run bash with the PATH and other environment variables set to use the venv preferentially. ##### Running the linting tools @@ -291,3 +294,4 @@ Latest revision(s) of the papers can be built / found at: * issue: [#1661](https://github.com/cplusplus/papers/issues/1661) * LEWG: * Reviewed in Tokyo 2024. + * Forwarded by LEWG in 2025 in Hagenberg. From a8df774a396b8dddf66c6cfacc8eb9bc86192061 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Mon, 10 Mar 2025 09:43:06 -0400 Subject: [PATCH 4/6] Make failure report a little friendlier If configuration fails by not finding GTest when testing was turned on, complete successfully and warn about the lack of GTest and provide a reference to the cmake script to download from GitHub. --- CMakeLists.txt | 20 ++++++--- cmake/use-fetch-content.cmake | 5 ++- tests/beman/optional/CMakeLists.txt | 64 ++++++++++++++--------------- 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6996a24..4351dd37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,18 +28,26 @@ target_sources( ) if(OPTIONAL_ENABLE_TESTING) + find_package(GTest QUIET) + if(GTest_FOUND) # Create the library target and named header set for testing beman_optional # and mark the set private add_executable(beman_optional_test) target_sources( - beman_optional_test - PRIVATE - FILE_SET beman_optional_test_headers - TYPE HEADERS - BASE_DIRS tests + beman_optional_test + PRIVATE + FILE_SET beman_optional_test_headers + TYPE HEADERS + BASE_DIRS tests ) - + # Tests add_subdirectory(tests/beman/optional) + else() + message(WARNING " +No provider for GTest. Unable to build tests. +Consider using CMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/use-fetch-content.cmake as documented in the README.md +") + endif() endif() add_subdirectory(include/beman/optional) diff --git a/cmake/use-fetch-content.cmake b/cmake/use-fetch-content.cmake index 098e279e..53e82fb4 100644 --- a/cmake/use-fetch-content.cmake +++ b/cmake/use-fetch-content.cmake @@ -149,7 +149,7 @@ function(BemanOptional_provideDependency method package_name) "to FetchContent logic fetching ${BemanOptional_repo} at " "${BemanOptional_tag} according to ${BemanOptional_lockfile}." ) - message(DEBUG "${BemanOptional_debug}") + message(STATUS "${BemanOptional_debug}") FetchContent_Declare( "${BemanOptional_name}" GIT_REPOSITORY "${BemanOptional_repo}" @@ -161,12 +161,13 @@ function(BemanOptional_provideDependency method package_name) # Important! _FOUND tells CMake that `find_package` is # not needed for this package anymore + message(STATUS "setting ${BemanOptional_pkgName}_FOUND to true") set("${BemanOptional_pkgName}_FOUND" TRUE PARENT_SCOPE) endif() endif() endforeach() - set(GTest_FOUND TRUE PARENT_SCOPE) + # set(GTest_FOUND TRUE PARENT_SCOPE) endfunction() cmake_language( diff --git a/tests/beman/optional/CMakeLists.txt b/tests/beman/optional/CMakeLists.txt index b2264101..d3a3913c 100644 --- a/tests/beman/optional/CMakeLists.txt +++ b/tests/beman/optional/CMakeLists.txt @@ -3,40 +3,36 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # cmake-format: on -find_package(GTest REQUIRED) - -# Tests -target_sources( - beman_optional_test - PRIVATE - optional.t.cpp - optional_constexpr.t.cpp - optional_monadic.t.cpp - optional_range_support.t.cpp - optional_ref.t.cpp - optional_ref_monadic.t.cpp -) - -target_sources( - beman_optional_test - PRIVATE - FILE_SET beman_optional_test_headers - TYPE HEADERS - FILES test_types.hpp test_utilities.hpp -) - -target_link_libraries( - beman_optional_test - PRIVATE beman_optional GTest::gtest GTest::gtest_main -) - -# Issue #32: 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. -# Change also applied for CI flows. -include(GoogleTest) -gtest_add_tests(TARGET beman_optional_test "" AUTO) + target_sources( + beman_optional_test + PRIVATE + optional.t.cpp + optional_constexpr.t.cpp + optional_monadic.t.cpp + optional_range_support.t.cpp + optional_ref.t.cpp + optional_ref_monadic.t.cpp + ) + + target_sources( + beman_optional_test + PRIVATE + FILE_SET beman_optional_test_headers + TYPE HEADERS + FILES test_types.hpp test_utilities.hpp + ) + + target_link_libraries( + beman_optional_test + PRIVATE beman_optional GTest::gtest GTest::gtest_main + ) + # Issue #32: 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. + # Change also applied for CI flows. + include(GoogleTest) + gtest_add_tests(TARGET beman_optional_test "" AUTO) add_library(constructor_fails test_constructor_fail.cpp) From 69b66811b5b2bcd5e99236c7d26744a8e1b1c791 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Wed, 12 Mar 2025 11:03:08 -0400 Subject: [PATCH 5/6] Reformat CML.txt --- CMakeLists.txt | 39 ++++++++++--------- cmake/use-fetch-content.cmake | 2 +- tests/beman/optional/CMakeLists.txt | 60 ++++++++++++++--------------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4351dd37..d07afc41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,26 +28,29 @@ target_sources( ) if(OPTIONAL_ENABLE_TESTING) - find_package(GTest QUIET) - if(GTest_FOUND) - # Create the library target and named header set for testing beman_optional - # and mark the set private - add_executable(beman_optional_test) - target_sources( - beman_optional_test - PRIVATE - FILE_SET beman_optional_test_headers - TYPE HEADERS - BASE_DIRS tests - ) - # Tests - add_subdirectory(tests/beman/optional) - else() - message(WARNING " + find_package(GTest QUIET) + if(GTest_FOUND) + # Create the library target and named header set for testing beman_optional + # and mark the set private + add_executable(beman_optional_test) + target_sources( + beman_optional_test + PRIVATE + FILE_SET beman_optional_test_headers + TYPE HEADERS + BASE_DIRS tests + ) + # Tests + add_subdirectory(tests/beman/optional) + else() + message( + WARNING + " No provider for GTest. Unable to build tests. Consider using CMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/use-fetch-content.cmake as documented in the README.md -") - endif() +" + ) + endif() endif() add_subdirectory(include/beman/optional) diff --git a/cmake/use-fetch-content.cmake b/cmake/use-fetch-content.cmake index 53e82fb4..4547fb46 100644 --- a/cmake/use-fetch-content.cmake +++ b/cmake/use-fetch-content.cmake @@ -149,7 +149,7 @@ function(BemanOptional_provideDependency method package_name) "to FetchContent logic fetching ${BemanOptional_repo} at " "${BemanOptional_tag} according to ${BemanOptional_lockfile}." ) - message(STATUS "${BemanOptional_debug}") + message(STATUS "${BemanOptional_debug}") FetchContent_Declare( "${BemanOptional_name}" GIT_REPOSITORY "${BemanOptional_repo}" diff --git a/tests/beman/optional/CMakeLists.txt b/tests/beman/optional/CMakeLists.txt index d3a3913c..470397e6 100644 --- a/tests/beman/optional/CMakeLists.txt +++ b/tests/beman/optional/CMakeLists.txt @@ -3,36 +3,36 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # cmake-format: on - target_sources( - beman_optional_test - PRIVATE - optional.t.cpp - optional_constexpr.t.cpp - optional_monadic.t.cpp - optional_range_support.t.cpp - optional_ref.t.cpp - optional_ref_monadic.t.cpp - ) - - target_sources( - beman_optional_test - PRIVATE - FILE_SET beman_optional_test_headers - TYPE HEADERS - FILES test_types.hpp test_utilities.hpp - ) - - target_link_libraries( - beman_optional_test - PRIVATE beman_optional GTest::gtest GTest::gtest_main - ) - # Issue #32: 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. - # Change also applied for CI flows. - include(GoogleTest) - gtest_add_tests(TARGET beman_optional_test "" AUTO) +target_sources( + beman_optional_test + PRIVATE + optional.t.cpp + optional_constexpr.t.cpp + optional_monadic.t.cpp + optional_range_support.t.cpp + optional_ref.t.cpp + optional_ref_monadic.t.cpp +) + +target_sources( + beman_optional_test + PRIVATE + FILE_SET beman_optional_test_headers + TYPE HEADERS + FILES test_types.hpp test_utilities.hpp +) + +target_link_libraries( + beman_optional_test + PRIVATE beman_optional GTest::gtest GTest::gtest_main +) +# Issue #32: 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. +# Change also applied for CI flows. +include(GoogleTest) +gtest_add_tests(TARGET beman_optional_test "" AUTO) add_library(constructor_fails test_constructor_fail.cpp) From 8b18f32f6d1ea79bc2688e72b68512ffcf24958d Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Wed, 12 Mar 2025 11:03:28 -0400 Subject: [PATCH 6/6] Disable line length --- .markdownlint.yaml | 3 --- .pre-commit-config.yaml | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index d8341a57..f44e4bf6 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -2,9 +2,6 @@ # Disable inline html linter is needed for
MD033: false -# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md -MD013: false - # MD024/no-duplicate-heading : https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md # Supress warning about the same heading twice unless they are in the same block MD024: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d165bfb..dda28139 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,6 +31,7 @@ repos: rev: v0.43.0 hooks: - id: markdownlint + args: ['--disable', 'MD013', ' --'] exclude: ^papers/ # Config file: .codespell_ignore