diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2016-03-06 16:46:53 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2016-03-09 19:33:01 (GMT) |
commit | 111cd679191c8aa4e081765ac4f7bc2e08657c7f (patch) | |
tree | 1fb8ff0a6e5787ae243f3ba69feea4425a0e11f6 /Tests/RunCMake/BuildDepends | |
parent | b19bc31277bb2e3dd75e78f64924be3955ea8c6d (diff) | |
download | CMake-111cd679191c8aa4e081765ac4f7bc2e08657c7f.zip CMake-111cd679191c8aa4e081765ac4f7bc2e08657c7f.tar.gz CMake-111cd679191c8aa4e081765ac4f7bc2e08657c7f.tar.bz2 |
Xcode: ReRunCMake even if files disappeared (#15992)
Diffstat (limited to 'Tests/RunCMake/BuildDepends')
-rw-r--r-- | Tests/RunCMake/BuildDepends/RunCMakeTest.cmake | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 31c72fb..51e0b0a 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -40,3 +40,42 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio [67]|Xcode") endif() run_BuildDepends(Custom-Always) + +function(run_ReGeneration) + # test re-generation of project even if CMakeLists.txt files disappeared + + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/regenerate-project-build) + set(RunCMake_TEST_SOURCE_DIR ${RunCMake_BINARY_DIR}/regenerate-project-source) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + set(ProjectHeader [=[ + cmake_minimum_required(VERSION 3.5) + project(Regenerate-Project NONE) + ]=]) + + # create project with subdirectory + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}" + "add_subdirectory(mysubdir)") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/mysubdir/CMakeLists.txt" "# empty") + + run_cmake(Regenerate-Project) + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay}) + + # now we delete the subdirectory and adjust the CMakeLists.txt + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}/mysubdir") + file(WRITE "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" "${ProjectHeader}") + + run_cmake_command(Regenerate-Project-Directory-Removed + ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}") + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endfunction() + +if(RunCMake_GENERATOR STREQUAL "Xcode") + run_ReGeneration(regenerate-project) +endif() |