1 # support for eCos http://ecos.sourceware.org
2 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
3 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared
4 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
5 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
6 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
8 SET(CMAKE_LINK_LIBRARY_SUFFIX "")
9 SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
10 SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
11 SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
12 SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a
13 SET(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake
14 SET(CMAKE_DL_LIBS "" )
16 SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
17 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
20 INCLUDE(Platform/UnixPaths)
22 # eCos can be built only with gcc
23 IF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
24 MESSAGE(FATAL_ERROR "GNU gcc is required for eCos")
25 ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
26 IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
27 MESSAGE(FATAL_ERROR "GNU gcc is required for eCos")
28 ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
30 # this is a header which is part of every eCos "installation"
31 # it would be better to search for libtarget.a, but this isn't possible
32 # at this point in the setup process, since CMAKE_SIZEOF_VOID_P is still
33 # unknown, which is used in FIND_LIBRARY()
34 FIND_PATH(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h)
36 IF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
37 MESSAGE(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.")
38 ENDIF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
40 GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_CONFIG_HEADER_PATH}" PATH)
41 INCLUDE_DIRECTORIES(${ECOS_SYSTEM_CONFIG_HEADER_PATH})
42 ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
43 SET(ECOS_LIBTARGET_DIRECTORY "${ECOS_LIBTARGET_DIRECTORY}/lib")
45 # special link commands for eCos executables
46 SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>")
47 SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>")
49 # eCos doesn't support shared libs
50 SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
52 SET(CMAKE_CXX_LINK_SHARED_LIBRARY )
53 SET(CMAKE_CXX_LINK_MODULE_LIBRARY )
54 SET(CMAKE_C_LINK_SHARED_LIBRARY )
55 SET(CMAKE_C_LINK_MODULE_LIBRARY )