diff options
author | Brad King <brad.king@kitware.com> | 2018-10-05 14:19:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-05 14:23:52 (GMT) |
commit | 39534c58c5d3b525c53f4be572e1b72b53eac220 (patch) | |
tree | 1449e3c8e9ac2d1a0ad849957cc511b23c7e7426 /Modules/Compiler | |
parent | fd02538974dd952a8639d371c2c0067d30d5469a (diff) | |
download | CMake-39534c58c5d3b525c53f4be572e1b72b53eac220.zip CMake-39534c58c5d3b525c53f4be572e1b72b53eac220.tar.gz CMake-39534c58c5d3b525c53f4be572e1b72b53eac220.tar.bz2 |
Autogen: Add clang --target= flag to compiler predefines command
Respect the compiler target value `CMAKE_<LANG>_COMPILER_TARGET` in
`CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND`.
Issue: #18425
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/Clang.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
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) |