cmake-utils.eclass: Set assembler correctly, #601292
authorMichał Górny <mgorny@gentoo.org>
Wed, 30 Nov 2016 23:02:32 +0000 (00:02 +0100)
committerMichał Górny <mgorny@gentoo.org>
Thu, 1 Dec 2016 22:39:33 +0000 (23:39 +0100)
Use <CMAKE_ASM_COMPILER> in the assembly compile command in order to fix
building assembly files. It turns out that <CMAKE_C_COMPILER> is no
longer correctly evaluated in that command once it is no longer set
explicitly in the toolchain file and passed through the environment
instead.

Pass ASM and ASMFLAGS (equal to CC and CFLAGS) appropriately to enforce
using the correct compiler.

eclass/cmake-utils.eclass

index b21435b1782dee6ca2e57bcedd67fa7b3c3d82b7..784ae44b6812ed6392cd5413128081041079668f 100644 (file)
@@ -517,7 +517,7 @@ enable_cmake-utils_src_configure() {
                includes="<INCLUDES>"
        fi
        cat > "${build_rules}" <<- _EOF_ || die
-               SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
+               SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
                SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
                SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
                SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
@@ -532,6 +532,8 @@ enable_cmake-utils_src_configure() {
        # Bug 542530, export those instead of setting paths in toolchain file
        local -x CC=$(tc-getCC) CXX=$(tc-getCXX) FC=$(tc-getFC)
        local -x PKG_CONFIG=$(tc-getPKG_CONFIG)
+       # Bug 601292, set the compiler for assembly as well
+       local -x ASM=$(tc-getCC) ASMFLAGS=${CFLAGS}
 
        if tc-is-cross-compiler; then
                local sysname