diff options
Diffstat (limited to 'Modules/CMakeCInformation.cmake')
-rw-r--r-- | Modules/CMakeCInformation.cmake | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 5f73e6f..9e0dda2 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 |