diff options
Diffstat (limited to 'Modules/CMakeDetermineCCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 4d7ced5..c085947 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -28,17 +28,18 @@ IF(NOT CMAKE_C_COMPILER) ENDIF(NOT CMAKE_C_COMPILER_INIT) ENDIF(CMAKE_GENERATOR_CC) - # if no compiler has been specified yet, then look for one - IF(NOT CMAKE_C_COMPILER_INIT) - # if not in the envionment then search for the compiler in the path - SET(CMAKE_C_COMPILER_LIST gcc cc cl bcc xlc) - FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES ${CMAKE_C_COMPILER_LIST} ) - GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT - ${CMAKE_C_COMPILER_FULLPATH} NAME) - SET(CMAKE_C_COMPILER_FULLPATH "${CMAKE_C_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found") - ENDIF(NOT CMAKE_C_COMPILER_INIT) + # finally list compilers to try + IF(CMAKE_C_COMPILER_INIT) + SET(CMAKE_C_COMPILER_LIST ${CMAKE_C_COMPILER_INIT}) + ELSE(CMAKE_C_COMPILER_INIT) + SET(CMAKE_C_COMPILER_LIST gcc cc cl bcc xlc) + ENDIF(CMAKE_C_COMPILER_INIT) - SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler") + # Find the compiler. + FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C compiler") + IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) + SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE) + ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) ENDIF(NOT CMAKE_C_COMPILER) MARK_AS_ADVANCED(CMAKE_C_COMPILER) GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_C_COMPILER}" |