mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 11:22:21 -06:00
Tests: Test CMakeTest*Compiler.cmake fallbacks
Add tests that explicitly test the fallback tests of the modules which
test for a functional [Obj]C[xx] compiler, bypassing the ABI tests.
Due to the ABI test short-circuiting added by commit 1d21dd0f7c
(enable_language: Assume compiler works if ABI detection compiles,
2020-05-25, v3.18.0-rc1~93^2), this logic is likely not getting tested
otherwise.
This commit is contained in:
committed by
Brad King
parent
164a156c7c
commit
f891a75d5c
@@ -295,6 +295,10 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
|
||||
add_RunCMake_test(CompilerChange)
|
||||
endif()
|
||||
add_RunCMake_test(CompilerNotFound)
|
||||
if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
|
||||
list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1)
|
||||
endif()
|
||||
add_RunCMake_test(CompilerTest)
|
||||
add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE})
|
||||
add_RunCMake_test(DisallowedCommands)
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
|
||||
|
||||
2
Tests/RunCMake/CompilerTest/C-stdout.txt
Normal file
2
Tests/RunCMake/CompilerTest/C-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Check for working C compiler: [^
|
||||
]* - works
|
||||
3
Tests/RunCMake/CompilerTest/C.cmake
Normal file
3
Tests/RunCMake/CompilerTest/C.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pretend the ABI check failed in order to force the fall-back test to run.
|
||||
set(CMAKE_C_ABI_COMPILED FALSE)
|
||||
enable_language(C)
|
||||
3
Tests/RunCMake/CompilerTest/CMakeLists.txt
Normal file
3
Tests/RunCMake/CompilerTest/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
2
Tests/RunCMake/CompilerTest/CXX-stdout.txt
Normal file
2
Tests/RunCMake/CompilerTest/CXX-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Check for working CXX compiler: [^
|
||||
]* - works
|
||||
3
Tests/RunCMake/CompilerTest/CXX.cmake
Normal file
3
Tests/RunCMake/CompilerTest/CXX.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pretend the ABI check failed in order to force the fall-back test to run.
|
||||
set(CMAKE_CXX_ABI_COMPILED FALSE)
|
||||
enable_language(CXX)
|
||||
2
Tests/RunCMake/CompilerTest/OBJC-stdout.txt
Normal file
2
Tests/RunCMake/CompilerTest/OBJC-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Check for working OBJC compiler: [^
|
||||
]* - works
|
||||
3
Tests/RunCMake/CompilerTest/OBJC.cmake
Normal file
3
Tests/RunCMake/CompilerTest/OBJC.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pretend the ABI check failed in order to force the fall-back test to run.
|
||||
set(CMAKE_OBJC_ABI_COMPILED FALSE)
|
||||
enable_language(OBJC)
|
||||
2
Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
Normal file
2
Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Check for working OBJCXX compiler: [^
|
||||
]* - works
|
||||
3
Tests/RunCMake/CompilerTest/OBJCXX.cmake
Normal file
3
Tests/RunCMake/CompilerTest/OBJCXX.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pretend the ABI check failed in order to force the fall-back test to run.
|
||||
set(CMAKE_OBJCXX_ABI_COMPILED FALSE)
|
||||
enable_language(OBJCXX)
|
||||
9
Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
Normal file
9
Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(C)
|
||||
run_cmake(CXX)
|
||||
|
||||
if(CMake_TEST_OBJC)
|
||||
run_cmake(OBJC)
|
||||
run_cmake(OBJCXX)
|
||||
endif()
|
||||
Reference in New Issue
Block a user