[CMake] Slash, Backslash trouble with MSYS and Windows Compiler/Linker

Matthias Goesswein tisi at sbox.tugraz.at
Tue Apr 20 07:09:17 EDT 2010


Hello!

I`m using the Softune-Compiler under CMake with MSYS on Windows. (I'v e 
written the Plattform files by myself)
The Softune Compiler (For Fujitsu Microcontrollers) requires Backslashes 
for paths in the options, but Cmake generates slashes as it is usual in 
MSYS.

e.g.

The linker must be called:

flnk907s -cpu MB90F345 -a -o otuput.abs main.o -l mylibrary\mylibrary.a

(it finds the library in the directory mylibrary)

but it is called like this

flnk907s -cpu MB90F345 -a -o output.abs main.o -l mylibrary/mylibrary.a

(it doesn't find the library in the directory mylibrary)

Is there any option to change the slashes with cmake to backslashes?

---
My Plattform file for the compiler looks like this:


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

# This file implements support for the Softune Compiler

SET(CMAKE_STATIC_LIBRARY_PREFIX "")
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
SET(CMAKE_C_OUTPUT_EXTENSION ".o")
SET(CMAKE_EXECUTABLE_SUFFIX ".abs")
SET(CMAKE_LINK_LIBRARY_SUFFIX ".a")
SET(CMAKE_LINK_LIBRARY_FILE_FLAG "-l")

# Default C Flags
SET(CMAKE_C_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_C_FLAGS_DEBUG_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g -DDEBUG=1")
SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_C_FLAGS_RELEASE_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g 
-DDEBUG=1")

# Default Linker Flags
SET (CMAKE_EXE_LINKER_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a")
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} 
-a -g")
SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR}  -a")
SET (CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} 
  -a")
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-cpu 
${CMAKE_SYSTEM_PROCESSOR} -a -g")

# Rule variable to compile a single object file
SET(CMAKE_C_COMPILE_OBJECT
        "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> <SOURCE>" )

# Rule variable to create a static library
SET(CMAKE_C_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_C_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_C_CREATE_SHARED_LIBRARY "")
SET(CMAKE_C_CREATE_MODULE_LIBRARY "")

---

Another question: Are such plattform ports welcome in the cmake 
distribution? If yes, I'll put it in as feature request, when my port is 
functional.
BTW: Are there any naming conventions for new plattforms?

Cheers,
Matthias.


More information about the CMake mailing list