summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCompilerIdDetection.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-07 10:25:39 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-07 12:28:36 (GMT)
commit3b59f8b7c68127c649fd72983e6f0a24cbb51427 (patch)
tree3b11bd7ef31003468c0b94326d844ce33e60e5bd /Modules/CMakeCompilerIdDetection.cmake
parent8896501b236258f6908a59eb81f49983892bdcff (diff)
downloadCMake-3b59f8b7c68127c649fd72983e6f0a24cbb51427.zip
CMake-3b59f8b7c68127c649fd72983e6f0a24cbb51427.tar.gz
CMake-3b59f8b7c68127c649fd72983e6f0a24cbb51427.tar.bz2
Project: Refactor C compiler determination into multiple files.
Diffstat (limited to 'Modules/CMakeCompilerIdDetection.cmake')
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake41
1 files changed, 32 insertions, 9 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index f0e39ad..d8a0d67 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -24,15 +24,20 @@ include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
function(compiler_id_detection outvar lang)
- file(GLOB lang_files
- "${CMAKE_ROOT}/Modules/Compiler/*-${lang}-DetermineCompiler.cmake")
-
if (NOT lang STREQUAL Fortran)
- file(GLOB non_lang_files
+ file(GLOB lang_files
"${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
+ set(nonlang CXX)
+ if (lang STREQUAL CXX)
+ set(nonlang C)
+ endif()
+
+ file(GLOB nonlang_files
+ "${CMAKE_ROOT}/Modules/Compiler/*-${nonlang}-DetermineCompiler.cmake")
+ list(REMOVE_ITEM lang_files ${nonlang_files})
endif()
- set(files ${lang_files} ${non_lang_files})
+ set(files ${lang_files})
if (files)
foreach(file ${files})
_readFile(${file})
@@ -45,10 +50,14 @@ function(compiler_id_detection outvar lang)
message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
endif()
- set(ordered_compilers
- # Order is relevant here. For example, compilers which pretend to be
- # GCC must appear before the actual GCC.
- Comeau
+ # Order is relevant here. For example, compilers which pretend to be
+ # GCC must appear before the actual GCC.
+ if (lang STREQUAL CXX)
+ list(APPEND ordered_compilers
+ Comeau
+ )
+ endif()
+ list(APPEND ordered_compilers
Intel
PathScale
AppleClang
@@ -66,11 +75,25 @@ function(compiler_id_detection outvar lang)
PGI
Cray
TI
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ TinyCC
+ )
+ endif()
+ list(APPEND ordered_compilers
SCO
GNU
MSVC
ADSP
IAR
+ )
+ if (lang STREQUAL C)
+ list(APPEND ordered_compilers
+ SDCC
+ )
+ endif()
+ list(APPEND ordered_compilers
MIPSpro)
if(CID_ID_DEFINE)