netgen/cmake_modules/check_submodules.cmake
Matthias Hochsteger cb8bef9423 Force rebuild of Netgen subproject when building the Superbuild
CMake is using stamp files to check if the external projects are out
of date. There is an option 'BUILD_ALWAYS 1' of ExternalProject_Add,
but it is not available prior to CMake 3.1.

To work around it, this commit solves two problems at once:

- Add a new step 'check_submodules' between configure and build
  to check if all submodules are up to date. This step has the option
  'ALWAYS 1', which means it is always considered outdated.

- Since 'build' depends on the above step, it will always be started
2017-01-20 10:16:48 +01:00

14 lines
622 B
CMake

execute_process(COMMAND git submodule status --recursive WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../" OUTPUT_VARIABLE git_status_output)
string(REPLACE "\n" ";" git_status_output "${git_status_output}")
foreach( a ${git_status_output})
if(NOT ${a} MATCHES " [a-f,0-9]* external_dependencies[.]*")
message(WARNING
"*****************************************************************
WARNING: The git submodules are out of sync! Please run
git submodule update --init --recursive
in your source directory
*****************************************************************")
endif()
endforeach()