mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Tests: Simplify RunCMake.CompilerChange
The test suite can be simplified now that command line arguments are restored after resetting the cache due to a compiler change. Previously the test case name had to be set in the environment and now that is not required.
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
if(NOT RunCMake_TEST)
|
||||
set(RunCMake_TEST "$ENV{RunCMake_TEST}") # needed when cache is deleted
|
||||
endif()
|
||||
if(RunCMake_TEST MATCHES "^ToolchainFromFile")
|
||||
# CMAKE_TOOLCHAIN_FILE should be set before project. The ToolchainFromFile
|
||||
# cases test detecting toolchain path changes between CMake invocations and
|
||||
|
||||
@@ -10,4 +10,4 @@ CMake Error at EmptyCompiler\.cmake:2 \(enable_language\):
|
||||
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
|
||||
the compiler, or to the compiler name if it is in the PATH\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:14 \(include\)$
|
||||
CMakeLists\.txt:11 \(include\)$
|
||||
|
||||
@@ -27,12 +27,9 @@ configure_file(${ccIn} ${cc2} @ONLY)
|
||||
|
||||
block()
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeCompiler-build)
|
||||
set(ENV{RunCMake_TEST} "FirstCompiler")
|
||||
run_cmake_with_options(FirstCompiler -DCMAKE_C_COMPILER=${cc1})
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(ENV{RunCMake_TEST} "SecondCompiler")
|
||||
run_cmake_with_options(SecondCompiler -DCMAKE_C_COMPILER=${cc2})
|
||||
set(ENV{RunCMake_TEST} "EmptyCompiler")
|
||||
run_cmake_with_options(EmptyCompiler -DCMAKE_C_COMPILER=)
|
||||
endblock()
|
||||
|
||||
@@ -55,7 +52,6 @@ block()
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ToolchainFromFile-build)
|
||||
run_cmake(ToolchainFromFile-step1)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(ENV{RunCMake_TEST} "ToolchainFromFile-step2")
|
||||
run_cmake(ToolchainFromFile-step2)
|
||||
endblock()
|
||||
|
||||
@@ -65,7 +61,6 @@ block()
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ToolchainFromFileDeleted-build)
|
||||
run_cmake(ToolchainFromFileDeleted-step1)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(ENV{RunCMake_TEST} "ToolchainFromFileDeleted-step2")
|
||||
run_cmake(ToolchainFromFileDeleted-step2)
|
||||
endblock()
|
||||
|
||||
@@ -76,7 +71,6 @@ block()
|
||||
"-DCMAKE_TOOLCHAIN_FILE=${RunCMake_BINARY_DIR}/foo.cmake"
|
||||
)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
set(ENV{RunCMake_TEST} "ToolchainFromCmdline-step2")
|
||||
run_cmake_with_options(ToolchainFromCmdline-step2
|
||||
"-DCMAKE_TOOLCHAIN_FILE=${RunCMake_BINARY_DIR}/bar.cmake"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user