Tests: Refactor RunCMake.File_Generate to drop RunCMake_TEST_FILE

Drop use of RunCMake_TEST_FILE and pass the test file in through a
definition in RunCMake_TEST_OPTIONS.
This commit is contained in:
Brad King 2014-06-30 14:32:51 -04:00
parent bf5fc1d582
commit 8707814e78
4 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,6 @@
cmake_minimum_required(VERSION 2.8.4) cmake_minimum_required(VERSION 2.8.4)
project(${RunCMake_TEST} NONE) project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake) if(NOT TEST_FILE)
set(TEST_FILE ${RunCMake_TEST}.cmake)
endif()
include(${TEST_FILE})

View File

@ -1,4 +1,4 @@
CMake Error at EmptyCondition1.cmake:2 \(file\): CMake Error at EmptyCondition1.cmake:2 \(file\):
file Incorrect arguments to GENERATE subcommand. file Incorrect arguments to GENERATE subcommand.
Call Stack \(most recent call first\): Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\) CMakeLists.txt:[0-9]+ \(include\)

View File

@ -1,4 +1,4 @@
CMake Error at EmptyCondition2.cmake:2 \(file\): CMake Error at EmptyCondition2.cmake:2 \(file\):
file CONDITION of sub-command GENERATE must not be empty if specified. file CONDITION of sub-command GENERATE must not be empty if specified.
Call Stack \(most recent call first\): Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\) CMakeLists.txt:[0-9]+ \(include\)

View File

@ -12,10 +12,10 @@ run_cmake(DebugEvaluate)
set(timeformat "%Y%j%H%M%S") set(timeformat "%Y%j%H%M%S")
file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt")
set(RunCMake_TEST_FILE "WriteIfDifferent") set(RunCMake_TEST_OPTIONS "-DTEST_FILE=WriteIfDifferent.cmake")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/WriteIfDifferent-build")
run_cmake(WriteIfDifferent-prepare) run_cmake(WriteIfDifferent-prepare)
unset(RunCMake_TEST_FILE) unset(RunCMake_TEST_OPTIONS)
unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_BINARY_DIR)
file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat}) file(TIMESTAMP "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt" timestamp ${timeformat})
if(NOT timestamp) if(NOT timestamp)