I tried changing from ASM to ASM-ATT and that fails like this:

/usr/bin/as  -I/user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src
-I/user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src/sysc/kernel
-DNOMINMAX -DUSE_SIM_NAMESPACE -o
CMakeFiles/systemc.dir/src/sysc/qt/md/i386.s.o
/user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src/sysc/qt/md/i386.s
/usr/bin/as: unrecognized option `-NOMINMAX'

I really don't think the -I and -D options should be passed through for
assembler files.  They only make sense for C/C++ files.  There should be a
separate variable like CMAKE_ASM_FLAGS that is used instead of CMAKE_C_FLAGS
or CMAKE_CXX_FLAGS.  And maybe there needs to be a change to the
add_definitions() command to allow an optional LANG argument ?  Do assembers
even support preprocessor definitions ?

I was able to get it to work for both 2.8.4 and 2.8.5 with the following
code:

if(UNIX)
    list(APPEND sources "src/sysc/qt/qt.c")

    # see if we are building 32-bit or 64-bit executables
    file(WRITE ${CMAKE_BINARY_DIR}/check_32or64bit.cpp "int main(int argc,
char *argv[]) { return 8 * sizeof(char *); }\n")

    try_run(
        run_result
        compile_result
        ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/check_32or64bit.cpp
        )

    if (${run_result} EQUAL 32)
        list(APPEND sources "src/sysc/qt/md/i386.s")
        if(APPLE)
            set(ASM_SYS_FLAGS "-arch i386")
        else()
            set(ASM_SYS_FLAGS "-32")
        endif()
    else()
        list(APPEND sources "src/sysc/qt/md/iX86_64.s")
        if(APPLE)
            set(ASM_SYS_FLAGS "-arch x86_64")
        else()
            set(ASM_SYS_FLAGS "-64")
        endif()
    endif()

    enable_language(ASM-ATT)

    set(CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER>
${ASM_SYS_FLAGS} -o <OBJECT> <SOURCE>")
endif()

I'm not sure if this is the recommended way to do this though.  I thought
the documentation said to override CMAKE_ASM-ATT_COMPILE_OBJECT before the
enable_language() command.  If I do that then I get the -I and -D flags back
and my ASM_SYS_FLAGS variable is ignored.  Is there a cleaner way to do this
or is my current solution okay ?


2011/8/2 Alexander Neundorf <a.neundorf-w...@gmx.net>

> Hi,
>
> On Tuesday 02 August 2011, Glenn Coombs wrote:
> > Previously with cmake 2.8.4 we were using these lines to compile an
>
> with 2.8.5 there was a major rework of the assembler support (and now it
> finally does not say "Assembler support is experimental" anymore).
> Sorry that this causes inconvenience for you.
>
> If you enable "ASM", you get support for assembler via your C/C++ compiler.
> That's why you get gcc now instead of as.
> If the C/C++ compiler does not support processing assembler files, this
> language can't be enabled.
>
> If you need a "real" assembler, you have to enable the respective assembler
> "dialect". E.g. to get as/gas, you need to enable "ASM-ATT".
> This should work with both versions.
>
> Let me know if this doesn't work for you.
>
> Alex
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to