From 44ab336a0c4afe9dab6e7d038aec9a27c7ee92c7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 May 2007 08:24:32 -0400 Subject: ENH: Merging CompilerId updates from branch CMake-Modules-CompilerId to the main tree. Changes between CMake-Modules-CompilerId-mp1 and CMake-Modules-CompilerId-mp2 are included. --- Modules/CMakeCInformation.cmake | 5 ++ Modules/CMakeCXXInformation.cmake | 9 +++- Modules/CMakeDetermineCCompiler.cmake | 2 +- Modules/CMakeDetermineCXXCompiler.cmake | 2 +- Modules/CMakeDetermineCompilerId.cmake | 15 +++--- Modules/CMakeDetermineFortranCompiler.cmake | 84 ++++++++++++++++++----------- Modules/CMakeFortranCompiler.cmake.in | 7 ++- Modules/CMakeFortranCompilerId.F90 | 76 ++++++++++++++++++++++++++ Modules/CMakeFortranInformation.cmake | 9 +++- Modules/Platform/Linux-SunPro-C.cmake | 24 +++++++++ Modules/Platform/Linux-SunPro-CXX.cmake | 24 +++++++++ Modules/Platform/Linux-SunPro-Fortran.cmake | 14 +++++ 12 files changed, 224 insertions(+), 47 deletions(-) create mode 100644 Modules/CMakeFortranCompilerId.F90 create mode 100644 Modules/Platform/Linux-SunPro-C.cmake create mode 100644 Modules/Platform/Linux-SunPro-CXX.cmake create mode 100644 Modules/Platform/Linux-SunPro-Fortran.cmake diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 230d49e..10ec1e7 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -7,6 +7,11 @@ GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_BASE_NAME gcc) ENDIF(CMAKE_COMPILER_IS_GNUCC) +IF(CMAKE_C_COMPILER_ID) + IF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C.cmake) + SET(CMAKE_BASE_NAME ${CMAKE_C_COMPILER_ID}-C) + ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C.cmake) +ENDIF(CMAKE_C_COMPILER_ID) SET(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 4e03bf3..ef1b07e 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -8,6 +8,11 @@ GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_BASE_NAME g++) ENDIF(CMAKE_COMPILER_IS_GNUCXX) +IF(CMAKE_CXX_COMPILER_ID) + IF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX.cmake) + SET(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER_ID}-CXX) + ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX.cmake) +ENDIF(CMAKE_CXX_COMPILER_ID) SET(CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) @@ -43,9 +48,9 @@ IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) -IF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) +ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index eb79148..d80452f 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -68,7 +68,7 @@ IF(NOT CMAKE_C_COMPILER_ID_RUN) # Try to identify the compiler. SET(CMAKE_C_COMPILER_ID) INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) - CMAKE_DETERMINE_COMPILER_ID(C ${CMAKE_ROOT}/Modules/CMakeCCompilerId.c) + CMAKE_DETERMINE_COMPILER_ID(C CFLAGS ${CMAKE_ROOT}/Modules/CMakeCCompilerId.c) # Set old compiler and platform id variables. IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 372d27b..4ba152a 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -88,7 +88,7 @@ IF(NOT CMAKE_CXX_COMPILER_ID_RUN) # Try to identify the compiler. SET(CMAKE_CXX_COMPILER_ID) INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) - CMAKE_DETERMINE_COMPILER_ID(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerId.cpp) + CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS ${CMAKE_ROOT}/Modules/CMakeCXXCompilerId.cpp) # Set old compiler and platform id variables. IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 5b7d933..9a06acf 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -3,7 +3,7 @@ # used internally by CMake and should not be included by user code. # If successful, sets CMAKE__COMPILER_ID and CMAKE__PLATFORM_ID -MACRO(CMAKE_DETERMINE_COMPILER_ID lang src) +MACRO(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Store the compiler identification source file. SET(CMAKE_${lang}_COMPILER_ID_SRC "${src}") IF(WIN32 AND NOT CYGWIN) @@ -18,7 +18,7 @@ MACRO(CMAKE_DETERMINE_COMPILER_ID lang src) IF(CMAKE_${lang}_FLAGS) SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) ELSE(CMAKE_${lang}_FLAGS) - SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${lang}FLAGS}) + SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) ENDIF(CMAKE_${lang}_FLAGS) # Create an empty directory in which to run the test. @@ -81,13 +81,14 @@ MACRO(CMAKE_DETERMINE_COMPILER_ID lang src) FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE} CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:") FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) - IF("${info}" MATCHES ".*INFO:compiler\\[(.*)\\].*") - STRING(REGEX REPLACE ".*INFO:compiler\\[(.*)\\].*" "\\1" + IF("${info}" MATCHES ".*INFO:compiler\\[([^]]*)\\].*") + STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" CMAKE_${lang}_COMPILER_ID "${info}") - ELSEIF("${info}" MATCHES ".*INFO:platform\\[(.*)\\].*") - STRING(REGEX REPLACE ".*INFO:platform\\[(.*)\\].*" "\\1" + ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]]*)\\].*") + IF("${info}" MATCHES ".*INFO:platform\\[([^]]*)\\].*") + STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" CMAKE_${lang}_PLATFORM_ID "${info}") - ENDIF("${info}" MATCHES ".*INFO:compiler\\[(.*)\\].*") + ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]]*)\\].*") ENDFOREACH(info) # Check the compiler identification string. diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 12068e4..15f66f9 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -74,41 +74,61 @@ IF(NOT CMAKE_RANLIB) ENDIF(NOT CMAKE_RANLIB) MARK_AS_ADVANCED(CMAKE_RANLIB) -# do not test for GNU if the generator is visual studio +# Build a small source file to identify the compiler. IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") - SET(CMAKE_COMPILER_IS_GNUG77_RUN 1) -ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") + SET(CMAKE_Fortran_COMPILER_ID_RUN 1) + SET(CMAKE_Fortran_PLATFORM_ID "Windows") -IF(NOT CMAKE_COMPILER_IS_GNUG77_RUN) - # test to see if the Fortran compiler is gnu - - IF(CMAKE_Fortran_FLAGS) - SET(CMAKE_BOOT_Fortran_FLAGS ${CMAKE_Fortran_FLAGS}) - ELSE(CMAKE_Fortran_FLAGS) - SET(CMAKE_BOOT_Fortran_FLAGS $ENV{FFLAGS}) - ENDIF(CMAKE_Fortran_FLAGS) - EXEC_PROGRAM(${CMAKE_Fortran_COMPILER} ARGS ${CMAKE_BOOT_Fortran_FLAGS} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN) - SET(CMAKE_COMPILER_IS_GNUG77_RUN 1) - IF(NOT CMAKE_COMPILER_RETURN) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - SET(CMAKE_COMPILER_IS_GNUG77 1) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler is GNU succeeded with " - "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") - ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler is GNU failed with " - "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - SET(CMAKE_COMPILER_IS_MINGW 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - ENDIF(NOT CMAKE_COMPILER_RETURN) -ENDIF(NOT CMAKE_COMPILER_IS_GNUG77_RUN) + # TODO: Set the compiler id. It is probably MSVC but + # the user may be using an integrated Intel compiler. + # SET(CMAKE_Fortran_COMPILER_ID "MSVC") +ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") + +IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) + SET(CMAKE_Fortran_COMPILER_ID_RUN 1) + + # Try to identify the compiler. + SET(CMAKE_Fortran_COMPILER_ID) + INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS ${CMAKE_ROOT}/Modules/CMakeFortranCompilerId.F90) + + # Fall back to old is-GNU test. + IF(NOT CMAKE_Fortran_COMPILER_ID) + EXEC_PROGRAM(${CMAKE_Fortran_COMPILER} + ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -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_Fortran_COMPILER_ID "GNU") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler is GNU succeeded with " + "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") + ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler is GNU failed with " + "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) + IF(NOT CMAKE_Fortran_PLATFORM_ID) + IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + SET(CMAKE_Fortran_PLATFORM_ID "MinGW") + ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + SET(CMAKE_Fortran_PLATFORM_ID "Cygwin") + ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + ENDIF(NOT CMAKE_Fortran_PLATFORM_ID) + ENDIF(NOT CMAKE_COMPILER_RETURN) + ENDIF(NOT CMAKE_Fortran_COMPILER_ID) + # Set old compiler and platform id variables. + IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + SET(CMAKE_COMPILER_IS_GNUG77 1) + ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + IF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") + SET(CMAKE_COMPILER_IS_MINGW 1) + ELSEIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin") + SET(CMAKE_COMPILER_IS_CYGWIN 1) + ENDIF("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") +ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN) # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index a97717a..a4f3941 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -1,5 +1,7 @@ SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") +SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") +SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) @@ -11,10 +13,12 @@ IF(CMAKE_COMPILER_IS_CYGWIN) SET(UNIX 1) ENDIF(CMAKE_COMPILER_IS_CYGWIN) +SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC") + IF(CMAKE_COMPILER_IS_MINGW) SET(MINGW 1) ENDIF(CMAKE_COMPILER_IS_MINGW) -SET(CMAKE_COMPILER_IS_GNUG77_RUN 1) +SET(CMAKE_Fortran_COMPILER_ID_RUN 1) SET(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;f77;F77;f90;F90;for;f95;F95) SET(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) SET(CMAKE_Fortran_LINKER_PREFERENCE Prefered) @@ -23,4 +27,3 @@ IF(UNIX) ELSE(UNIX) SET(CMAKE_Fortran_OUTPUT_EXTENSION .obj) ENDIF(UNIX) -SET(CMAKE_Fortran_COMPILER_ENV_VAR "FC") diff --git a/Modules/CMakeFortranCompilerId.F90 b/Modules/CMakeFortranCompilerId.F90 new file mode 100644 index 0000000..0f63a1a --- /dev/null +++ b/Modules/CMakeFortranCompilerId.F90 @@ -0,0 +1,76 @@ +PROGRAM CMakeFortranCompilerId +! Identify the compiler +#if defined(__INTEL_COMPILER) || defined(__ICC) + PRINT *, 'INFO:compiler[Intel]' +#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) + PRINT *, 'INFO:compiler[SunPro]' +#elif defined(__GNUC__) + PRINT *, 'INFO:compiler[GNU]' +#elif defined(_COMPILER_VERSION) + PRINT *, 'INFO:compiler[MIPSpro]' +! This compiler is either not known or is too old to define an +! identification macro. Try to identify the platform and guess that +! it is the native compiler. +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) + PRINT *, 'INFO:compiler[VisualAge]' +#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) + PRINT *, 'INFO:compiler[MIPSpro]' +#elif defined(__hpux) || defined(__hpux__) + PRINT *, 'INFO:compiler[HP]' +#else + PRINT *, 'INFO:compiler[]' +#endif + +! Identify the platform +#if defined(__linux) || defined(__linux__) || defined(linux) + PRINT *, 'INFO:platform[Linux]' +#elif defined(__CYGWIN__) + PRINT *, 'INFO:platform[Cygwin]' +#elif defined(__MINGW32__) + PRINT *, 'INFO:platform[MinGW]' +#elif defined(__APPLE__) + PRINT *, 'INFO:platform[Darwin]' +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + PRINT *, 'INFO:platform[Windows]' +#elif defined(__FreeBSD__) || defined(__FreeBSD) + PRINT *, 'INFO:platform[FreeBSD]' +#elif defined(__NetBSD__) || defined(__NetBSD) + PRINT *, 'INFO:platform[NetBSD]' +#elif defined(__OpenBSD__) || defined(__OPENBSD) + PRINT *, 'INFO:platform[OpenBSD]' +#elif defined(__sun) || defined(sun) + PRINT *, 'INFO:platform[SunOS]' +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) + PRINT *, 'INFO:platform[AIX]' +#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) + PRINT *, 'INFO:platform[IRIX]' +#elif defined(__hpux) || defined(__hpux__) + PRINT *, 'INFO:platform[HP-UX]' +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) + PRINT *, 'INFO:platform[BeOS]' +#elif defined(__QNX__) || defined(__QNXNTO__) + PRINT *, 'INFO:platform[QNX]' +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) + PRINT *, 'INFO:platform[Tru64]' +#elif defined(__riscos) || defined(__riscos__) + PRINT *, 'INFO:platform[RISCos]' +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) + PRINT *, 'INFO:platform[SINIX]' +#elif defined(__UNIX_SV__) + PRINT *, 'INFO:platform[UNIX_SV]' +#elif defined(__bsdos__) + PRINT *, 'INFO:platform[BSDOS]' +#elif defined(_MPRAS) || defined(MPRAS) + PRINT *, 'INFO:platform[MP-RAS]' +#elif defined(__osf) || defined(__osf__) + PRINT *, 'INFO:platform[OSF1]' +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) + PRINT *, 'INFO:platform[SCO_SV]' +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) + PRINT *, 'INFO:platform[ULTRIX]' +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) + PRINT *, 'INFO:platform[Xenix]' +#else + PRINT *, 'INFO:platform[]' +#endif +END PROGRAM diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 3413c05..7484838 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -8,6 +8,11 @@ GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER} NAME_WE) IF(CMAKE_COMPILER_IS_GNUG77) SET(CMAKE_BASE_NAME g77) ENDIF(CMAKE_COMPILER_IS_GNUG77) +IF(CMAKE_Fortran_COMPILER_ID) + IF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) + SET(CMAKE_BASE_NAME ${CMAKE_Fortran_COMPILER_ID}-Fortran) + ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake) +ENDIF(CMAKE_Fortran_COMPILER_ID) SET(CMAKE_SYSTEM_AND_Fortran_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) @@ -42,9 +47,9 @@ IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) -IF(NOT CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) diff --git a/Modules/Platform/Linux-SunPro-C.cmake b/Modules/Platform/Linux-SunPro-C.cmake new file mode 100644 index 0000000..c199100 --- /dev/null +++ b/Modules/Platform/Linux-SunPro-C.cmake @@ -0,0 +1,24 @@ +# Linux sun studio c options +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") +SET(CMAKE_EXE_EXPORTS_C_FLAG "--export-dynamic") + +SET(CMAKE_C_FLAGS_INIT "") +SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +SET(CMAKE_C_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") +ENDFOREACH(type) diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake new file mode 100644 index 0000000..ddc10bd --- /dev/null +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -0,0 +1,24 @@ +# Linux sun studio c++ options +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") +SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") +SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") + +SET(CMAKE_CXX_FLAGS_INIT "") +SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") + +# Initialize C link type selection flags. These flags are used when +# building a shared library, shared module, or executable that links +# to other libraries to select whether to use the static or shared +# versions of the libraries. +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") +ENDFOREACH(type) diff --git a/Modules/Platform/Linux-SunPro-Fortran.cmake b/Modules/Platform/Linux-SunPro-Fortran.cmake new file mode 100644 index 0000000..16ac62c --- /dev/null +++ b/Modules/Platform/Linux-SunPro-Fortran.cmake @@ -0,0 +1,14 @@ +# Linux sun studio fortran options +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") +SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h") + +SET(CMAKE_Fortran_FLAGS_INIT "") +SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") -- cgit v0.12