Commit fe8f6e36 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'clang-test-fixes'

417eb573 Tests: fix some Clang failures on Windows
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3518
parents 2161f810 417eb573
...@@ -7,9 +7,10 @@ set(SRCS) ...@@ -7,9 +7,10 @@ set(SRCS)
# (at least) the following toolchains can process assembler files directly # (at least) the following toolchains can process assembler files directly
# and also generate assembler files from C: # 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) 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}") set(C_FLAGS "${CMAKE_C_FLAGS}")
separate_arguments(C_FLAGS) separate_arguments(C_FLAGS)
if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};")
......
...@@ -1877,9 +1877,11 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH ...@@ -1877,9 +1877,11 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
endif () endif ()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
if(MSVC) if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))
ADD_TEST_MACRO(ForceInclude foo)
ADD_TEST_MACRO(PDBDirectoryAndName myexe) 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") if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_TEST_MACRO(PrecompiledHeader foo) ADD_TEST_MACRO(PrecompiledHeader foo)
endif() endif()
......
...@@ -3,8 +3,8 @@ cmake_policy(SET CMP0054 NEW) ...@@ -3,8 +3,8 @@ cmake_policy(SET CMP0054 NEW)
project(PDBDirectoryAndName C) project(PDBDirectoryAndName C)
# Make sure the proper compiler is in use. # Make sure the proper compiler is in use.
if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "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 or Intel") message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC, Clang or Intel")
endif() endif()
# Intel 11.1 does not support /Fd but Intel 14.0 does. # Intel 11.1 does not support /Fd but Intel 14.0 does.
......
...@@ -29,7 +29,10 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") ...@@ -29,7 +29,10 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
set(PP_VS 1) set(PP_VS 1)
endif() endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND 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") "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CLANG_GNULIKE_WINDOWS 1) set(CLANG_GNULIKE_WINDOWS 1)
endif() endif()
...@@ -106,7 +109,7 @@ endif() ...@@ -106,7 +109,7 @@ endif()
set(EXPR_OP1 "/") set(EXPR_OP1 "/")
if((NOT MSVC OR PP_NMAKE) AND if((NOT MSVC OR PP_NMAKE) AND
NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND
NOT CLANG_GNULIKE_WINDOWS) NOT CLANG_MSVC_WINDOWS)
# MSVC cl, Intel icl: % # MSVC cl, Intel icl: %
# When the cl compiler is invoked from the command line then % must # When the cl compiler is invoked from the command line then % must
# be written %% (to distinguish from %ENV% syntax). However cl does # be written %% (to distinguish from %ENV% syntax). However cl does
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment