From e4a4063e4c7b89e23eebacbc633473e872fe7843 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Wed, 12 Jun 2019 11:51:04 +0800 Subject: [PATCH] cmake: fix issue with fail at build time Fix issue that next build retry does not succeed once the requirement is satisfied. --- tools/cmake/utilities.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cmake/utilities.cmake b/tools/cmake/utilities.cmake index 83403d9ce..758061307 100644 --- a/tools/cmake/utilities.cmake +++ b/tools/cmake/utilities.cmake @@ -201,9 +201,15 @@ function(fail_at_build_time target_name message_line0) foreach(message_line ${ARGN}) set(message_lines ${message_lines} COMMAND ${CMAKE_COMMAND} -E echo "${message_line}") endforeach() + # Generate a timestamp file that gets included. When deleted on build, this forces CMake + # to rerun. + string(RANDOM filename) + set(filename "${CMAKE_CURRENT_BINARY_DIR}/${filename}.cmake") + file(WRITE "${filename}" "") + include("${filename}") add_custom_target(${target_name} ALL ${message_lines} - COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/CMakeCache.txt" + COMMAND ${CMAKE_COMMAND} -E remove "${filename}" COMMAND ${CMAKE_COMMAND} -P ${idf_path}/tools/cmake/scripts/fail.cmake VERBATIM) endfunction()