Files
MicrOBU/obu-firmware/external/vanetza-idf/cmake/UseVanetza.cmake
T
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +02:00

57 lines
1.9 KiB
CMake

#
# vanetza_optional_dependency(<package> [<version>] <option> <description>)
#
# Probe for <package> quietly, create a CMake option defaulting to whether it
# was found, and require it if the option is enabled.
#
macro(vanetza_optional_dependency package)
if(${ARGC} EQUAL 4)
set(_vanetza_dep_version ${ARGV1})
set(_vanetza_dep_option ${ARGV2})
set(_vanetza_dep_description "${ARGV3}")
else()
set(_vanetza_dep_version)
set(_vanetza_dep_option ${ARGV1})
set(_vanetza_dep_description "${ARGV2}")
endif()
find_package(${package} ${_vanetza_dep_version} QUIET)
option(${_vanetza_dep_option} "${_vanetza_dep_description}" ${${package}_FOUND})
if(${_vanetza_dep_option})
find_package(${package} ${_vanetza_dep_version} REQUIRED)
endif()
unset(_vanetza_dep_version)
unset(_vanetza_dep_option)
unset(_vanetza_dep_description)
endmacro()
#
# add_vanetza_component(<name> <sources...>)
#
function(add_vanetza_component name)
set(sources ${ARGN})
add_library(${name} ${sources})
add_library(Vanetza::${name} ALIAS ${name})
target_include_directories(${name} PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
set_target_properties(${name} PROPERTIES
OUTPUT_NAME vanetza_${name}
SOVERSION ${VANETZA_SOVERSION}
INSTALL_RPATH $ORIGIN)
target_compile_features(${name} PUBLIC cxx_std_14)
install(TARGETS ${name} EXPORT ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
set_property(GLOBAL APPEND PROPERTY VANETZA_COMPONENTS ${name})
endfunction()
#
# add_test_subdirectory(<directory>)
#
# Add subdirectory only when tests are enabled via BUILD_TESTS
#
function(add_test_subdirectory directory)
if(BUILD_TESTS)
add_subdirectory(${directory})
endif()
endfunction(add_test_subdirectory)