mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
Clang: Implement CMAKE_${LANG}_COMPILER_TARGET for all variants on windows
Fixes: #21097
This commit is contained in:
committed by
Brad King
parent
60b10d4fad
commit
cf83758b24
@@ -88,7 +88,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_TARGET)
|
||||
list(PREPEND CMAKE_C_COMPILER_ID_TEST_FLAGS "-c --target=${CMAKE_C_COMPILER_TARGET}")
|
||||
set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST "-c --target=${CMAKE_C_COMPILER_TARGET}")
|
||||
endif()
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_C_COMPILER_ID_RUN)
|
||||
|
||||
@@ -84,7 +84,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_TARGET)
|
||||
list(PREPEND CMAKE_CXX_COMPILER_ID_TEST_FLAGS "-c --target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||
set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST "-c --target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
|
||||
@@ -163,7 +163,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
include(Platform/Windows-MSVC)
|
||||
# Set the clang option forwarding prefix for clang-cl usage in the llvm-rc processing stage
|
||||
__enable_llvm_rc_preprocessing("-clang:")
|
||||
macro(__windows_compiler_clang lang)
|
||||
macro(__windows_compiler_clang_base lang)
|
||||
set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}")
|
||||
__windows_compiler_msvc(${lang})
|
||||
endmacro()
|
||||
@@ -179,7 +179,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
set(CMAKE_BUILD_TYPE_INIT Debug)
|
||||
|
||||
__enable_llvm_rc_preprocessing("")
|
||||
macro(__windows_compiler_clang lang)
|
||||
macro(__windows_compiler_clang_base lang)
|
||||
__windows_compiler_clang_gnu(${lang})
|
||||
endmacro()
|
||||
endif()
|
||||
@@ -187,7 +187,16 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
|
||||
else()
|
||||
include(Platform/Windows-GNU)
|
||||
__enable_llvm_rc_preprocessing("")
|
||||
macro(__windows_compiler_clang lang)
|
||||
macro(__windows_compiler_clang_base lang)
|
||||
__windows_compiler_gnu(${lang})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
macro(__windows_compiler_clang lang)
|
||||
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
|
||||
endif()
|
||||
__windows_compiler_clang_base(${lang})
|
||||
endmacro()
|
||||
|
||||
@@ -364,11 +364,6 @@ macro(__windows_compiler_msvc lang)
|
||||
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
|
||||
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
|
||||
|
||||
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0)
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-target ")
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=")
|
||||
endif()
|
||||
# '-flto=thin' available since Clang 3.9 and Xcode 8
|
||||
# * http://clang.llvm.org/docs/ThinLTO.html#clang-llvm
|
||||
# * https://trac.macports.org/wiki/XcodeVersionInfo
|
||||
|
||||
Reference in New Issue
Block a user