Compiler: Add infrastructure for detecting compiler wrappers
This commit is contained in:
parent
4e29a514ad
commit
5eaac0c96a
|
@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
|
|||
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
|
||||
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
|
||||
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
# It also loads a system - compiler - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# some compilers use different extensions (e.g. sdcc uses .rel)
|
||||
# so set the extension here first so it can be overridden by the compiler specific file
|
||||
if(UNIX)
|
||||
|
@ -60,6 +62,12 @@ if (NOT _INCLUDED_FILE)
|
|||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_C_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(C)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
|
|
|
@ -2,6 +2,7 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
|
|||
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
|
||||
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
|
||||
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
|
||||
set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@")
|
||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
# It also loads a system - compiler - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# some compilers use different extensions (e.g. sdcc uses .rel)
|
||||
# so set the extension here first so it can be overridden by the compiler specific file
|
||||
if(UNIX)
|
||||
|
@ -59,6 +61,12 @@ if (NOT _INCLUDED_FILE)
|
|||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
|
||||
RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_CXX_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(CXX)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
|
|
|
@ -107,6 +107,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
|
|||
PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
|
||||
|
@ -435,6 +436,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
|||
set(HAVE_COMPILER_VERSION_MINOR 0)
|
||||
set(HAVE_COMPILER_VERSION_PATCH 0)
|
||||
set(HAVE_COMPILER_VERSION_TWEAK 0)
|
||||
set(COMPILER_WRAPPER)
|
||||
set(DIGIT_VALUE_1 1)
|
||||
set(DIGIT_VALUE_2 10)
|
||||
set(DIGIT_VALUE_3 100)
|
||||
|
@ -476,6 +478,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
|||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]")
|
||||
set(COMPILER_WRAPPER "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]")
|
||||
set(SIMULATE_ID "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
|
@ -588,6 +593,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
|||
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
|
||||
PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
|
||||
|
|
|
@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@")
|
|||
set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@")
|
||||
set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
|
||||
set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@")
|
||||
set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@")
|
||||
set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@")
|
||||
set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@")
|
||||
set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@")
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# This file sets the basic flags for the Fortran language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
|
@ -36,6 +38,12 @@ if (NOT _INCLUDED_FILE)
|
|||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
|
||||
RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_Fortran_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(Fortran)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2015 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This file contains common code blocks used by all the language information
|
||||
# files
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
macro(__cmake_include_compiler_wrapper lang)
|
||||
set(_INCLUDED_WRAPPER_FILE 0)
|
||||
if (CMAKE_${lang}_COMPILER_ID)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_WRAPPER_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif ()
|
||||
|
||||
# No platform - wrapper - lang information so maybe there's just wrapper - lang information
|
||||
if(NOT _INCLUDED_WRAPPER_FILE)
|
||||
if (CMAKE_${lang}_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_WRAPPER_FILE)
|
||||
include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro ()
|
Loading…
Reference in New Issue