Tests: Enable languages explicitly in RunCMake.target_compile_features

Enable C or CXX (or nothing) as needed in each test case.
This will allow us to add test cases that do not enable CXX.
This commit is contained in:
Brad King 2017-06-26 13:48:21 -04:00
parent 8fe54172fc
commit 869904271b
22 changed files with 22 additions and 12 deletions

View File

@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.0)
project(${RunCMake_TEST} CXX)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -1,4 +1,4 @@
CMake Error at alias_target.cmake:4 \(target_compile_features\):
CMake Error at alias_target.cmake:[0-9]+ \(target_compile_features\):
target_compile_features can not be used on an ALIAS target.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_executable(main empty.cpp)
add_executable(Alias::Main ALIAS main)

View File

@ -1,4 +1,4 @@
CMake Error at imported_target.cmake:3 \(target_compile_features\):
CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\):
Cannot specify compile features for imported target "main".
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_library(main INTERFACE IMPORTED)
target_compile_features(main INTERFACE cxx_delegating_constructors)

View File

@ -1,4 +1,4 @@
CMake Error at invalid_args.cmake:3 \(target_compile_features\):
CMake Error at invalid_args.cmake:[0-9]+ \(target_compile_features\):
target_compile_features called with invalid arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_executable(main empty.cpp)
target_compile_features(main INVALID cxx_delegating_constructors)

View File

@ -1,4 +1,4 @@
CMake Error at invalid_args_on_interface.cmake:3 \(target_compile_features\):
CMake Error at invalid_args_on_interface.cmake:[0-9]+ \(target_compile_features\):
target_compile_features may only be set INTERFACE properties on INTERFACE
targets
Call Stack \(most recent call first\):

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_library(main INTERFACE)
target_compile_features(main PRIVATE cxx_delegating_constructors)

View File

@ -1,4 +1,4 @@
CMake Error at no_matching_c_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\):
CMake Error at no_matching_c_feature.cmake:[0-9]+ \((target_compile_features|message)\):
The compiler feature "gnu_c_dummy" is not known to C compiler
"GNU"

View File

@ -1,3 +1,4 @@
enable_language(CXX)
if (NOT ";${CMAKE_C_COMPILE_FEATURES};" MATCHES ";gnu_c_typeof;")
# Simulate passing the test.

View File

@ -1,4 +1,4 @@
CMake Error at no_matching_cxx_feature.cmake:[0-9][0-9]? \((target_compile_features|message)\):
CMake Error at no_matching_cxx_feature.cmake:[0-9]+ \((target_compile_features|message)\):
The compiler feature "[^"]+" is not known to CXX compiler
"[^"]*"

View File

@ -1,3 +1,4 @@
enable_language(CXX)
if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";gnu_cxx_typeof;"
AND NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";msvc_cxx_sealed;" )

View File

@ -1,4 +1,4 @@
CMake Error at no_target.cmake:2 \(target_compile_features\):
CMake Error at no_target.cmake:[0-9]+ \(target_compile_features\):
Cannot specify compile features for target "main" which is not built by
this project.
Call Stack \(most recent call first\):

View File

@ -1,2 +1,3 @@
enable_language(CXX)
target_compile_features(main INTERFACE cxx_delegating_constructors)

View File

@ -1,4 +1,4 @@
CMake Error at not_a_c_feature.cmake:3 \(target_compile_features\):
CMake Error at not_a_c_feature.cmake:[0-9]+ \(target_compile_features\):
target_compile_features specified unknown feature "c_not_a_feature" for
target "main".
Call Stack \(most recent call first\):

View File

@ -1,3 +1,4 @@
enable_language(C)
add_executable(main empty.c)
target_compile_features(main

View File

@ -1,4 +1,4 @@
CMake Error at not_a_cxx_feature.cmake:3 \(target_compile_features\):
CMake Error at not_a_cxx_feature.cmake:[0-9]+ \(target_compile_features\):
target_compile_features specified unknown feature "cxx_not_a_feature" for
target "main".
Call Stack \(most recent call first\):

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_executable(main empty.cpp)
target_compile_features(main

View File

@ -1,4 +1,4 @@
CMake Error at not_enough_args.cmake:3 \(target_compile_features\):
CMake Error at not_enough_args.cmake:[0-9]+ \(target_compile_features\):
target_compile_features called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -1,3 +1,4 @@
enable_language(CXX)
add_executable(main empty.cpp)
target_compile_features(main)

View File

@ -1,4 +1,4 @@
CMake Error at utility_target.cmake:4 \(target_compile_features\):
CMake Error at utility_target.cmake:[0-9]+ \(target_compile_features\):
target_compile_features called with non-compilable target type
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)