From 39534c58c5d3b525c53f4be572e1b72b53eac220 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Oct 2018 10:19:26 -0400 Subject: Autogen: Add clang --target= flag to compiler predefines command Respect the compiler target value `CMAKE__COMPILER_TARGET` in `CMAKE__COMPILER_PREDEFINES_COMMAND`. Issue: #18425 --- Modules/Compiler/Clang.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 1653b55..e23470b 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -33,6 +33,14 @@ else() set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP) + if(CMAKE_${lang}_COMPILER_TARGET) + if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4.0) + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-target" "${CMAKE_${lang}_COMPILER_TARGET}") + else() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}") + endif() + endif() + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) -- cgit v0.12