diff options
32 files changed, 204 insertions, 158 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c66d5c5..c0f3aa6 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 abf384a..9a5137a 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 f3c6b5f..879ab8f 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 7f7c128..6e0f5f3 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 0000000..63652b6 --- /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 0000000..f49d528 --- /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 0000000..ec8e83f --- /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 0000000..07772a7 --- /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 0000000..fc3880e --- /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 c8a33c3..0ab0cce 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 f4d84d7..c4b66bb 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 0000000..9eb0ecf --- /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 0000000..2603dcd --- /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 0000000..d3b49b6 --- /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 0000000..5ca6697 --- /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 942319f..0000000 --- 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 dd179a4..27e5a68 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 0000000..5f9ac42 --- /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 0000000..689bed0 --- /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 0000000..ee0181f --- /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 0000000..da9fe48 --- /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 9584cbd..f8893d8 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 6676f24..532ca3f 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 16d63fc..0000000 --- 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 f861281..5858eb3 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 b48383a..88bb604 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 0000000..c6b1888 --- /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 0000000..6b9f6fa --- /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 0000000..c494a81 --- /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 7d25577..c765221 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 8f7d448..0000000 --- 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 8c385ce..0000000 --- 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) |