diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-09-22 18:42:05 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-09-22 18:42:05 (GMT) |
commit | 692ba48c4e5762b370f2999e902b8bd677c77161 (patch) | |
tree | 0c9465d0e38a15bd0cb043f234b4e4ab0cee51a2 /Modules/CMakeDetermineRCCompiler.cmake | |
parent | 597185754420db18d83b2c9e3b9f1e33675bd935 (diff) | |
download | CMake-692ba48c4e5762b370f2999e902b8bd677c77161.zip CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.gz CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.bz2 |
ENH: major changes to support addition of languages from cmake modules directory.
Diffstat (limited to 'Modules/CMakeDetermineRCCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineRCCompiler.cmake | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake new file mode 100644 index 0000000..7db2ec2 --- /dev/null +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -0,0 +1,44 @@ +# determine the compiler to use for C programs +# NOTE, a generator may set CMAKE_C_COMPILER before +# loading this file to force a compiler. +# use environment variable CCC first if defined by user, next use +# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator +# as a default compiler +IF(NOT CMAKE_RC_COMPILER) + # prefer the environment variable CC + IF($ENV{RC} MATCHES ".+") + GET_FILENAME_COMPONENT(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT) + IF(EXISTS ${CMAKE_RC_COMPILER_INIT}) + ELSE(EXISTS ${CMAKE_RC_COMPILER_INIT}) + MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable RC:\n$ENV{RC}.") + ENDIF(EXISTS ${CMAKE_RC_COMPILER_INIT}) + ENDIF($ENV{RC} MATCHES ".+") + + # next try prefer the compiler specified by the generator + IF(CMAKE_GENERATOR_RC) + IF(NOT CMAKE_RC_COMPILER_INIT) + SET(CMAKE_RC_COMPILER_INIT ${CMAKE_GENERATOR_RC}) + ENDIF(NOT CMAKE_RC_COMPILER_INIT) + ENDIF(CMAKE_GENERATOR_RC) + + + # if no compiler has been specified yet, then look for one + IF(NOT CMAKE_RC_COMPILER_INIT) + SET(CMAKE_RC_COMPILER_LIST rc) + FIND_PROGRAM(CMAKE_RC_COMPILER_FULLPATH NAMES ${CMAKE_RC_COMPILER_LIST} ) + GET_FILENAME_COMPONENT(CMAKE_RC_COMPILER_INIT + ${CMAKE_RC_COMPILER_FULLPATH} NAME) + SET(CMAKE_RC_COMPILER_FULLPATH "${CMAKE_RC_COMPILER_FULLPATH}" + CACHE INTERNAL "full path to the compiler cmake found") + ENDIF(NOT CMAKE_RC_COMPILER_INIT) + + SET(CMAKE_RC_COMPILER ${CMAKE_RC_COMPILER_INIT} CACHE STRING "RC compiler") +ENDIF(NOT CMAKE_RC_COMPILER) + +MARK_AS_ADVANCED(CMAKE_RC_COMPILER) + + +# configure variables set in this file for fast reload later on +CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in + ${CMAKE_BINARY_DIR}/CMakeRCCompiler.cmake IMMEDIATE) +SET(CMAKE_RC_COMPILER_ENV_VAR "RC") |