summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-02-11 22:01:02 (GMT)
committerBrad King <brad.king@kitware.com>2008-02-11 22:01:02 (GMT)
commitf0cee3fe4cfa485de4748fb0586f7fa3c3095657 (patch)
treea29b16402b1d6537e4483e6fde1f9be869525154 /Modules
parenta75079d9e08c0325a0165f2dbfc10e5c1fa61eec (diff)
downloadCMake-f0cee3fe4cfa485de4748fb0586f7fa3c3095657.zip
CMake-f0cee3fe4cfa485de4748fb0586f7fa3c3095657.tar.gz
CMake-f0cee3fe4cfa485de4748fb0586f7fa3c3095657.tar.bz2
ENH: Fix eCos.cmake to not require a forced compiler
- Search for libtarget.a explicitly - Do not complain about compiler id during try-compile
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/eCos.cmake24
1 files changed, 13 insertions, 11 deletions
diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake
index e7709cc..f0881c0 100644
--- a/Modules/Platform/eCos.cmake
+++ b/Modules/Platform/eCos.cmake
@@ -20,27 +20,29 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
INCLUDE(Platform/UnixPaths)
# eCos can be built only with gcc
-IF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+IF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
MESSAGE(FATAL_ERROR "GNU gcc is required for eCos")
-ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
-IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
- MESSAGE(FATAL_ERROR "GNU gcc is required for eCos")
-ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
+ MESSAGE(FATAL_ERROR "GNU g++ is required for eCos")
+ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC)
-# this is a header which is part of every eCos "installation"
-# it would be better to search for libtarget.a, but this isn't possible
-# at this point in the setup process, since CMAKE_SIZEOF_VOID_P is still
-# unknown, which is used in FIND_LIBRARY()
+# find eCos system files
FIND_PATH(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h)
+FIND_LIBRARY(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a)
IF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
MESSAGE(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.")
ENDIF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH)
-GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_CONFIG_HEADER_PATH}" PATH)
+IF(NOT ECOS_SYSTEM_TARGET_LIBRARY)
+ MESSAGE(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.")
+ENDIF(NOT ECOS_SYSTEM_TARGET_LIBRARY)
+
+GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH)
INCLUDE_DIRECTORIES(${ECOS_SYSTEM_CONFIG_HEADER_PATH})
ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
-SET(ECOS_LIBTARGET_DIRECTORY "${ECOS_LIBTARGET_DIRECTORY}/lib")
# special link commands for eCos executables
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>")