diff options
author | Brad King <brad.king@kitware.com> | 2009-12-02 09:52:00 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-12-02 09:52:00 -0500 |
commit | e28c16b482ace7a27ddd9c3680ce942ca83a9f38 (patch) | |
tree | f2f47fe778e7535335d5ee800c32bf22d42cb97f /Modules | |
parent | f3cd66577f3ed061123b1145f557eb28b80520dd (diff) | |
download | cmake-e28c16b482ace7a27ddd9c3680ce942ca83a9f38.tar.gz |
Split GNU compiler information files
This moves GNU compiler flags into new-style modules
Compiler/GNU-<lang>.cmake
Platform/<os>-GNU-<lang>.cmake
We use language-independent helper modules
Compiler/GNU.cmake
Platform/<os>-GNU.cmake
to define macros consolidating the information.
Diffstat (limited to 'Modules')
32 files changed, 204 insertions, 158 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c66d5c52fb..c0f3aa6aaf 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 abf384ab86..9a5137a4be 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 f3c6b5f829..879ab8f801 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 7f7c1289ae..6e0f5f3d5c 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 0000000000..63652b655f --- /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 "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + 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 0000000000..f49d528b32 --- /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 0000000000..ec8e83fa17 --- /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 0000000000..07772a716c --- /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 0000000000..fc3880eeed --- /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 c8a33c32f4..0ab0cce65d 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 f4d84d738b..c4b66bbe7c 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 0000000000..9eb0ecf299 --- /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 0000000000..2603dcd49c --- /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 0000000000..d3b49b6f95 --- /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 0000000000..5ca66973c9 --- /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,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") + +macro(__cygwin_compiler_gnu lang) + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + + 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 942319f902..0000000000 --- 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 dd179a4d7d..27e5a68382 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,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") - -SET(CMAKE_C_CREATE_SHARED_MODULE - "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") -SET(CMAKE_CXX_CREATE_SHARED_MODULE - "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") - -SET(CMAKE_C_CREATE_SHARED_LIBRARY - "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") - -SET(CMAKE_C_LINK_EXECUTABLE - "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") -SET(CMAKE_CXX_LINK_EXECUTABLE - "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") - # 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 0000000000..5f9ac42005 --- /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 0000000000..689bed0880 --- /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 0000000000..ee0181fe4c --- /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 0000000000..da9fe48358 --- /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 9584cbdbee..f8893d8d34 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 6676f24b70..532ca3fac2 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 16d63fc2f5..0000000000 --- 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 "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") -#SET (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index f8612813b2..5858eb3d2d 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 b48383a968..88bb604ca3 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 0000000000..c6b1888361 --- /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 0000000000..6b9f6fa862 --- /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 0000000000..c494a81f5a --- /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 7d25577ca9..c765221334 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 8f7d448ce1..0000000000 --- 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 8c385cee7f..0000000000 --- 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 "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - 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 "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") - ENDIF(NOT APPLE) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) |