Fix automatic submodule checkout.
With the old version, `make clean` would remove munit.c as it was
treated as a generated file.  The new version, which is based on a
suggestion by doesn't suffer from that problem.
@@ -11,12 +11,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
+if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/munit/munit.c")
find_program(GIT git)
if(GIT)
- add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/munit/munit.c"
- COMMAND ${GIT} submodule update --init --recursive)
+ execute_process(COMMAND ${GIT} submodule update --init --recursive)
else()
- if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/munit/munit.c")
message (FATAL_ERROR "It looks like you don't have submodules checked out. Please run `git submodule update --init --recursive'")
endif()
endif()
