diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-26 17:19:46 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-26 17:19:46 (GMT) |
commit | cd8687782b8ff4ee991daa677d04f885bb37d274 (patch) | |
tree | 6118e7ab3a9070311f3988345754b34e17ea15a1 /Modules/Platform/Generic-SDCC-C.cmake | |
parent | f8261ff9f7085b8931da08a034569d81f87e83a5 (diff) | |
download | CMake-cd8687782b8ff4ee991daa677d04f885bb37d274.zip CMake-cd8687782b8ff4ee991daa677d04f885bb37d274.tar.gz CMake-cd8687782b8ff4ee991daa677d04f885bb37d274.tar.bz2 |
ENH: add basic support for sdcc (http://sdcc.sourceforge.net), needs sdcc (sdcclib) cvs for creating libraries)
Alex
Diffstat (limited to 'Modules/Platform/Generic-SDCC-C.cmake')
-rw-r--r-- | Modules/Platform/Generic-SDCC-C.cmake | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake new file mode 100644 index 0000000..37eb0d6 --- /dev/null +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -0,0 +1,45 @@ + +# This file implements basic support for sdcc (http://sdcc.sourceforge.net/) +# a free C compiler for 8 and 16 bit microcontrollers. +# To use it either a toolchain file is required or cmake has to be run like this: +# cmake -DCMAKE_C_COMPILER=sdcc -DCMAKE_SYSTEM_NAME=Generic <dir...> +# Since sdcc doesn't support C++, C++ support should be disabled in the +# CMakeLists.txt using the PROJECT() command: +# PROJECT(my_project C) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX ) +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ) +SET(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_C_OUTPUT_EXTENSION ".rel") + +# find sdcclib as CMAKE_AR +# since cmake may already have searched for "ar", sdcclib has to +# be searched with a different variable name (SDCCLIB_EXECUTABLE) +# and must then be forced into the cache +GET_FILENAME_COMPONENT(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH) +FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH) +FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib) +SET(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) + +# compile a C file into an object file +SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <FLAGS> -o <OBJECT> -c <SOURCE>") + +# link object files to an executable +SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>") + +# needs sdcc 2.7.0 + sddclib from cvs +SET(CMAKE_C_CREATE_STATIC_LIBRARY + "${CMAKE_COMMAND} -E remove <TARGET>" + "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ") + +# not supported by sdcc +SET(CMAKE_C_CREATE_SHARED_LIBRARY "") +SET(CMAKE_C_CREATE_MODULE_LIBRARY "") + |