From e28c16b482ace7a27ddd9c3680ce942ca83a9f38 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Dec 2009 09:52:00 -0500 Subject: [PATCH] Split GNU compiler information files This moves GNU compiler flags into new-style modules Compiler/GNU-.cmake Platform/-GNU-.cmake We use language-independent helper modules Compiler/GNU.cmake Platform/-GNU.cmake to define macros consolidating the information. --- Modules/CMakeGenericSystem.cmake | 3 -- Modules/Compiler/GNU-C.cmake | 3 +- Modules/Compiler/GNU-CXX.cmake | 3 +- Modules/Compiler/GNU-Fortran.cmake | 15 ++++++- Modules/Compiler/GNU.cmake | 38 +++++++++++++++++ Modules/Platform/AIX-GNU-C.cmake | 2 + Modules/Platform/AIX-GNU-CXX.cmake | 2 + Modules/Platform/AIX-GNU-Fortran.cmake | 2 + Modules/Platform/AIX-GNU.cmake | 23 ++++++++++ Modules/Platform/AIX.cmake | 10 ----- Modules/Platform/BeOS.cmake | 3 -- Modules/Platform/CYGWIN-GNU-C.cmake | 2 + Modules/Platform/CYGWIN-GNU-CXX.cmake | 2 + Modules/Platform/CYGWIN-GNU-Fortran.cmake | 2 + Modules/Platform/CYGWIN-GNU.cmake | 51 +++++++++++++++++++++++ Modules/Platform/CYGWIN-g77.cmake | 6 --- Modules/Platform/CYGWIN.cmake | 35 ---------------- Modules/Platform/HP-UX-GNU-C.cmake | 2 + Modules/Platform/HP-UX-GNU-CXX.cmake | 2 + Modules/Platform/HP-UX-GNU-Fortran.cmake | 2 + Modules/Platform/HP-UX-GNU.cmake | 27 ++++++++++++ Modules/Platform/HP-UX.cmake | 23 ---------- Modules/Platform/Haiku.cmake | 3 -- Modules/Platform/Linux-GNU-Fortran.cmake | 16 ------- Modules/Platform/Linux.cmake | 2 - Modules/Platform/QNX.cmake | 3 -- Modules/Platform/SunOS-GNU-C.cmake | 2 + Modules/Platform/SunOS-GNU-CXX.cmake | 2 + Modules/Platform/SunOS-GNU.cmake | 25 +++++++++++ Modules/Platform/SunOS.cmake | 17 -------- Modules/Platform/g77.cmake | 7 ---- Modules/Platform/gcc.cmake | 27 ------------ 32 files changed, 204 insertions(+), 158 deletions(-) create mode 100644 Modules/Compiler/GNU.cmake create mode 100644 Modules/Platform/AIX-GNU-C.cmake create mode 100644 Modules/Platform/AIX-GNU-CXX.cmake create mode 100644 Modules/Platform/AIX-GNU-Fortran.cmake create mode 100644 Modules/Platform/AIX-GNU.cmake create mode 100644 Modules/Platform/CYGWIN-GNU-C.cmake create mode 100644 Modules/Platform/CYGWIN-GNU-CXX.cmake create mode 100644 Modules/Platform/CYGWIN-GNU-Fortran.cmake create mode 100644 Modules/Platform/CYGWIN-GNU.cmake delete mode 100644 Modules/Platform/CYGWIN-g77.cmake create mode 100644 Modules/Platform/HP-UX-GNU-C.cmake create mode 100644 Modules/Platform/HP-UX-GNU-CXX.cmake create mode 100644 Modules/Platform/HP-UX-GNU-Fortran.cmake create mode 100644 Modules/Platform/HP-UX-GNU.cmake delete mode 100644 Modules/Platform/Linux-GNU-Fortran.cmake create mode 100644 Modules/Platform/SunOS-GNU-C.cmake create mode 100644 Modules/Platform/SunOS-GNU-CXX.cmake create mode 100644 Modules/Platform/SunOS-GNU.cmake delete mode 100644 Modules/Platform/g77.cmake delete mode 100644 Modules/Platform/gcc.cmake diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c66d5c52f..c0f3aa6aa 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -88,6 +88,3 @@ MARK_AS_ADVANCED( CMAKE_SKIP_RPATH CMAKE_VERBOSE_MAKEFILE ) - -# always include the gcc compiler information -INCLUDE(Platform/gcc) diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index abf384ab8..9a5137a4b 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1 +1,2 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(C) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index f3c6b5f82..879ab8f80 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1 +1,2 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(CXX) diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index 7f7c1289a..6e0f5f3d5 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -1 +1,14 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(Fortran) + +# No -DNDEBUG for Fortran. +SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") +SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") + +# We require updates to CMake C++ code to support preprocessing rules +# for Fortran. +SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) + +# Fortran-specific feature flags. +SET(CMAKE_Fortran_MODDIR_FLAG -J) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake new file mode 100644 index 000000000..63652b655 --- /dev/null +++ b/Modules/Compiler/GNU.cmake @@ -0,0 +1,38 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_GNU) + return() +endif() +set(__COMPILER_GNU 1) + +macro(__compiler_gnu lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-v") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + if(NOT APPLE) + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") + endif(NOT APPLE) +endmacro() diff --git a/Modules/Platform/AIX-GNU-C.cmake b/Modules/Platform/AIX-GNU-C.cmake new file mode 100644 index 000000000..f49d528b3 --- /dev/null +++ b/Modules/Platform/AIX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(C) diff --git a/Modules/Platform/AIX-GNU-CXX.cmake b/Modules/Platform/AIX-GNU-CXX.cmake new file mode 100644 index 000000000..ec8e83fa1 --- /dev/null +++ b/Modules/Platform/AIX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(CXX) diff --git a/Modules/Platform/AIX-GNU-Fortran.cmake b/Modules/Platform/AIX-GNU-Fortran.cmake new file mode 100644 index 000000000..07772a716 --- /dev/null +++ b/Modules/Platform/AIX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(Fortran) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake new file mode 100644 index 000000000..fc3880eee --- /dev/null +++ b/Modules/Platform/AIX-GNU.cmake @@ -0,0 +1,23 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_GNU) + return() +endif() +set(__AIX_COMPILER_GNU 1) + +macro(__aix_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") +endmacro() diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index c8a33c32f..0ab0cce65 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -15,16 +15,6 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # Files named "libfoo.a" may actually be shared libraries. SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) -# CXX Compiler -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-G") # -shared -ENDIF(CMAKE_COMPILER_IS_GNUCXX) - -# C Compiler -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-G") # -shared -ENDIF(CMAKE_COMPILER_IS_GNUCC) - # since .a can be a static or shared library on AIX, we can not do this. # at some point if we wanted it, we would have to figure out if a .a is # static or shared, then we could add this back: diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index f4d84d738..c4b66bbe7 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -1,8 +1,5 @@ SET(BEOS 1) -# GCC is the default compiler on BeOS. -INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) - SET(CMAKE_DL_LIBS root be) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") diff --git a/Modules/Platform/CYGWIN-GNU-C.cmake b/Modules/Platform/CYGWIN-GNU-C.cmake new file mode 100644 index 000000000..9eb0ecf29 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(C) diff --git a/Modules/Platform/CYGWIN-GNU-CXX.cmake b/Modules/Platform/CYGWIN-GNU-CXX.cmake new file mode 100644 index 000000000..2603dcd49 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(CXX) diff --git a/Modules/Platform/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/CYGWIN-GNU-Fortran.cmake new file mode 100644 index 000000000..d3b49b6f9 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(Fortran) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake new file mode 100644 index 000000000..5ca66973c --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -0,0 +1,51 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__CYGWIN_COMPILER_GNU) + return() +endif() +set(__CYGWIN_COMPILER_GNU 1) + +set(CMAKE_DL_LIBS "-lgdi32" ) +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,,--minor-image-version,") + +macro(__cygwin_compiler_gnu lang) + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on cygwin + + # 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_${lang}_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + ENDFOREACH(type) + + # To simulate UNIX shared libs we export/import all DLL symbols. + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--export-all-symbols -Wl,--enable-auto-import") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") +endmacro() diff --git a/Modules/Platform/CYGWIN-g77.cmake b/Modules/Platform/CYGWIN-g77.cmake deleted file mode 100644 index 942319f90..000000000 --- a/Modules/Platform/CYGWIN-g77.cmake +++ /dev/null @@ -1,6 +0,0 @@ -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "") -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -INCLUDE(Platform/g77) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index dd179a4d7..27e5a6838 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,55 +1,20 @@ SET(WIN32 1) SET(CYGWIN 1) -SET(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -SET(CMAKE_DL_LIBS "-lgdi32" ) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") SET(CMAKE_SHARED_MODULE_PREFIX "lib") SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") -# no pic for gcc on cygwin -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -SET(CMAKE_CREATE_WIN32_EXE "-mwindows") # Modules have a different default prefix that shared libs. SET(CMAKE_MODULE_EXISTS 1) SET(CMAKE_FIND_LIBRARY_PREFIXES "cyg" "lib") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a") -SET(CMAKE_GNULD_IMAGE_VERSION - "-Wl,--major-image-version,,--minor-image-version,") - -SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") - # Shared libraries on cygwin can be named with their version number. SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) -# 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 "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) - INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/HP-UX-GNU-C.cmake b/Modules/Platform/HP-UX-GNU-C.cmake new file mode 100644 index 000000000..5f9ac4200 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(C) diff --git a/Modules/Platform/HP-UX-GNU-CXX.cmake b/Modules/Platform/HP-UX-GNU-CXX.cmake new file mode 100644 index 000000000..689bed088 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(CXX) diff --git a/Modules/Platform/HP-UX-GNU-Fortran.cmake b/Modules/Platform/HP-UX-GNU-Fortran.cmake new file mode 100644 index 000000000..ee0181fe4 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(Fortran) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake new file mode 100644 index 000000000..da9fe4835 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__HPUX_COMPILER_GNU) + return() +endif() +set(__HPUX_COMPILER_GNU 1) + +macro(__hpux_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") +endmacro() diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 9584cbdbe..f8893d8d3 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -15,13 +15,6 @@ SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # fortran IF(CMAKE_COMPILER_IS_GNUG77) - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,+h") - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic ELSE(CMAKE_COMPILER_IS_GNUG77) # use ld directly to create shared libraries for hp cc SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY @@ -37,14 +30,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUG77) # C compiler IF(CMAKE_COMPILER_IS_GNUCC) - # gnu gcc - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,+h") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic ELSE(CMAKE_COMPILER_IS_GNUCC) # hp cc # use ld directly to create shared libraries for hp cc @@ -64,14 +49,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC) # CXX compiler IF(CMAKE_COMPILER_IS_GNUCXX) - # for gnu C++ - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,+h") ELSE(CMAKE_COMPILER_IS_GNUCXX) # for hp aCC SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 6676f24b7..532ca3fac 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -1,8 +1,5 @@ SET(BEOS 1) -# GCC is the default compiler on Haiku. -INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) - SET(CMAKE_DL_LIBS root be) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake deleted file mode 100644 index 16d63fc2f..000000000 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ /dev/null @@ -1,16 +0,0 @@ -SET(CMAKE_Fortran_MODDIR_FLAG -J) -SET (CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic -SET (CMAKE_Fortran_FLAGS_INIT "") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - -IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_Fortran "-isystem ") -ENDIF(NOT APPLE) - -# These will require updates to CMake C++ code to support -# preprocessing rules for Fortran. -#SET (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -#SET (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index f8612813b..5858eb3d2 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -58,5 +58,3 @@ INCLUDE(Platform/UnixPaths) IF(EXISTS "/etc/debian_version") SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) ENDIF(EXISTS "/etc/debian_version") -# always include the gcc compiler information -INCLUDE(Platform/gcc) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index b48383a96..88bb604ca 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,8 +1,5 @@ SET(QNXNTO 1) -# GCC is the default compiler on QNX 6.3. -INCLUDE(Platform/gcc) - # The QNX GCC does not seem to have -isystem so remove the flag. SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) diff --git a/Modules/Platform/SunOS-GNU-C.cmake b/Modules/Platform/SunOS-GNU-C.cmake new file mode 100644 index 000000000..c6b188836 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(Fortran) diff --git a/Modules/Platform/SunOS-GNU-CXX.cmake b/Modules/Platform/SunOS-GNU-CXX.cmake new file mode 100644 index 000000000..6b9f6fa86 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(CXX) diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake new file mode 100644 index 000000000..c494a81f5 --- /dev/null +++ b/Modules/Platform/SunOS-GNU.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__SUNOS_COMPILER_GNU) + return() +endif() +set(__SUNOS_COMPILER_GNU 1) + +macro(__sunos_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h") +endmacro() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 7d25577ca..c76522133 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -5,23 +5,6 @@ IF(CMAKE_SYSTEM MATCHES "SunOS-4.*") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*") -IF(CMAKE_SYSTEM MATCHES "SunOS-5.*") - IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-h") - ENDIF(CMAKE_COMPILER_IS_GNUCC) - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-R") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-h") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5.*") - IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_CXX_CREATE_SHARED_LIBRARY diff --git a/Modules/Platform/g77.cmake b/Modules/Platform/g77.cmake deleted file mode 100644 index 8f7d448ce..000000000 --- a/Modules/Platform/g77.cmake +++ /dev/null @@ -1,7 +0,0 @@ -IF(CMAKE_COMPILER_IS_GNUG77) - SET (CMAKE_Fortran_FLAGS_INIT "") - SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") -ENDIF(CMAKE_COMPILER_IS_GNUG77) diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake deleted file mode 100644 index 8c385cee7..000000000 --- a/Modules/Platform/gcc.cmake +++ /dev/null @@ -1,27 +0,0 @@ -IF(CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET (CMAKE_C_FLAGS_INIT "") - SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") - IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") - ENDIF(NOT APPLE) -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -IF(CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") - IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") - ENDIF(NOT APPLE) -ENDIF(CMAKE_COMPILER_IS_GNUCXX)