Skip to content

Catch2 build in v3.13.0 fails if CATCH_CONFIG_PREFIX_ALL is set #3087

Closed

Description

@imphil

Since Catch2 v3.13.0, building Catch2 itself fails if CATCH_CONFIG_PREFIX_ALL is set:

Building CXX object Catch2/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o
FAILED: Catch2/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o 
/usr/bin/ccache /bin/g++ -DCATCH_CONFIG_PREFIX_ALL -I/Catch2/src/catch2/.. -I/CMakeFiles/Catch2/generated-includes -std=gnu++17 -fmessage-length=0 -fPIC -m64 -D__64BIT__ -O2 -ffile-prefix-map=/Catch2/= -MD -MT Catch2/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o -MF Catch2/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o.d -o Catch2/src/CMakeFiles/Catch2.dir/catch2/internal/catch_run_context.cpp.o -c /Catch2/src/catch2/internal/catch_run_context.cpp
/src/catch2/internal/catch_run_context.cpp: In constructor ‘Catch::Generators::{anonymous}::GeneratorTracker::GeneratorTracker(Catch::TestCaseTracking::NameAndLocation&&, Catch::TestCaseTracking::TrackerContext&, Catch::TestCaseTracking::ITracker*, Catch::Generators::GeneratorBasePtr&&)’:
/src/catch2/internal/catch_run_context.cpp:65:29: error: ‘SKIP’ was not declared in this scope
                             SKIP();
                             ^~~~
/src/catch2/internal/catch_run_context.cpp: In member function ‘virtual Catch::IGeneratorTracker* Catch::RunContext::createGeneratorTracker(Catch::StringRef, Catch::SourceLineInfo, Catch::Generators::GeneratorBasePtr&&)’:
/src/catch2/internal/catch_run_context.cpp:523:13: error: ‘FAIL’ was not declared in this scope
             FAIL( "GENERATE() would run infinitely" );
             ^~~~
/src/catch2/internal/catch_run_context.cpp:523:13: note: suggested alternative: ‘FILE’
             FAIL( "GENERATE() would run infinitely" );
             ^~~~
             FILE

This change in behavior was introduced recently:

In our cmake setup, we had CATCH_CONFIG_PREFIX_ALL set before including Catch2 and that always worked -- now it doesn't. Unfortunately, there's (as far as I can tell) no version of the FAIL and SKIP macros that's always available, no matter what prefixing option the user chose.

I'm happy to prepare a PR, but I'd like to know from the maintainers:

  • Do you prefer to inline the functionality of FAIL and SKIP into catch_run_context.cpp (the comments above it seem to indicate that was thought of)?
  • Do you want to explicitly spell out that defines CATCH_CONFIG_PREFIX_ALL and friends need to be set after Catch2 is built.

Activity

  1. horenmar commented on Apr 1, 2026

    @horenmar
    Member

    Do you want to explicitly spell out that defines CATCH_CONFIG_PREFIX_ALL and friends need to be set after Catch2 is built.

    No, it should be fine to have it always enabled.

    Do you prefer to inline the functionality of FAIL and SKIP into catch_run_context.cpp (the comments above it seem to indicate that was thought of)?

    My original reason to go through the macros was to avoid problems if the macro definitions later change. However, this shouldn't happen too often and I think it will still end up cleaner than using preprocessor check for CATCH_CONFIG_PREFIX_ALL and picking which of the two variants to use.

  2. added a commit that references this issue on Apr 2, 2026
    268a619
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions