Skip to content

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

@imphil

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.

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