Previously with cmake 2.8.4 we were using these lines to compile an assembly language file in our project:
if(UNIX) enable_language(ASM) # 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() set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> ${ASM_SYS_FLAGS} -o <OBJECT> <SOURCE>") endif() And this resulted in the appropriate 32-bit or 64-bit assembler file being compiled like so: /usr/bin/as -32 -o <path snipped>/i386.s.o <path-snipped>/i386.s /usr/bin/as -64 -o <path snipped>/iX86_64.s.o <path-snipped>/iX86_64.s Now with cmake 2.8.5 it fails when compiling that assembler file as it uses /usr/bin/gcc rather than /usr/bin/as and gcc wants -m32 and -c instead of -32. When I tried commenting out the line that overrides the default setting of CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT it fails differently: /usr/bin/gcc -DEXTERNAL_BUS_WIDTH=128 -DLINUX -DHIDEBUG -O3 -DNDEBUG -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 -c /user/grc/msvdx-cvsfiles/sim/msvdx-cmake-2.8.5/systemC/src/sysc/qt/md/i386.s i386.s:69: Error: suffix or operands invalid for `push' This line works if I add the -m32 option using set(CMAKE_ASM_FLAGS "-m32") but should all the preprocessor defines (-DXXX) and include directory arguments (-IXXX) be present ? I was thinking they were only for C/C++ files, no ? And what is the recommended way to compile an assembly language file that will work on both 2.8.4 and 2.8.5 ? -- Glenn
_______________________________________________ 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