]> granicus.if.org Git - esp-idf/commitdiff
cmake: fix the creation dummy main to avoid rebuilding
authorAnton Maklakov <anton@espressif.com>
Wed, 14 Nov 2018 11:45:14 +0000 (19:45 +0800)
committerAnton Maklakov <anton@espressif.com>
Wed, 14 Nov 2018 14:39:54 +0000 (22:39 +0800)
tools/cmake/idf_functions.cmake

index 93cc4e7e0cce1c10d6181aec9e00a47f87f2684a..f949ba5430b47f50f4fa86b0e9c0bed214a36dca 100644 (file)
@@ -188,7 +188,10 @@ function(idf_add_executable)
         # Create a dummy file to work around CMake requirement of having a source
         # file while adding an executable
         add_executable(${exe_target} "${CMAKE_CURRENT_BINARY_DIR}/dummy_main_src.c")
-        file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy_main_src.c)
+        add_custom_command(OUTPUT dummy_main_src.c
+            COMMAND ${CMAKE_COMMAND} -E touch dummy_main_src.c
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+            VERBATIM)
 
         add_custom_target(dummy_main_src DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dummy_main_src.c)