test for gnu compiler

This commit is contained in:
Bill Hoffman 2002-10-22 18:17:07 -04:00
parent 0692323fe0
commit da460f9008
4 changed files with 24 additions and 4 deletions

View File

@ -4,8 +4,12 @@
FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} gcc cc cl bcc PATHS /bin /usr/bin /usr/local/bin )
# test to see if the c compiler is gnu
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)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
# to check for is gnu we need to compile this:
# #ifdef __GNUC__
# yes;
# #endif

View File

@ -3,3 +3,12 @@
# loading this file to force a compiler.
FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ CC aCC cl bcc PATHS /bin /usr/bin /usr/local/bin )
# test to see if the cxx compiler is gnu
EXEC_PROGRAM(${CMAKE_CXX_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_GNUGXX 1)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)

3
Modules/CMakeTestGNU.c Normal file
View File

@ -0,0 +1,3 @@
#ifdef __GNUC__
THIS_IS_GNU
#endif

4
Modules/Windows.cmake Normal file
View File

@ -0,0 +1,4 @@
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "")
SET(CMAKE_DL_LIBS "" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")