feat(cmakev2): Create executable dummy source only if it does not exist

idf_build_executable() creates a dummy source file to create the
executable target. Since this file is created unconditionally everytime
CMake configuration happens, a source file change is registered which
causes CMake to execute other targets even though no other source file
changed.
This commit is contained in:
Sudeep Mohanty
2025-11-04 07:48:15 +01:00
committed by Frantisek Hrbata
parent 859bcacd29
commit c3881a0631
+3 -1
View File
@@ -527,7 +527,9 @@ function(idf_build_executable executable)
idf_build_library(${library} COMPONENTS "${ARG_COMPONENTS}") idf_build_library(${library} COMPONENTS "${ARG_COMPONENTS}")
set(executable_src ${CMAKE_BINARY_DIR}/executable_${executable}.c) set(executable_src ${CMAKE_BINARY_DIR}/executable_${executable}.c)
file(TOUCH "${executable_src}") if(NOT EXISTS "${executable_src}")
file(TOUCH "${executable_src}")
endif()
add_executable(${executable} "${executable_src}") add_executable(${executable} "${executable_src}")
if(ARG_NAME) if(ARG_NAME)