summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineASMCompiler.cmake
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-12-02 10:26:30 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-02 15:00:34 (GMT)
commitdd153de4f0c737f75b545b503b330880001135fe (patch)
tree22c3a1c061b602b3c485cd531a9f1b3b2c958f13 /Modules/CMakeDetermineASMCompiler.cmake
parentba946930dd6e1de5aa99123084a5506f7542e3b4 (diff)
downloadCMake-dd153de4f0c737f75b545b503b330880001135fe.zip
CMake-dd153de4f0c737f75b545b503b330880001135fe.tar.gz
CMake-dd153de4f0c737f75b545b503b330880001135fe.tar.bz2
CMakeDetermineASMCompiler: arg-split ASM* env var like CC
Split the arguments off of the `ASM${ASM_DIALECT}` environment variable as is done for `CC` and other compiler variables. This fixes using CMake when `ASM*` is used to pass additional target flags, e.g. when one uses `ASM=${CC}`.
Diffstat (limited to 'Modules/CMakeDetermineASMCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index deb10fb..4162726 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -9,7 +9,13 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
# prefer the environment variable ASM
if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "")
- set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
+ get_filename_component(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT $ENV{ASM${ASM_DIALECT}} PROGRAM PROGRAM_ARGS CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
+ if(CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
+ set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT}" CACHE STRING "First argument to ASM${ASM_DIALECT} compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable ASM${ASM_DIALECT}:\n$ENV{ASM${ASM_DIALECT}}.")
+ endif()
endif()
# finally list compilers to try