summaryrefslogtreecommitdiff
path: root/Modules/CMakeCInformation.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-05 10:28:43 -0400
committerAlexander Neundorf <neundorf@kde.org>2007-06-05 10:28:43 -0400
commiteab5a4350d45fe228ad143cf481c52c26feacef3 (patch)
tree88282dc5469f70e84600628781ada218ac9a4042 /Modules/CMakeCInformation.cmake
parent6989f80026498fa24134143b30adf8a909aba51d (diff)
downloadcmake-eab5a4350d45fe228ad143cf481c52c26feacef3.tar.gz
ENH: also load a processor-specific file if exists
-also try the basename file if the compiler id file doesn't exist -don't rely so much on the CMAKE_TOOLCHAIN_FILE Alex
Diffstat (limited to 'Modules/CMakeCInformation.cmake')
-rw-r--r--Modules/CMakeCInformation.cmake41
1 files changed, 29 insertions, 12 deletions
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 5f73e6f468..9e0dda2ee2 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -2,22 +2,39 @@
# This file sets the basic flags for the C language in CMake.
# It also loads the available platform file for the system-compiler
# if it exists.
+# It also loads a system - compiler - processor (or target hardware)
+# specific file, which is mainly useful for crosscompiling and embedded systems.
-IF(NOT CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE)
- GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
- IF(CMAKE_COMPILER_IS_GNUCC)
- SET(CMAKE_BASE_NAME gcc)
- ENDIF(CMAKE_COMPILER_IS_GNUCC)
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_BASE_NAME gcc)
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE)
+ INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE} OPTIONAL)
+ELSE(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE)
IF(CMAKE_C_COMPILER_ID)
- IF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C.cmake)
- SET(CMAKE_BASE_NAME ${CMAKE_C_COMPILER_ID}-C)
- ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C.cmake)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
ENDIF(CMAKE_C_COMPILER_ID)
- SET(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE
- ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
-ENDIF(NOT CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE)
+ IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
+ ENDIF (NOT _INCLUDED_FILE)
+ENDIF(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE)
+
+
+IF(CMAKE_SYSTEM_AND_C_COMPILER_AND_PROCESSOR_INFO_FILE)
+ INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_AND_PROCESSOR_INFO_FILE} OPTIONAL)
+ELSE(CMAKE_SYSTEM_AND_C_COMPILER_AND_PROCESSOR_INFO_FILE)
+ IF(CMAKE_SYSTEM_PROCESSOR)
+ IF(CMAKE_C_COMPILER_ID)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
+ ENDIF(CMAKE_C_COMPILER_ID)
+ IF (NOT _INCLUDED_FILE)
+ INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ ENDIF (NOT _INCLUDED_FILE)
+ ENDIF(CMAKE_SYSTEM_PROCESSOR)
+ENDIF(CMAKE_SYSTEM_AND_C_COMPILER_AND_PROCESSOR_INFO_FILE)
-INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE} OPTIONAL)
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables