mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-21 23:00:50 +08:00
Tests: Cover file(GENERATE) using 'foo.tmp' as input for output 'foo'
Fixes: #20873
This commit is contained in:
6
Tests/RunCMake/File_Generate/AdjacentInOut.cmake
Normal file
6
Tests/RunCMake/File_Generate/AdjacentInOut.cmake
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
cmake_policy(SET CMP0070 NEW)
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt")
|
||||||
|
message(FATAL_ERROR "CMake should not re-run during the build!")
|
||||||
|
endif()
|
||||||
|
configure_file(AdjacentInOut.in ${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt.tmp)
|
||||||
|
file(GENERATE OUTPUT AdjacentInOut.txt INPUT ${CMAKE_CURRENT_BINARY_DIR}/AdjacentInOut.txt.tmp)
|
1
Tests/RunCMake/File_Generate/AdjacentInOut.in
Normal file
1
Tests/RunCMake/File_Generate/AdjacentInOut.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Sample Text File
|
@@ -72,6 +72,7 @@ if (UNIX AND EXISTS /bin/sh)
|
|||||||
if (NOT script_output STREQUAL SUCCESS)
|
if (NOT script_output STREQUAL SUCCESS)
|
||||||
message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}")
|
message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}")
|
||||||
endif()
|
endif()
|
||||||
|
unset(RunCMake_TEST_NO_CLEAN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (RunCMake_GENERATOR MATCHES Makefiles)
|
if (RunCMake_GENERATOR MATCHES Makefiles)
|
||||||
@@ -104,3 +105,10 @@ if (RunCMake_GENERATOR MATCHES Makefiles)
|
|||||||
message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
|
message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdjacentInOut-build)
|
||||||
|
run_cmake(AdjacentInOut)
|
||||||
|
set(RunCMake_TEST_NO_CLEAN 1)
|
||||||
|
run_cmake_command(AdjacentInOut-nowork ${CMAKE_COMMAND} --build .)
|
||||||
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
|
unset(RunCMake_TEST_NO_CLEAN)
|
||||||
|
Reference in New Issue
Block a user