Tests: fix some Clang failures on Windows

* Execute MSVCRuntimeLibrary tests for GNU command line mode Clang on
  Windows using the MSVC ABI
* Assembler tests should be executed with the Ninja generator
* Assembler tests shouldn't be executed with clang-cl
* Fixed a condition in the Preprocess test for clang-cl
* Adjusted the conditions on some MSVC specific tests
This commit is contained in:
Zsolt Parragi 2019-07-06 14:56:54 +02:00 committed by Brad King
parent f56393f0bd
commit 417eb5739a
4 changed files with 14 additions and 8 deletions

View File

@ -7,9 +7,10 @@ set(SRCS)
# (at least) the following toolchains can process assembler files directly
# and also generate assembler files from C:
if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND
if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
NOT CMAKE_OSX_ARCHITECTURES)
if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX))
if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX)
AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"))
set(C_FLAGS "${CMAKE_C_FLAGS}")
separate_arguments(C_FLAGS)
if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};")

View File

@ -1877,9 +1877,11 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
endif ()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
if(MSVC)
ADD_TEST_MACRO(ForceInclude foo)
if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))
ADD_TEST_MACRO(PDBDirectoryAndName myexe)
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" OR NOT "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
ADD_TEST_MACRO(ForceInclude foo)
endif()
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_TEST_MACRO(PrecompiledHeader foo)
endif()

View File

@ -3,8 +3,8 @@ cmake_policy(SET CMP0054 NEW)
project(PDBDirectoryAndName C)
# Make sure the proper compiler is in use.
if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel")
if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC, Clang or Intel")
endif()
# Intel 11.1 does not support /Fd but Intel 14.0 does.

View File

@ -29,7 +29,10 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
set(PP_VS 1)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND
"x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND
"x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CLANG_MSVC_WINDOWS 1)
endif()
if(CLANG_MSVC_WINDOWS AND
"x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CLANG_GNULIKE_WINDOWS 1)
endif()
@ -106,7 +109,7 @@ endif()
set(EXPR_OP1 "/")
if((NOT MSVC OR PP_NMAKE) AND
NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND
NOT CLANG_GNULIKE_WINDOWS)
NOT CLANG_MSVC_WINDOWS)
# MSVC cl, Intel icl: %
# When the cl compiler is invoked from the command line then % must
# be written %% (to distinguish from %ENV% syntax). However cl does