-
Notifications
You must be signed in to change notification settings - Fork 0
Baf 1716/cmake migration #23
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,17 @@ | ||
| SET(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE) | ||
| find_package(BANlohmannJson REQUIRED) | ||
| # fleet-protocol-interface's internal protobuf fetch is a no-op under our | ||
| # FindCMLIB.cmake shim (BA_PACKAGE_LIBRARY does nothing) — resolve protobuf::libprotobuf | ||
| # ourselves first so FindBAFleetProtocolInterface.cmake's link-libraries fixup has | ||
| # a real target to attach to. Same fix BAF-1706 needed in external-server-cpp. | ||
| find_package(BAProtobuf REQUIRED) | ||
| find_package(BAFleetProtocolInterface REQUIRED) | ||
| find_package(BAAeron REQUIRED) | ||
| find_package(BAAsyncFunctionExecution REQUIRED) | ||
| find_package(BAFleetProtocolCpp REQUIRED) | ||
|
|
||
| BA_PACKAGE_LIBRARY(nlohmann-json v3.12.0 NO_DEBUG ON) | ||
| BA_PACKAGE_LIBRARY(zlib v1.3.2) | ||
| BA_PACKAGE_LIBRARY(fleet-protocol-cpp v1.2.0) | ||
| BA_PACKAGE_LIBRARY(async-function-execution v1.0.0) | ||
| BA_PACKAGE_LIBRARY(aeron v1.48.6) | ||
| BA_PACKAGE_LIBRARY(fleet-protocol-interface v2.1.0 NO_DEBUG ON) | ||
|
|
||
| IF (FLEET_PROTOCOL_BUILD_EXTERNAL_SERVER) | ||
| BA_PACKAGE_LIBRARY(fleet-http-client-shared v2.0.2) | ||
| BA_PACKAGE_LIBRARY(boost v1.86.0) | ||
| BA_PACKAGE_LIBRARY(cpprestsdk v2.10.20) | ||
| ENDIF () | ||
| if (FLEET_PROTOCOL_BUILD_EXTERNAL_SERVER) | ||
| find_package(BABoost REQUIRED) | ||
| find_package(BAZlib REQUIRED) | ||
| find_package(BACppRestSdk REQUIRED) | ||
| find_package(BAFleetHttpClient REQUIRED) | ||
| endif () |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||||||||||||||||||||||
| include_guard(GLOBAL) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Provides: aeron (imported target from aeron cmake package) | ||||||||||||||||||||||||||
| # Resolution order: in-scope target → system config package → FetchContent source build. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if(TARGET aeron) | ||||||||||||||||||||||||||
| set(BAAeron_FOUND TRUE) | ||||||||||||||||||||||||||
| return() | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if(aeron_DIR MATCHES "${CMAKE_BINARY_DIR}") | ||||||||||||||||||||||||||
| unset(aeron_DIR CACHE) | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
| find_package(aeron QUIET CONFIG) | ||||||||||||||||||||||||||
| if(aeron_FOUND) | ||||||||||||||||||||||||||
| message(STATUS "[BA] aeron: found via system package") | ||||||||||||||||||||||||||
| set(BAAeron_FOUND TRUE) | ||||||||||||||||||||||||||
| return() | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| message(STATUS "[BA] aeron: system package not found, fetching via FetchContent") | ||||||||||||||||||||||||||
| include(FetchContent) | ||||||||||||||||||||||||||
| set(AERON_BUILD_SAMPLES OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| set(AERON_TESTS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| set(AERON_UNIT_TESTS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| set(AERON_SYSTEM_TESTS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| set(AERON_INSTALL_TARGETS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| # Archive API requires Java for code generation; disable it. | ||||||||||||||||||||||||||
| # Driver (C media driver) IS needed — async-function-execution links aeron::aeron_driver. | ||||||||||||||||||||||||||
| set(BUILD_AERON_ARCHIVE_API OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||
| # OVERRIDE_FIND_PACKAGE: intercepts direct find_package(aeron ...) calls in | ||||||||||||||||||||||||||
| # subdirectories so they resolve to this FetchContent copy (name matches case-insensitively). | ||||||||||||||||||||||||||
| FetchContent_Declare(aeron | ||||||||||||||||||||||||||
| GIT_REPOSITORY https://github.com/aeron-io/aeron.git | ||||||||||||||||||||||||||
| GIT_TAG 1.48.6 | ||||||||||||||||||||||||||
| GIT_SHALLOW TRUE | ||||||||||||||||||||||||||
| OVERRIDE_FIND_PACKAGE) | ||||||||||||||||||||||||||
| FetchContent_MakeAvailable(aeron) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # async-function-execution includes <aeronmd/aeron_driver.h> which expects the installed | ||||||||||||||||||||||||||
| # header layout (install(DIRECTORY ./ DESTINATION include/aeronmd ...)). | ||||||||||||||||||||||||||
| # In a FetchContent build, headers live in aeron-driver/src/main/c/ with no aeronmd/ | ||||||||||||||||||||||||||
| # subdirectory. Create a shim include dir containing an aeronmd/ symlink so the header | ||||||||||||||||||||||||||
| # resolves without running cmake --install. | ||||||||||||||||||||||||||
| set(_aeron_driver_c "${aeron_SOURCE_DIR}/aeron-driver/src/main/c") | ||||||||||||||||||||||||||
| set(_aeron_inc_shim "${aeron_BINARY_DIR}/include-shim") | ||||||||||||||||||||||||||
| file(MAKE_DIRECTORY "${_aeron_inc_shim}") | ||||||||||||||||||||||||||
| if(NOT EXISTS "${_aeron_inc_shim}/aeronmd") | ||||||||||||||||||||||||||
| file(CREATE_LINK "${_aeron_driver_c}" "${_aeron_inc_shim}/aeronmd" SYMBOLIC) | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
| target_include_directories(aeron_driver PUBLIC | ||||||||||||||||||||||||||
| "$<BUILD_INTERFACE:${_aeron_inc_shim}>") | ||||||||||||||||||||||||||
| target_include_directories(aeron_driver_static PUBLIC | ||||||||||||||||||||||||||
| "$<BUILD_INTERFACE:${_aeron_inc_shim}>") | ||||||||||||||||||||||||||
|
Comment on lines
+51
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Missing Unlike the install loop below (lines 59-66) which checks 🛡️ Proposed fix-target_include_directories(aeron_driver PUBLIC
- "$<BUILD_INTERFACE:${_aeron_inc_shim}>")
-target_include_directories(aeron_driver_static PUBLIC
- "$<BUILD_INTERFACE:${_aeron_inc_shim}>")
+if(TARGET aeron_driver)
+ target_include_directories(aeron_driver PUBLIC
+ "$<BUILD_INTERFACE:${_aeron_inc_shim}>")
+endif()
+if(TARGET aeron_driver_static)
+ target_include_directories(aeron_driver_static PUBLIC
+ "$<BUILD_INTERFACE:${_aeron_inc_shim}>")
+endif()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Install shared aeron libraries so the external-server-cpp binary can find them | ||||||||||||||||||||||||||
| # at runtime via its RPATH ($ORIGIN/../lib). AERON_INSTALL_TARGETS=OFF skips | ||||||||||||||||||||||||||
| # aeron's own install targets, so we register them explicitly here. | ||||||||||||||||||||||||||
| foreach(_aeron_tgt aeron aeron_client_shared aeron_driver) | ||||||||||||||||||||||||||
| if(TARGET ${_aeron_tgt}) | ||||||||||||||||||||||||||
| get_target_property(_aeron_ttype ${_aeron_tgt} TYPE) | ||||||||||||||||||||||||||
| if(_aeron_ttype STREQUAL "SHARED_LIBRARY") | ||||||||||||||||||||||||||
| install(TARGETS ${_aeron_tgt} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||
| endforeach() | ||||||||||||||||||||||||||
| unset(_aeron_tgt) | ||||||||||||||||||||||||||
| unset(_aeron_ttype) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| set(BAAeron_FOUND TRUE) | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| # Provides: async-function-execution-shared::async-function-execution-shared | ||
| # Resolution order: in-scope target → system config package → FetchContent source build. | ||
| # Note: async-function-execution uses cmlib internally; FindCMLIB.cmake shim handles it. | ||
|
|
||
| if(TARGET async-function-execution-shared::async-function-execution-shared) | ||
| set(BAAsyncFunctionExecution_FOUND TRUE) | ||
| return() | ||
| endif() | ||
|
|
||
| if(async-function-execution-shared_DIR MATCHES "${CMAKE_BINARY_DIR}") | ||
| unset(async-function-execution-shared_DIR CACHE) | ||
| endif() | ||
| find_package(async-function-execution-shared QUIET CONFIG) | ||
| if(async-function-execution-shared_FOUND) | ||
| message(STATUS "[BA] async-function-execution: found via config package") | ||
| set(BAAsyncFunctionExecution_FOUND TRUE) | ||
| return() | ||
| endif() | ||
|
|
||
| message(STATUS "[BA] async-function-execution: not found locally, fetching via FetchContent") | ||
| include(FetchContent) | ||
| set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) | ||
| if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../async-function-execution/CMakeLists.txt") | ||
| set(FETCHCONTENT_SOURCE_DIR_ASYNC_FUNCTION_EXECUTION | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/../async-function-execution" CACHE PATH "" FORCE) | ||
| endif() | ||
| FetchContent_Declare(async_function_execution | ||
| GIT_REPOSITORY https://github.com/bringauto/async-function-execution.git | ||
| GIT_TAG v1.0.0 | ||
| GIT_SHALLOW TRUE) | ||
| FetchContent_MakeAvailable(async_function_execution) | ||
| # CMDEF_ADD_LIBRARY creates async-function-execution-shared; create the namespaced alias. | ||
| if(TARGET async-function-execution-shared | ||
| AND NOT TARGET async-function-execution-shared::async-function-execution-shared) | ||
| add_library(async-function-execution-shared::async-function-execution-shared | ||
| ALIAS async-function-execution-shared) | ||
| endif() | ||
|
|
||
| # Install the shared library so the binary can find it via RPATH at runtime. | ||
| # CMDEF_INSTALL() is a no-op in our shim, so we register the install rule here. | ||
| if(TARGET async-function-execution-shared) | ||
| get_target_property(_afe_ttype async-function-execution-shared TYPE) | ||
| if(_afe_ttype STREQUAL "SHARED_LIBRARY") | ||
| install(TARGETS async-function-execution-shared | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
| endif() | ||
| unset(_afe_ttype) | ||
|
Comment on lines
+24
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Avoid forcing
🤖 Prompt for AI Agents |
||
| endif() | ||
|
|
||
| set(BAAsyncFunctionExecution_FOUND TRUE) | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| # CMake 4.x removed FindBoost.cmake (CMP0167) — always use CONFIG mode. | ||||||||||||||||||||||||||||||||||||||||||||
| if(POLICY CMP0167) | ||||||||||||||||||||||||||||||||||||||||||||
| cmake_policy(SET CMP0167 NEW) | ||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Provides: Boost::<component> targets matching requested components. | ||||||||||||||||||||||||||||||||||||||||||||
| # No include_guard — callers may request different components. | ||||||||||||||||||||||||||||||||||||||||||||
| find_package(Boost 1.86 CONFIG QUIET COMPONENTS ${BABoost_FIND_COMPONENTS}) | ||||||||||||||||||||||||||||||||||||||||||||
| if(Boost_FOUND) | ||||||||||||||||||||||||||||||||||||||||||||
| set(BABoost_FOUND TRUE) | ||||||||||||||||||||||||||||||||||||||||||||
| return() | ||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win System-Boost check doesn't validate required components.
🐛 Proposed fix: require the same component set used for the fallback build+set(_BABoost_REQUIRED_COMPONENTS
+ regex date_time atomic random chrono system filesystem thread asio uuid)
find_package(Boost 1.86 CONFIG QUIET COMPONENTS ${BABoost_FIND_COMPONENTS})
+find_package(Boost 1.86 CONFIG QUIET COMPONENTS ${_BABoost_REQUIRED_COMPONENTS})
if(Boost_FOUND)
set(BABoost_FOUND TRUE)
return()
endif()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| message(STATUS "[BA] Boost 1.86 config package not found, fetching via FetchContent") | ||||||||||||||||||||||||||||||||||||||||||||
| include(FetchContent) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # BOOST_INCLUDE_LIBRARIES controls which Boost libraries are built. | ||||||||||||||||||||||||||||||||||||||||||||
| # List all components used by the external-server variant's HTTP client stack | ||||||||||||||||||||||||||||||||||||||||||||
| # (fleet-http-client-shared -> cpprestsdk) here so that the first | ||||||||||||||||||||||||||||||||||||||||||||
| # FetchContent_MakeAvailable call (whichever component triggers it) builds all | ||||||||||||||||||||||||||||||||||||||||||||
| # of them — subsequent calls are no-ops and cannot extend the component list. | ||||||||||||||||||||||||||||||||||||||||||||
| # OVERRIDE_FIND_PACKAGE (CMake 3.24+) makes the direct FIND_PACKAGE(Boost CONFIG ...) | ||||||||||||||||||||||||||||||||||||||||||||
| # call in CMakeLists.txt resolve to this FetchContent version automatically. | ||||||||||||||||||||||||||||||||||||||||||||
| set(BOOST_INCLUDE_LIBRARIES | ||||||||||||||||||||||||||||||||||||||||||||
| regex date_time atomic random chrono system filesystem thread asio uuid) | ||||||||||||||||||||||||||||||||||||||||||||
| set(BOOST_ENABLE_PYTHON OFF) | ||||||||||||||||||||||||||||||||||||||||||||
| set(BOOST_ENABLE_MPI OFF) | ||||||||||||||||||||||||||||||||||||||||||||
| set(BUILD_SHARED_LIBS OFF) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| FetchContent_Declare(Boost | ||||||||||||||||||||||||||||||||||||||||||||
| URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.gz | ||||||||||||||||||||||||||||||||||||||||||||
| DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||||||||||||||||||||||||||||||||||||||||||||
| OVERRIDE_FIND_PACKAGE) | ||||||||||||||||||||||||||||||||||||||||||||
| FetchContent_MakeAvailable(Boost) | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+26
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Unscoped
♻️ Proposed fix: save/restore the previous value+set(_BABoost_prev_build_shared_libs ${BUILD_SHARED_LIBS})
set(BOOST_INCLUDE_LIBRARIES
regex date_time atomic random chrono system filesystem thread asio uuid)
set(BOOST_ENABLE_PYTHON OFF)
set(BOOST_ENABLE_MPI OFF)
set(BUILD_SHARED_LIBS OFF)
FetchContent_Declare(Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
OVERRIDE_FIND_PACKAGE)
FetchContent_MakeAvailable(Boost)
+set(BUILD_SHARED_LIBS ${_BABoost_prev_build_shared_libs})
+unset(_BABoost_prev_build_shared_libs)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Boost's cmake config does NOT set Boost_LIBRARIES or Boost_INCLUDE_DIR — | ||||||||||||||||||||||||||||||||||||||||||||
| # those are FindBoost.cmake (module-mode) variables. The modules' CMakeLists.txt | ||||||||||||||||||||||||||||||||||||||||||||
| # explicitly link against Boost::<component> targets, but set these too in case | ||||||||||||||||||||||||||||||||||||||||||||
| # any consumer still expects the module-mode variables. | ||||||||||||||||||||||||||||||||||||||||||||
| set(Boost_LIBRARIES | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::regex | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::date_time | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::atomic | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::random | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::chrono | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::system | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::filesystem | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::thread | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::asio | ||||||||||||||||||||||||||||||||||||||||||||
| Boost::uuid) | ||||||||||||||||||||||||||||||||||||||||||||
| set(Boost_INCLUDE_DIR "") | ||||||||||||||||||||||||||||||||||||||||||||
| set(BABoost_FOUND TRUE) | ||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||||||
| include_guard(GLOBAL) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Provides: cpprestsdk::cpprest | ||||||||||||||||||||||||||||||
| # Resolution order: in-scope target → system config package → FetchContent source build. | ||||||||||||||||||||||||||||||
| # Uses the BringAuto fork (github.com/bringauto/cpprestsdk) — vanilla cpprestsdk only | ||||||||||||||||||||||||||||||
| # goes up to v2.10.19, so the v2.10.20 tag pinned by the old cmlib Dependencies.cmake | ||||||||||||||||||||||||||||||
| # confirms this is the fork, not upstream Microsoft/cpprestsdk. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if(TARGET cpprestsdk::cpprest) | ||||||||||||||||||||||||||||||
| set(BACppRestSdk_FOUND TRUE) | ||||||||||||||||||||||||||||||
| return() | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if(cpprestsdk_DIR MATCHES "${CMAKE_BINARY_DIR}") | ||||||||||||||||||||||||||||||
| unset(cpprestsdk_DIR CACHE) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| find_package(cpprestsdk QUIET CONFIG) | ||||||||||||||||||||||||||||||
| if(cpprestsdk_FOUND) | ||||||||||||||||||||||||||||||
| message(STATUS "[BA] cpprestsdk: found via system package") | ||||||||||||||||||||||||||||||
| set(BACppRestSdk_FOUND TRUE) | ||||||||||||||||||||||||||||||
| return() | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| message(STATUS "[BA] cpprestsdk: not found locally, fetching via FetchContent") | ||||||||||||||||||||||||||||||
| include(FetchContent) | ||||||||||||||||||||||||||||||
| set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||||||
| # The bundled websocketpp fails to compile against GCC 13's stricter parsing of | ||||||||||||||||||||||||||||||
| # template-id destructors; the module only needs plain HTTP polling, not websockets. | ||||||||||||||||||||||||||||||
| set(CPPREST_EXCLUDE_WEBSOCKETS ON CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||||||
| set(WERROR OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||||||
| set(BUILD_SAMPLES OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||||||
| set(BUILD_TESTS OFF CACHE BOOL "" FORCE) | ||||||||||||||||||||||||||||||
|
Comment on lines
+26
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
These five variables are force-written to the cache, which (a) permanently overrides any value the consuming project or its user explicitly set (e.g. ♻️ Proposed fix: drop FORCE so pre-existing user values win-set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
-set(CPPREST_EXCLUDE_WEBSOCKETS ON CACHE BOOL "" FORCE)
-set(WERROR OFF CACHE BOOL "" FORCE)
-set(BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
-set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
+set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
+set(CPPREST_EXCLUDE_WEBSOCKETS ON CACHE BOOL "")
+set(WERROR OFF CACHE BOOL "")
+set(BUILD_SAMPLES OFF CACHE BOOL "")
+set(BUILD_TESTS OFF CACHE BOOL "")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| # OVERRIDE_FIND_PACKAGE: FetchContent_Declare's name matches the plain | ||||||||||||||||||||||||||||||
| # FIND_PACKAGE(cpprestsdk ...) call in CMakeLists.txt, so it intercepts it directly. | ||||||||||||||||||||||||||||||
| FetchContent_Declare(cpprestsdk | ||||||||||||||||||||||||||||||
| GIT_REPOSITORY https://github.com/bringauto/cpprestsdk.git | ||||||||||||||||||||||||||||||
| GIT_TAG v2.10.20 | ||||||||||||||||||||||||||||||
| GIT_SHALLOW TRUE | ||||||||||||||||||||||||||||||
| OVERRIDE_FIND_PACKAGE) | ||||||||||||||||||||||||||||||
| FetchContent_MakeAvailable(cpprestsdk) | ||||||||||||||||||||||||||||||
| # cpprestsdk's build tree only defines the raw "cpprest" target — the | ||||||||||||||||||||||||||||||
| # namespaced "cpprestsdk::cpprest" alias normally comes from its install-export, | ||||||||||||||||||||||||||||||
| # which FetchContent bypasses. Create it manually. | ||||||||||||||||||||||||||||||
| if(TARGET cpprest AND NOT TARGET cpprestsdk::cpprest) | ||||||||||||||||||||||||||||||
| add_library(cpprestsdk::cpprest ALIAS cpprest) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| set(BACppRestSdk_FOUND TRUE) | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| # Provides: fleet-http-client-shared::fleet-http-client-shared | ||
| # Resolution order: in-scope target → system config package → FetchContent source build. | ||
| # Repo is named "fleet-http-client" but (like the other BringAuto cmlib packages) | ||
| # exports a CMake target "fleet-http-client-shared" via CMDEF_ADD_LIBRARY | ||
| # (LIBRARY_GROUP "fleet-http-client" + TYPE SHARED). It uses cmlib internally, | ||
| # so FindCMLIB.cmake must be on CMAKE_MODULE_PATH before this fetch, and it needs | ||
| # cpprestsdk/Boost/ZLIB findable already — declare those first in Dependencies.cmake. | ||
|
|
||
| if(TARGET fleet-http-client-shared::fleet-http-client-shared) | ||
| set(BAFleetHttpClient_FOUND TRUE) | ||
| return() | ||
| endif() | ||
|
|
||
| if(fleet-http-client-shared_DIR MATCHES "${CMAKE_BINARY_DIR}") | ||
| unset(fleet-http-client-shared_DIR CACHE) | ||
| endif() | ||
| find_package(fleet-http-client-shared QUIET CONFIG) | ||
| if(fleet-http-client-shared_FOUND) | ||
| message(STATUS "[BA] fleet-http-client: found via config package") | ||
| set(BAFleetHttpClient_FOUND TRUE) | ||
| return() | ||
| endif() | ||
|
|
||
| message(STATUS "[BA] fleet-http-client: not found locally, fetching via FetchContent") | ||
| include(FetchContent) | ||
| if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../fleet-http-client/CMakeLists.txt") | ||
| set(FETCHCONTENT_SOURCE_DIR_FLEET_HTTP_CLIENT_SHARED | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/../fleet-http-client" CACHE PATH "" FORCE) | ||
| endif() | ||
| FetchContent_Declare(fleet_http_client_shared | ||
| GIT_REPOSITORY https://github.com/bringauto/fleet-http-client.git | ||
| GIT_TAG v2.0.2 | ||
| GIT_SHALLOW TRUE) | ||
| FetchContent_MakeAvailable(fleet_http_client_shared) | ||
| # CMDEF_ADD_LIBRARY creates the unnamespaced fleet-http-client-shared target. | ||
| # The module's own CMakeLists.txt later calls TARGET_LINK_LIBRARIES a second | ||
| # time on the *namespaced* target to bolt on Boost/ZLIB (its "obsolete | ||
| # cpprestsdk cmake export package" workaround) — an ALIAS can't receive that | ||
| # (CMake forbids target_link_libraries on ALIAS targets), so forward via an | ||
| # IMPORTED INTERFACE library instead, which can. | ||
| if(TARGET fleet-http-client-shared | ||
| AND NOT TARGET fleet-http-client-shared::fleet-http-client-shared) | ||
| add_library(fleet-http-client-shared::fleet-http-client-shared INTERFACE IMPORTED) | ||
| target_link_libraries(fleet-http-client-shared::fleet-http-client-shared | ||
| INTERFACE fleet-http-client-shared) | ||
| endif() | ||
|
|
||
| # Install the shared library so consumers can find it via RPATH at runtime. | ||
| # CMDEF_INSTALL() is a no-op in our shim, so register the install rule here. | ||
| if(TARGET fleet-http-client-shared) | ||
| get_target_property(_fhc_ttype fleet-http-client-shared TYPE) | ||
| if(_fhc_ttype STREQUAL "SHARED_LIBRARY") | ||
| install(TARGETS fleet-http-client-shared | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
| endif() | ||
| unset(_fhc_ttype) | ||
| endif() | ||
|
|
||
| set(BAFleetHttpClient_FOUND TRUE) |
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: bringauto/io-module
Length of output: 201
🏁 Script executed:
Repository: bringauto/io-module
Length of output: 4507
Remove the global include guard here
include_guard(GLOBAL)can break repeatedfind_package(BAAeron)calls from a different directory scope that doesn’t already inheritBAAeron_FOUND. Theif(TARGET aeron)fast path already makes this file idempotent, so the guard is unnecessary and risky.🤖 Prompt for AI Agents