From 9283ac390bee354ad164ac3a00c6e76b6624fcb5 Mon Sep 17 00:00:00 2001 From: "Georgi (Joro) Kodinov" Date: Fri, 15 May 2026 15:57:02 +0300 Subject: [PATCH] Make cppast compile with modern toolset Fixed the following: - updated the cmake_minimum_required() target version to 4.0 : 3.x deprecated - Upgraded external repos to use the latest from the 3d party libraries - Upgraded Catch2 tests to use the newer test infra - Removed obsolete [!hide] from the test descriptions - fixed a warning in "" operator overload. --- CMakeLists.txt | 2 +- external/external.cmake | 2 +- external/tpl/CMakeLists.txt | 2 +- include/cppast/cpp_entity_index.hpp | 2 +- test/CMakeLists.txt | 6 +++--- test/cpp_friend.cpp | 2 +- test/cpp_preprocessor.cpp | 6 +++++- test/cpp_token.cpp | 2 +- test/integration.cpp | 4 ++-- test/libclang_parser.cpp | 2 +- test/parser.cpp | 2 +- test/preprocessor.cpp | 4 ++-- test/test.cpp | 5 ----- test/test_parser.hpp | 2 +- 14 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 test/test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 80d0aca9..38c35b3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT # found in the top-level directory of this distribution. -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 4.0) project(cppast VERSION 0.1.0) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) diff --git a/external/external.cmake b/external/external.cmake index 556d847c..9828776f 100644 --- a/external/external.cmake +++ b/external/external.cmake @@ -31,7 +31,7 @@ if(build_tool) set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "") message(STATUS "Fetching cxxopts") - FetchContent_Declare(cxxopts URL https://github.com/jarro2783/cxxopts/archive/v2.2.1.zip) + FetchContent_Declare(cxxopts GIT_REPOSITORY https://github.com/jarro2783/cxxopts GIT_TAG origin/master) FetchContent_MakeAvailable(cxxopts) endif() diff --git a/external/tpl/CMakeLists.txt b/external/tpl/CMakeLists.txt index 8662ba3a..4f31d3e2 100644 --- a/external/tpl/CMakeLists.txt +++ b/external/tpl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 4.0) project(tiny-process-library) diff --git a/include/cppast/cpp_entity_index.hpp b/include/cppast/cpp_entity_index.hpp index 72c688d8..9215e43d 100644 --- a/include/cppast/cpp_entity_index.hpp +++ b/include/cppast/cpp_entity_index.hpp @@ -46,7 +46,7 @@ struct cpp_entity_id : type_safe::strong_typedef= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); +} + TEST_CASE("cpp_include_directive") { write_file("cpp_include_directive-header.hpp", R"( @@ -149,7 +153,7 @@ b REQUIRE(include.target().name() == include.name()); REQUIRE(include.include_kind() == cppast::cpp_include_kind::system); REQUIRE(include.target().get(idx).empty()); - REQUIRE_THAT(include.full_path(), Catch::EndsWith("iostream")); + REQUIRE(endsWith(include.full_path(), std::string("iostream"))); } else if (include.name() == "cpp_include_directive-header.hpp") { diff --git a/test/cpp_token.cpp b/test/cpp_token.cpp index 5be6450a..879d0a15 100644 --- a/test/cpp_token.cpp +++ b/test/cpp_token.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include diff --git a/test/integration.cpp b/test/integration.cpp index d0418317..589a3333 100644 --- a/test/integration.cpp +++ b/test/integration.cpp @@ -7,7 +7,7 @@ using namespace cppast; -TEST_CASE("stdlib", "[!hide][integration]") +TEST_CASE("stdlib", "[.][integration]") { auto code = R"( // list of headers from: http://en.cppreference.com/w/cpp/header @@ -113,7 +113,7 @@ TEST_CASE("stdlib", "[!hide][integration]") REQUIRE(!parser.error()); } -TEST_CASE("cppast", "[!hide][integration]") +TEST_CASE("cppast", "[integration]") { const char* files[] = { #include diff --git a/test/libclang_parser.cpp b/test/libclang_parser.cpp index 99e7232a..5793a5cf 100644 --- a/test/libclang_parser.cpp +++ b/test/libclang_parser.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2017-2023 Jonathan Müller and cppast contributors // SPDX-License-Identifier: MIT -#include +#include #include diff --git a/test/parser.cpp b/test/parser.cpp index 2b94bee7..5932e126 100644 --- a/test/parser.cpp +++ b/test/parser.cpp @@ -3,7 +3,7 @@ #include -#include +#include using namespace cppast; diff --git a/test/preprocessor.cpp b/test/preprocessor.cpp index df9a039a..93294e58 100644 --- a/test/preprocessor.cpp +++ b/test/preprocessor.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "libclang/preprocessor.hpp" @@ -8,7 +8,7 @@ using namespace cppast; -TEST_CASE("preprocessor escaped character", "[!hide][clang4]") +TEST_CASE("preprocessor escaped character", "[.][clang4]") { write_file("ppec.hpp", R"( )"); diff --git a/test/test.cpp b/test/test.cpp deleted file mode 100644 index 793a501d..00000000 --- a/test/test.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (C) 2017-2023 Jonathan Müller and cppast contributors -// SPDX-License-Identifier: MIT - -#define CATCH_CONFIG_MAIN -#include diff --git a/test/test_parser.hpp b/test/test_parser.hpp index d5b1d22a..3d36a328 100644 --- a/test/test_parser.hpp +++ b/test/test_parser.hpp @@ -6,7 +6,7 @@ #include -#include +#include #include #include