Skip to content

Commit e8f89ee

Browse files
committed
cmake: require version variable for external deps
1 parent d680f72 commit e8f89ee

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ sbom_generate(
285285
DOWNLOAD_URL "https://github.com/srsran/srsRAN_Project.git"
286286
LICENSE "LicenseRef-srsRAN"
287287
)
288-
parse_copyright_file("${CMAKE_SOURCE_DIR}/COPYRIGHT")
289288

290289
########################################################################
291290
# Find dependencies
@@ -645,6 +644,7 @@ message(STATUS "Building srsRAN version ${SRSRAN_VERSION_STRING}")
645644
########################################################################
646645
# Generate SBOM
647646
########################################################################
647+
parse_copyright_file("${CMAKE_SOURCE_DIR}/COPYRIGHT")
648648
sbom_add(
649649
LICENSE "LicenseRef-srsRAN"
650650
NAME "AGPL-3.0-only"

cmake/modules/copyright.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,20 @@ function(parse_copyright_file FILE)
4141
"${_copy_str}"
4242
)
4343

44+
# Version
45+
string(TOUPPER "${_module_name}" _upper)
46+
set(_var "SBOM_${_upper}_VERSION")
47+
if(NOT DEFINED ${_var})
48+
message(FATAL_ERROR "Required variable `${_var}` is not defined. ")
49+
endif()
50+
set(_version "${${_var}}")
51+
4452
# Add to SBOM
45-
message(STATUS "Adding external module: ${_module_name} with license: ${_license_str} supplier: ${_copy_clean} and version: ${_version}")
4653
sbom_add(
4754
PACKAGE "${_module_name}"
4855
SUPPLIER "${_copy_clean}"
4956
LICENSE "${_license_str}"
57+
VERSION "${_version}"
5058
)
5159
endif()
5260
endforeach()

external/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@
88

99
add_subdirectory(fmt)
1010
add_subdirectory(uWebSockets)
11+
12+
set(SBOM_BACKWARD_VERSION "UNKNOWN" CACHE STRING "SBOM version for BACKWARD")
13+
set(SBOM_CLI11_VERSION "2.4.2" CACHE STRING "SBOM version for CLI11")
14+
set(SBOM_MPMCQUEUE_VERSION "UNKNOWN" CACHE STRING "SBOM version for MPMCQUEUE")
15+
set(SBOM_SPSCQUEUE_VERSION "UNKNOWN" CACHE STRING "SBOM version for SPSCQUEUE")
16+
set(SBOM_CONCURRENTQUEUE_VERSION "UNKNOWN" CACHE STRING "SBOM version for CONCURRENTQUEUE")
17+
set(SBOM_EXPECTED_VERSION "1.1" CACHE STRING "SBOM version for EXPECTED")
18+
set(SBOM_NLOHMANN_VERSION "3.12.0" CACHE STRING "SBOM version for NLOHMANN")
19+
set(SBOM_SBOM_VERSION "1.3.0" CACHE STRING "SBOM version for SBOM")

external/fmt/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ add_library(fmt STATIC ${SOURCES})
1414
target_link_libraries(fmt ${CMAKE_THREAD_LIBS_INIT})
1515

1616
add_to_exported_libs(fmt)
17+
18+
set(SBOM_FMT_VERSION "11.1.2" CACHE STRING "SBOM version for FMT")

external/uWebSockets/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
#
88

99
add_subdirectory(uSockets)
10+
11+
set(SBOM_UWEBSOCKETS_VERSION "20.71.0" CACHE STRING "SBOM version for UWEBSOCKETS")

0 commit comments

Comments
 (0)