diff options
-rw-r--r-- | Modules/CMakeDetermineASMCompiler.cmake | 5 | ||||
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompiler.cmake | 6 | ||||
-rw-r--r-- | Modules/CMakeDetermineFortranCompiler.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/CYGWIN-CXX.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/Darwin-CXX.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/Linux-CXX.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-CXX.cmake | 7 |
9 files changed, 51 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index a56020f..7da6ac0 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -33,8 +33,9 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") ELSE() # List all default C and CXX compilers - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc - ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST + ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc + CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC) ENDIF() ENDIF() ELSE() # some specific assembler "dialect" diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 9ebf0b3..3ce968c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -33,6 +33,12 @@ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +# Load system-specific compiler preferences for this language. +INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-C OPTIONAL) +IF(NOT CMAKE_C_COMPILER_NAMES) + SET(CMAKE_C_COMPILER_NAMES cc) +ENDIF() + IF(NOT CMAKE_C_COMPILER) SET(CMAKE_C_COMPILER_INIT NOTFOUND) @@ -56,7 +62,7 @@ IF(NOT CMAKE_C_COMPILER) # finally list compilers to try IF(NOT CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc clang) + SET(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) ENDIF() _cmake_find_compiler(C) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 43b44ac..0116d34 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -32,6 +32,12 @@ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +# Load system-specific compiler preferences for this language. +INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL) +IF(NOT CMAKE_CXX_COMPILER_NAMES) + SET(CMAKE_CXX_COMPILER_NAMES CC) +ENDIF() + IF(NOT CMAKE_CXX_COMPILER) SET(CMAKE_CXX_COMPILER_INIT NOTFOUND) @@ -55,7 +61,7 @@ IF(NOT CMAKE_CXX_COMPILER) # finally list compilers to try IF(NOT CMAKE_CXX_COMPILER_INIT) - SET(CMAKE_CXX_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC clang++) + SET(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) ENDIF() _cmake_find_compiler(CXX) diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index 55d554b..2d12c07 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -29,10 +29,16 @@ macro(_cmake_find_compiler lang) list(APPEND CMAKE_${lang}_COMPILER_LIST ${_${lang}_COMPILER_NAMES_${CMAKE_${l}_COMPILER_ID}}) endforeach() + # Prefer vendors based on the platform. + list(APPEND CMAKE_${lang}_COMPILER_LIST ${CMAKE_${lang}_COMPILER_NAMES}) # Append the rest of the list and remove duplicates. list(APPEND CMAKE_${lang}_COMPILER_LIST ${_${lang}_COMPILER_LIST}) unset(_${lang}_COMPILER_LIST) list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_LIST) + if(CMAKE_${lang}_COMPILER_EXCLUDE) + list(REMOVE_ITEM CMAKE_${lang}_COMPILER_LIST + ${CMAKE_${lang}_COMPILER_EXCLUDE}) + endif() endif() # Look for directories containing compilers of reference languages. diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 6d6990e..45033c2 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -20,6 +20,10 @@ # as a default compiler INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) +INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL) +IF(NOT CMAKE_Fortran_COMPILER_NAMES) + SET(CMAKE_Fortran_COMPILER_NAMES f95) +ENDIF() IF(NOT CMAKE_Fortran_COMPILER) # prefer the environment variable CC diff --git a/Modules/Platform/CYGWIN-CXX.cmake b/Modules/Platform/CYGWIN-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/CYGWIN-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Darwin-CXX.cmake b/Modules/Platform/Darwin-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/Darwin-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) diff --git a/Modules/Platform/Linux-CXX.cmake b/Modules/Platform/Linux-CXX.cmake new file mode 100644 index 0000000..b594dae --- /dev/null +++ b/Modules/Platform/Linux-CXX.cmake @@ -0,0 +1,3 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() diff --git a/Modules/Platform/Windows-CXX.cmake b/Modules/Platform/Windows-CXX.cmake new file mode 100644 index 0000000..bf37f79 --- /dev/null +++ b/Modules/Platform/Windows-CXX.cmake @@ -0,0 +1,7 @@ +if(NOT CMAKE_CXX_COMPILER_NAMES) + set(CMAKE_CXX_COMPILER_NAMES c++) +endif() + +# Exclude C++ compilers differing from C compiler only by case +# because this platform may have a case-insensitive filesystem. +set(CMAKE_CXX_COMPILER_EXCLUDE CC aCC xlC) |