]> 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 17:12:50 +0000 (01:12 +0800)
tools/cmake/idf_functions.cmake

index 8f22ea28bbf6f5ecc1c5b87f68c2843de3f518b0..0d1c1832fd97d034b78d5687f2088c2b4db1d8f8 100644 (file)
@@ -154,7 +154,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)