Previously with cmake 2.8.4 we were using these lines to compile an assembly language file in our project:<br><br>if(UNIX)<br> enable_language(ASM)<br><br># see if we are building 32-bit or 64-bit executables<br> file(WRITE ${CMAKE_BINARY_DIR}/check_32or64bit.cpp "int main(int argc, char *argv[]) { return 8 * sizeof(char *); }\n")<br>
<br> try_run(<br> run_result<br> compile_result<br> ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/check_32or64bit.cpp<br> )<br> <br> if (${run_result} EQUAL 32)<br> list(APPEND sources "src/sysc/qt/md/i386.s")<br>
if(APPLE)<br> set(ASM_SYS_FLAGS "-arch i386")<br> else()<br> set(ASM_SYS_FLAGS "-32")<br> endif()<br> else()<br> list(APPEND sources "src/sysc/qt/md/iX86_64.s")<br>
if(APPLE)<br> set(ASM_SYS_FLAGS "-arch x86_64")<br> else()<br> set(ASM_SYS_FLAGS "-64")<br> endif()<br> endif()<br><br> set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> ${ASM_SYS_FLAGS} -o <OBJECT> <SOURCE>")<br>
endif()<br><br>And this resulted in the appropriate 32-bit or 64-bit assembler file being compiled like so:<br><br> /usr/bin/as -32 -o <path snipped>/i386.s.o <path-snipped>/i386.s<br>
/usr/bin/as -64 -o <path snipped>/iX86_64.s.o <path-snipped>/iX86_64.s<br><br>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:<br>
<br>/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<br>
<br>i386.s:69: Error: suffix or operands invalid for `push'<br>
<br>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 ?<br>
<br>And what is the recommended way to compile an assembly language file that will work on both 2.8.4 and 2.8.5 ?<br><br>--<br>Glenn<br><br>