Detect a COMPILER_ID also for ASM.
For assembler, the "compiler ID" cannot be detected by "compiling" a source file, since there is not source file all assemblers understand. Instead the function CMAKE_DETERMINE_COMPILER_ID_VENDOR() is used to run the assembler and check its output. For this the CMAKE_DETERMINE_COMPILER_ID_VENDOR() function had to be extended so that it creates the run directory if it doesn't exist yet. In CMakeASMInformation.cmake now also CMAKE_ASM_COMPILER_ID is used (but there are no such files yet, will come with the support for the IAR toolchain). Alex
This commit is contained in:
parent
691fc2baa8
commit
b333779e34
|
@ -28,18 +28,25 @@ IF("${CMAKE_BASE_NAME}" STREQUAL "as")
|
||||||
SET(CMAKE_BASE_NAME gas)
|
SET(CMAKE_BASE_NAME gas)
|
||||||
ENDIF("${CMAKE_BASE_NAME}" STREQUAL "as")
|
ENDIF("${CMAKE_BASE_NAME}" STREQUAL "as")
|
||||||
|
|
||||||
INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
|
# Load compiler-specific information.
|
||||||
|
SET(_INCLUDED_FILE "")
|
||||||
IF(CMAKE_SYSTEM_PROCESSOR)
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||||
ENDIF(CMAKE_SYSTEM_PROCESSOR)
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
IF(NOT _INCLUDED_FILE)
|
IF(NOT _INCLUDED_FILE)
|
||||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
|
||||||
ENDIF(NOT _INCLUDED_FILE)
|
ENDIF(NOT _INCLUDED_FILE)
|
||||||
|
|
||||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
IF(CMAKE_SYSTEM_PROCESSOR)
|
||||||
|
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||||
|
IF(NOT _INCLUDED_FILE)
|
||||||
|
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||||
|
ENDIF(NOT _INCLUDED_FILE)
|
||||||
|
ENDIF(CMAKE_SYSTEM_PROCESSOR)
|
||||||
|
|
||||||
|
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||||
IF(NOT _INCLUDED_FILE)
|
IF(NOT _INCLUDED_FILE)
|
||||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL)
|
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
|
||||||
ENDIF(NOT _INCLUDED_FILE)
|
ENDIF(NOT _INCLUDED_FILE)
|
||||||
|
|
||||||
# Set default assembler file extensions:
|
# Set default assembler file extensions:
|
||||||
|
|
|
@ -57,6 +57,25 @@ IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||||
GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
||||||
ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||||
|
|
||||||
|
|
||||||
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
|
||||||
|
# Table of per-vendor compiler id flags with expected output.
|
||||||
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
||||||
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler")
|
||||||
|
|
||||||
|
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
||||||
|
|
||||||
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||||
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
||||||
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
# If we have a gas/as cross compiler, they have usually some prefix, like
|
# If we have a gas/as cross compiler, they have usually some prefix, like
|
||||||
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas .
|
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas .
|
||||||
# The other tools of the toolchain usually have the same prefix
|
# The other tools of the toolchain usually have the same prefix
|
||||||
|
|
|
@ -261,6 +261,17 @@ ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang)
|
||||||
# We try running the compiler with the flag for each vendor and
|
# We try running the compiler with the flag for each vendor and
|
||||||
# matching its regular expression in the output.
|
# matching its regular expression in the output.
|
||||||
FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
|
FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
|
||||||
|
|
||||||
|
IF(NOT CMAKE_${lang}_COMPILER_ID_DIR)
|
||||||
|
# We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID()
|
||||||
|
# This is done e.g. for detecting the compiler ID for assemblers.
|
||||||
|
# Compute the directory in which to run the test and Create a clean working directory.
|
||||||
|
SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
|
||||||
|
FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||||
|
FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||||
|
ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR)
|
||||||
|
|
||||||
|
|
||||||
FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
|
FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
|
||||||
SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
|
SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
|
||||||
SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
|
SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
|
||||||
|
|
Loading…
Reference in New Issue