BUG: fix handling of CXX
This commit is contained in:
parent
1a2a600a55
commit
9b14032ab4
|
@ -6,12 +6,21 @@
|
|||
# as a default compiler
|
||||
|
||||
IF(NOT CMAKE_C_COMPILER)
|
||||
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} ${CMAKE_GENERATOR_CC} gcc cc cl bcc )
|
||||
GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME)
|
||||
SET(CMAKE_C_COMPILER_LIST ${CMAKE_GENERATOR_CC} gcc cc cl bcc )
|
||||
IF($ENV{CC} MATCHES ".+")
|
||||
SET(CMAKE_C_COMPILER_LIST $ENV{CXX})
|
||||
ENDIF($ENV{CC} MATCHES ".+")
|
||||
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES ${CMAKE_C_COMPILER_LIST} )
|
||||
GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT
|
||||
${CMAKE_C_COMPILER_FULLPATH} NAME)
|
||||
# set this to notfound right after so that it is searched for each time this
|
||||
# file is included
|
||||
SET(CMAKE_C_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to c compiler" FORCE)
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING "C++ compiler")
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
|
||||
IF($ENV{CC} MATCHES ".+")
|
||||
IF(NOT CMAKE_C_COMPILER)
|
||||
MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}, make sure CC does not have flags in it, use CFLAGS instead.")
|
||||
ENDIF(NOT CMAKE_C_COMPILER)
|
||||
ENDIF($ENV{CC} MATCHES ".+")
|
||||
ENDIF(NOT CMAKE_C_COMPILER)
|
||||
MARK_AS_ADVANCED(CMAKE_C_COMPILER)
|
||||
FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /bin /usr/bin /usr/local/bin)
|
||||
|
@ -25,7 +34,7 @@ MARK_AS_ADVANCED(CMAKE_RANLIB)
|
|||
EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
|
||||
IF(NOT CMAKE_COMPILER_RETURN)
|
||||
IF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
|
||||
SET(CMAKE_COMPILER_IS_GNUGCC 1)
|
||||
SET(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
|
||||
ENDIF(NOT CMAKE_COMPILER_RETURN)
|
||||
|
||||
|
|
|
@ -6,9 +6,20 @@
|
|||
# as a default compiler
|
||||
|
||||
IF(NOT CMAKE_CXX_COMPILER)
|
||||
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc )
|
||||
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME)
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "C++ compiler")
|
||||
SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc )
|
||||
IF($ENV{CXX} MATCHES ".+")
|
||||
SET(CMAKE_CXX_COMPILER_LIST $ENV{CXX})
|
||||
ENDIF($ENV{CXX} MATCHES ".+")
|
||||
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES ${CMAKE_CXX_COMPILER_LIST})
|
||||
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT
|
||||
${CMAKE_CXX_COMPILER_FULLPATH} NAME)
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_INIT}
|
||||
CACHE STRING "C++ compiler")
|
||||
IF($ENV{CXX} MATCHES ".+")
|
||||
IF(NOT CMAKE_CXX_COMPILER)
|
||||
MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}, make sure CXX does not have flags in it, use CXXFLAGS instead.")
|
||||
ENDIF(NOT CMAKE_CXX_COMPILER)
|
||||
ENDIF($ENV{CXX} MATCHES ".+")
|
||||
ENDIF(NOT CMAKE_CXX_COMPILER)
|
||||
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)
|
||||
|
||||
|
|
Loading…
Reference in New Issue