Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ project(cucumber-cpp-runner LANGUAGES C CXX VERSION 4.0.1) # x-release-please-ve
include(ccr_test_helpers)

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CCR_STANDALONE On)
set(CCR_DEFAULTOPT On)
endif()

option(CCR_STANDALONE "Build cucumber-cpp-runner as a standalone project" ${CCR_DEFAULTOPT})
option(CCR_FETCH_DEPS "Fetch dependencies via FetchContent." ${CCR_DEFAULTOPT} )
option(CCR_BUILD_TESTS "Enable build of the tests" ${CCR_DEFAULTOPT})
option(CCR_ENABLE_COVERAGE "Enable compiler flags for code coverage measurements" Off)
option(CCR_ENABLE_TIME_PROFILE "Enable compiler flags for time profiling measurements" Off)
Comment on lines 8 to +16
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CCR_DEFAULTOPT is only set when this repository is the top-level project; when used as a subproject it expands to an empty string in the subsequent option(...) calls. While CMake treats that as OFF, it’s implicit and makes the defaulting behavior harder to reason about. Consider explicitly setting CCR_DEFAULTOPT Off in the non-standalone case to keep option defaults unambiguous and consistent.

Copilot uses AI. Check for mistakes.

if (CCR_STANDALONE)
set(CCR_DEFAULTOPT On)
set(CCR_EXCLUDE_FROM_ALL "")
set(CMAKE_COMPILE_WARNING_AS_ERROR On)
else()
set(CCR_DEFAULTOPT Off)
set(CCR_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()

option(CCR_FETCH_DEPS "Fetch dependencies via FetchContent." ${CCR_DEFAULTOPT} )
option(CCR_BUILD_TESTS "Enable build of the tests" ${CCR_DEFAULTOPT})
option(CCR_ENABLE_COVERAGE "Enable compiler flags for code coverage measurements" Off)
option(CCR_ENABLE_TIME_PROFILE "Enable compiler flags for time profiling measurements" Off)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (CCR_STANDALONE AND NOT CCR_ENABLE_COVERAGE)
Expand Down Expand Up @@ -77,6 +76,7 @@ else()
find_package(cucumber_messages REQUIRED)
find_package(cucumber_gherkin REQUIRED)
find_package(fmt REQUIRED)
find_package(base64 REQUIRED)

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_package(base64 REQUIRED) relies on the external Base64 package to provide a CMake package config and (given current target_link_libraries(... base64 ...) usage) a target that is compatible with the un-namespaced base64 target name used throughout the repo. To avoid fragile builds across different package exports, add a post-find_package check that maps the package's exported target(s) to the expected base64 target name (e.g., create an ALIAS/INTERFACE wrapper when only base64::base64 exists).

Suggested change
# Normalize base64 target name to un-namespaced 'base64' used in this project
if (NOT TARGET base64)
if (TARGET base64::base64)
add_library(base64 INTERFACE IMPORTED)
target_link_libraries(base64 INTERFACE base64::base64)
else()
message(FATAL_ERROR
"The 'base64' package was found, but it does not provide a compatible "
"CMake target named 'base64' or 'base64::base64'.")
endif()
endif()

Copilot uses AI. Check for mistakes.
if (CCR_BUILD_TESTS)
find_package(yaml-cpp REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions cucumber_cpp/library/Parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// IWYU pragma: friend cucumber_cpp/.*

#include "cucumber_cpp/library/cucumber_expression/ParameterRegistry.hpp"
#include "cucumber_cpp/library/support/DefinitionRegistration.hpp"
#include <cstddef>
#include <optional>
#include <string>
Expand Down
11 changes: 8 additions & 3 deletions external/tobiaslocker/base64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# https://github.com/tobiaslocker/base64/tree/8d96a2a737ac1396304b1de289beb3a5ea0cb752
FetchContent_Declare(
tobiaslocker_base64
GIT_REPOSITORY https://github.com/tobiaslocker/base64.git
GIT_TAG 8d96a2a737ac1396304b1de289beb3a5ea0cb752
)

set(BASE64_ENABLE_TESTING OFF CACHE BOOL "Disable base64 unit tests" FORCE)
FetchContent_MakeAvailable(tobiaslocker_base64)

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FetchContent_MakeAvailable(tobiaslocker_base64) does not guarantee that an un-namespaced target called base64 exists. The rest of the project links against base64 (e.g., cucumber_cpp/library/engine/CMakeLists.txt), so if the fetched project exports only a namespaced target (like base64::base64) configuration/linking will fail. Consider adding a small compatibility shim here that creates an alias/INTERFACE target named base64 when only a namespaced target is provided (and/or vice versa), so both fetch and non-fetch dependency modes work consistently.

Suggested change
# Compatibility shim: ensure both `base64` and `base64::base64` targets exist.
# Some parts of the project link against `base64`, while the fetched project
# may only export a namespaced target (e.g. `base64::base64`), or vice versa.
if (TARGET base64::base64 AND NOT TARGET base64)
add_library(base64 INTERFACE)
target_link_libraries(base64 INTERFACE base64::base64)
elseif (TARGET base64 AND NOT TARGET base64::base64)
add_library(base64::base64 INTERFACE)
target_link_libraries(base64::base64 INTERFACE base64)
endif()

Copilot uses AI. Check for mistakes.
add_library(base64 INTERFACE)
target_include_directories(base64 INTERFACE include)
21 changes: 0 additions & 21 deletions external/tobiaslocker/base64/LICENSE

This file was deleted.

48 changes: 0 additions & 48 deletions external/tobiaslocker/base64/README.md

This file was deleted.

Loading
Loading