From 1be44d8ecf8f1b779e5b066a9175ee50c659fffb Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Wed, 30 Nov 2022 14:48:34 -0300 Subject: [PATCH] build: prevent the configuration from succeeding if headers do not exist --- .../custom-modules/ns3-module-macros.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build-support/custom-modules/ns3-module-macros.cmake b/build-support/custom-modules/ns3-module-macros.cmake index 393041939..0c0cfd3fe 100644 --- a/build-support/custom-modules/ns3-module-macros.cmake +++ b/build-support/custom-modules/ns3-module-macros.cmake @@ -225,6 +225,23 @@ function(build_lib) # Write a module header that includes all headers from that module write_module_header("${BLIB_LIBNAME}" "${BLIB_HEADER_FILES}") + # Check if headers actually exist to prevent copying errors during + # installation + get_target_property(headers_to_check ${lib${BLIB_LIBNAME}} PUBLIC_HEADER) + set(missing_headers) + foreach(header ${headers_to_check}) + if(NOT ((EXISTS ${header}) OR (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${header}) + ) + ) + list(APPEND missing_headers ${header}) + endif() + endforeach() + if(missing_headers) + message( + FATAL_ERROR "Missing header files for ${BLIB_LIBNAME}: ${missing_headers}" + ) + endif() + # Copy all header files to outputfolder/include before each build copy_headers_before_building_lib( ${BLIB_LIBNAME} ${CMAKE_HEADER_OUTPUT_DIRECTORY}