diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 12 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 9 | ||||
-rw-r--r-- | Modules/CMakeTestGNU.c | 3 | ||||
-rw-r--r-- | Modules/Windows.cmake | 4 |
4 files changed, 24 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index c1fc85c..1035f1b 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -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 diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 72ee90a..5b09e85 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -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) diff --git a/Modules/CMakeTestGNU.c b/Modules/CMakeTestGNU.c new file mode 100644 index 0000000..1cd5624 --- /dev/null +++ b/Modules/CMakeTestGNU.c @@ -0,0 +1,3 @@ +#ifdef __GNUC__ +THIS_IS_GNU +#endif diff --git a/Modules/Windows.cmake b/Modules/Windows.cmake new file mode 100644 index 0000000..0c1fa6c --- /dev/null +++ b/Modules/Windows.cmake @@ -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") |