-
Notifications
You must be signed in to change notification settings - Fork 4
feat: fetch tobieaslocker lib as external lib #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a444d26
634d371
87fa1a8
ca5777c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| 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) | ||||||||||||||||||||||||||||
|
|
@@ -77,6 +76,7 @@ else() | |||||||||||||||||||||||||||
| find_package(cucumber_messages REQUIRED) | ||||||||||||||||||||||||||||
| find_package(cucumber_gherkin REQUIRED) | ||||||||||||||||||||||||||||
| find_package(fmt REQUIRED) | ||||||||||||||||||||||||||||
| find_package(base64 REQUIRED) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| # 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() |
| 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) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| # 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() |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CCR_DEFAULTOPTis only set when this repository is the top-level project; when used as a subproject it expands to an empty string in the subsequentoption(...)calls. While CMake treats that asOFF, it’s implicit and makes the defaulting behavior harder to reason about. Consider explicitly settingCCR_DEFAULTOPT Offin the non-standalone case to keep option defaults unambiguous and consistent.