aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <otroan@employees.org>2024-06-21 17:17:09 +0200
committerOle Tr�an <otroan@employees.org>2024-06-24 10:39:43 +0000
commit228e195e115a195b408d90e25a85dbbd8560059d (patch)
tree8887ce64d67dce6d07e6bedcf598ddc5599c18cd
parentf876b69537cd860abcaa2ccedbfe4decdada8c12 (diff)
build: conditional dependency handling of depfile
Older distributions like Ubuntu 20.04 uses an old version of cmake that does not handle absolute paths. Leave .api dependency handling like before, i.e. not handle interdependency between .api files for those older builds. Type: fix Change-Id: I3f15a4506f6c95fca7a5b00893dc354cbed42a29 Signed-off-by: Ole Troan <otroan@employees.org>
-rw-r--r--src/cmake/api.cmake24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/cmake/api.cmake b/src/cmake/api.cmake
index cbda4008a28..999bbf91be1 100644
--- a/src/cmake/api.cmake
+++ b/src/cmake/api.cmake
@@ -47,15 +47,27 @@ function(vpp_generate_api_c_header file)
get_filename_component(barename ${file} NAME)
+# Define a variable for common apigen arguments
+set(COMMON_ARGS
+ OUTPUT ${OUTPUT_HEADERS}
+ COMMAND mkdir -p ${output_dir}
+ COMMAND ${PYENV} ${VPP_APIGEN}
+ ARGS ${includedir} --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --outputdir ${output_dir} --output ${output_name} -MF ${dependency_file}
+ DEPENDS ${VPP_APIGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${VPPAPIGEN_SUBMODULES}
+ COMMENT "Generating API header ${output_name}"
+)
+
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
add_custom_command (
- OUTPUT ${OUTPUT_HEADERS}
- COMMAND mkdir -p ${output_dir}
- COMMAND ${PYENV} ${VPP_APIGEN}
- ARGS ${includedir} --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --outputdir ${output_dir} --output ${output_name} -MF ${dependency_file}
- DEPENDS ${VPP_APIGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${VPPAPIGEN_SUBMODULES}
- COMMENT "Generating API header ${output_name}"
+ ${COMMON_ARGS}
DEPFILE ${dependency_file}
)
+else()
+ message(WARNING "Your CMake version does not support DEPFILE. Consider upgrading to CMake 3.20 or later for improved dependency handling.")
+ add_custom_command (
+ ${COMMON_ARGS}
+ )
+endif()
set(t ${barename}_deps)
if (NOT TARGET ${t})