[CMake] Assembler flag support

Matthias Goesswein tisi at sbox.tugraz.at
Fri Apr 16 12:30:24 EDT 2010


Hello!

>> Is there a variable like CMAKE_C_FLAGS_INIT for the assembler available?
>> (e.g. CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
> Did you try this one ?
> I didn't add any explicit support for that, but I think this should work 
> autoamtically for any language support by cmake (if it doesn't, I'll fix it 
> for ASM).

Yes, I tried that. Just for reference, my plattform file looks like this:

---

MESSAGE(STATUS "Fujitsu_16LX-fasm907s.cmake loaded")

SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSION ".s")
SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION ".o")
SET(CMAKE_EXECUTABLE_SUFFIX ".abs")
SET(CMAKE_LINK_LIBRARY_SUFFIX ".a")
SET(CMAKE_LINK_LIBRARY_FILE_FLAG "-l")

SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_ASM${ASM_DIALECT}_DEBUG_FLAGS_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR} -g")
SET(CMAKE_ASM${ASM_DIALECT}_MINSIZEREL_FLAGS_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_ASM${ASM_DIALECT}_RELEASE_FLAGS_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_ASM${ASM_DIALECT}_RELWITHDEBINFO_FLAGS_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR} -g")

# Rule variable to compile a single object file
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT
     "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")

# Rule variable to create a static library
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
       "${CMAKE_COMMAND} -E remove <TARGET>"
       "flib907s -cpu ${CMAKE_SYSTEM_PROCESSOR} -g -a <OBJECTS> <TARGET>")

# Rule variable to link a axecutable
SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
        "flnk907s <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> -o <TARGET> 
<OBJECTS> <LINK_LIBRARIES>"
        "f2ms -S3 -o <TARGET_BASE>.s19 -adjust <TARGET>")

# not supported
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY "")
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_MODULE_LIBRARY "")

---

Without the -cpu option, the assembler can't assemble a file. So i tried 
to set the flags within the INIT-Variables, but when i run make (I use 
MSYS Makefiles), the assembler is called without the -cpu command line 
option (snipped of the output of make VERBOSE=1):

cd /C/Projekte/Software/Gen/Src/Processor && 
/C/Projekte/Tools/Softune/V30/bin/FASM907S.EXE 
-I/C/Projekte/Software/Src/Generic -I/C/Projekte/Software/Src/Processor
-I/C/Projekte/Software/Src/Main   -o 
CMakeFiles/lib_processor.dir/MB90340.s.o 
/C/Projekte/Software/Src/Processor/MB90340.s

Cheers,
Matthias.


More information about the CMake mailing list