diff options
Diffstat (limited to 'Modules/Platform')
147 files changed, 3368 insertions, 0 deletions
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..543f3e8 --- /dev/null +++ b/Modules/Platform/AIX-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 distribute 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_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") +endmacro() diff --git a/Modules/Platform/AIX-VisualAge-C.cmake b/Modules/Platform/AIX-VisualAge-C.cmake new file mode 100644 index 0000000..67b3171 --- /dev/null +++ b/Modules/Platform/AIX-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/AIX-XL-C) diff --git a/Modules/Platform/AIX-VisualAge-CXX.cmake b/Modules/Platform/AIX-VisualAge-CXX.cmake new file mode 100644 index 0000000..7894d24 --- /dev/null +++ b/Modules/Platform/AIX-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/AIX-XL-CXX) diff --git a/Modules/Platform/AIX-XL-ASM.cmake b/Modules/Platform/AIX-XL-ASM.cmake new file mode 100644 index 0000000..ea0944b --- /dev/null +++ b/Modules/Platform/AIX-XL-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(ASM) diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake new file mode 100644 index 0000000..5e437fa --- /dev/null +++ b/Modules/Platform/AIX-XL-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(C) diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake new file mode 100644 index 0000000..ef38a5f --- /dev/null +++ b/Modules/Platform/AIX-XL-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(CXX) diff --git a/Modules/Platform/AIX-XL-Fortran.cmake b/Modules/Platform/AIX-XL-Fortran.cmake new file mode 100644 index 0000000..6d4f655 --- /dev/null +++ b/Modules/Platform/AIX-XL-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(Fortran) diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake new file mode 100644 index 0000000..1f94152 --- /dev/null +++ b/Modules/Platform/AIX-XL.cmake @@ -0,0 +1,28 @@ + +#============================================================================= +# Copyright 2002-2011 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 distribute 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_XL) + return() +endif() +set(__AIX_COMPILER_XL 1) + +macro(__aix_compiler_xl lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") + set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") +endmacro() diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake new file mode 100644 index 0000000..a9f773e --- /dev/null +++ b/Modules/Platform/AIX.cmake @@ -0,0 +1,29 @@ +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +SET(CMAKE_DL_LIBS "-lld") + +# RPATH support on AIX is called libpath. By default the runtime +# libpath is paths specified by -L followed by /usr/lib and /lib. In +# order to prevent the -L paths from being used we must force use of +# -Wl,-blibpath:/usr/lib:/lib whether RPATH support is on or not. +# When our own RPATH is to be added it may be inserted before the +# "always" paths. +SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) + +# Files named "libfoo.a" may actually be shared libraries. +SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) + +# 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: + +# 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) + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/BSDOS.cmake b/Modules/Platform/BSDOS.cmake new file mode 100644 index 0000000..cf9d17b --- /dev/null +++ b/Modules/Platform/BSDOS.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/UnixPaths) + diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake new file mode 100644 index 0000000..41aa8f7 --- /dev/null +++ b/Modules/Platform/BeOS.cmake @@ -0,0 +1,10 @@ +SET(BEOS 1) + +SET(CMAKE_DL_LIBS root be) +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/BlueGeneL.cmake b/Modules/Platform/BlueGeneL.cmake new file mode 100644 index 0000000..7794a26 --- /dev/null +++ b/Modules/Platform/BlueGeneL.cmake @@ -0,0 +1,40 @@ +#the compute nodes on BlueGene/L don't support shared libs +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +SET(CMAKE_LINK_LIBRARY_SUFFIX "") +SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe +SET(CMAKE_DL_LIBS "" ) + +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + + +INCLUDE(Platform/UnixPaths) + +IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lgcc,-lc -lnss_files -lnss_dns -lresolv") +ELSE(CMAKE_COMPILER_IS_GNUCC) + # when using IBM xlc we probably don't want to link to -lgcc + SET(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> -Wl,-relax <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lc -lnss_files -lnss_dns -lresolv") +ENDIF(CMAKE_COMPILER_IS_GNUCC) + +IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lgcc,-lc -lnss_files -lnss_dns -lresolv") +ELSE(CMAKE_COMPILER_IS_GNUCXX) + # when using the IBM xlC we probably don't want to link to -lgcc + SET(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> -Wl,-relax <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Wl,-lstdc++,-lc -lnss_files -lnss_dns -lresolv") +ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake new file mode 100644 index 0000000..2ca920f --- /dev/null +++ b/Modules/Platform/BlueGeneP-base.cmake @@ -0,0 +1,118 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# BlueGeneP base platform file. +# +# NOTE: Do not set your platform to "BlueGeneP-base". This file is included +# by the real platform files. Use one of these two platforms instead: +# +# BlueGeneP-dynamic For dynamically linked builds +# BlueGeneP-static For statically linked builds +# +# This platform file tries its best to adhere to the behavior of the MPI +# compiler wrappers included with the latest BG/P drivers. +# + + +# +# For BGP builds, we're cross compiling, but we don't want to re-root things +# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on +# the shared filesystems, and this may lie outside the root. Instead, we set the +# system directories so that the various system BGP CNK library locations are +# searched first. This is not the clearest thing in the world, given IBM's driver +# layout, but this should cover all the standard ones. +# +set(CMAKE_SYSTEM_LIBRARY_PATH + /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/sys/lib # DCMF, other lower-level comm libraries + /bgsys/drivers/ppcfloor/runtime/SPI # other low-level stuff + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc. +) + +# +# This adds directories that find commands should specifically ignore for cross compiles. +# Most of these directories are the includeand lib directories for the frontend on BG/P systems. +# Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly. +# We use this on BG instead of re-rooting because backend libraries are typically strewn about +# the filesystem, and we can't re-root ALL backend libraries to a single place. +# +set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /include + /usr/lib /usr/lib64 /usr/include + /usr/local/lib /usr/local/lib64 /usr/local/include + /usr/X11/lib /usr/X11/lib64 /usr/X11/include + /usr/lib/X11 /usr/lib64/X11 /usr/include/X11 + /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include + /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include +) + +# +# Indicate that this is a unix-like system +# +set(UNIX 1) + +# +# Library prefixes, suffixes, extra libs. +# +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe +set(CMAKE_DL_LIBS "dl") + +# +# This macro needs to be called for dynamic library support. Unfortunately on BGP, +# We can't support both static and dynamic links in the same platform file. The +# dynamic link platform file needs to call this explicitly to set up dynamic linking. +# +macro(__BlueGeneP_set_dynamic_flags compiler_id lang) + if (${compiler_id} STREQUAL XL) + # Flags for XL compilers if we explicitly detected XL + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") # -pic + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") # -shared + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + # Assume flags for GNU compilers (if the ID is GNU *or* anything else). + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") # -pic + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") # -shared + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") # -rpath + set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty + + set(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DYNAMIC_EXE_FLAGS} ${BGP_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() + +# +# This macro needs to be called for static builds. Right now it just adds -Wl,-relax +# to the link line. +# +macro(__BlueGeneP_set_static_flags compiler_id lang) + set(BGP_${lang}_DEFAULT_EXE_FLAGS + "<FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> -Wl,-relax ${BGP_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake new file mode 100644 index 0000000..bd4696b --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake new file mode 100644 index 0000000..9c995dc --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake new file mode 100644 index 0000000..19d6be8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake new file mode 100644 index 0000000..2dbbbc0 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake new file mode 100644 index 0000000..2bc5127 --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake new file mode 100644 index 0000000..59da63d --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_dynamic_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-dynamic.cmake b/Modules/Platform/BlueGeneP-dynamic.cmake new file mode 100644 index 0000000..8f96f2f --- /dev/null +++ b/Modules/Platform/BlueGeneP-dynamic.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneP-static-GNU-C.cmake b/Modules/Platform/BlueGeneP-static-GNU-C.cmake new file mode 100644 index 0000000..412a7a3 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU C) diff --git a/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake new file mode 100644 index 0000000..418f0d8 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU CXX) diff --git a/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake new file mode 100644 index 0000000..119195b --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(GNU Fortran) diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake new file mode 100644 index 0000000..1f20959 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL C) diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake new file mode 100644 index 0000000..f027a53 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL CXX) diff --git a/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake new file mode 100644 index 0000000..778d4bd --- /dev/null +++ b/Modules/Platform/BlueGeneP-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneP_set_static_flags(XL Fortran) diff --git a/Modules/Platform/BlueGeneP-static.cmake b/Modules/Platform/BlueGeneP-static.cmake new file mode 100644 index 0000000..c4f5f21 --- /dev/null +++ b/Modules/Platform/BlueGeneP-static.cmake @@ -0,0 +1,19 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin <tgamblin@llnl.gov> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneP-base) +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") 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..5aad45b --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -0,0 +1,53 @@ + +#============================================================================= +# 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 distribute 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) + +# TODO: Is -Wl,--enable-auto-import now always default? +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>") +set(CMAKE_GENERATOR_RC windres) +enable_language(RC) +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) + + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") + # TODO: Is -Wl,--enable-auto-import now always default? + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") +endmacro() diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake new file mode 100644 index 0000000..8bc1b15 --- /dev/null +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -0,0 +1 @@ +SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>") diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake new file mode 100644 index 0000000..b7ad2ce --- /dev/null +++ b/Modules/Platform/CYGWIN.cmake @@ -0,0 +1,64 @@ +if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214") + set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) +endif() +if(NOT DEFINED WIN32) + set(WIN32 0) + if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32 + AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + endif() + if(CMAKE_LEGACY_CYGWIN_WIN32) + message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32") + set(WIN32 1) + elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x") + message(WARNING "CMake no longer defines WIN32 on Cygwin!" + "\n" + "(1) If you are just trying to build this project, ignore this warning " + "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or " + "in the CMake cache. " + "If later configuration or build errors occur then this project may " + "have been written under the assumption that Cygwin is WIN32. " + "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead." + "\n" + "(2) If you are developing this project, add the line\n" + " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n" + "at the top of your top-level CMakeLists.txt file or set the minimum " + "required version of CMake to 2.8.4 or higher. " + "Then teach your project to build on Cygwin without WIN32.") + endif() + elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32) + message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n" + " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n" + "is at least 2.8.4.") + endif() +endif() +if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + # Pass WIN32 legacy setting to scripts. + if(WIN32) + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1) + else() + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0) + endif() + unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32) +endif() + +SET(CYGWIN 1) + +SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +SET(CMAKE_SHARED_MODULE_PREFIX "cyg") +SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") +SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +# Modules have a different default prefix that shared libs. +SET(CMAKE_MODULE_EXISTS 1) + +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") + +# Shared libraries on cygwin can be named with their version number. +SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Catamount.cmake b/Modules/Platform/Catamount.cmake new file mode 100644 index 0000000..01493fc --- /dev/null +++ b/Modules/Platform/Catamount.cmake @@ -0,0 +1,26 @@ +#Catamount, which runs on the compute nodes of Cray machines, e.g. RedStorm, doesn't support shared libs +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +SET(CMAKE_LINK_LIBRARY_SUFFIX "") +SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe +SET(CMAKE_DL_LIBS "" ) + +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +INCLUDE(Platform/UnixPaths) + +SET(CMAKE_CXX_LINK_SHARED_LIBRARY) +SET(CMAKE_CXX_LINK_MODULE_LIBRARY) +SET(CMAKE_C_LINK_SHARED_LIBRARY) +SET(CMAKE_C_LINK_MODULE_LIBRARY) diff --git a/Modules/Platform/Darwin-Absoft-Fortran.cmake b/Modules/Platform/Darwin-Absoft-Fortran.cmake new file mode 100644 index 0000000..beb41a3 --- /dev/null +++ b/Modules/Platform/Darwin-Absoft-Fortran.cmake @@ -0,0 +1 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood. diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake new file mode 100644 index 0000000..4e326c4 --- /dev/null +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -0,0 +1,4 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(C) +cmake_gnu_has_isysroot(C) +cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake new file mode 100644 index 0000000..b39487e --- /dev/null +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(CXX) +cmake_gnu_has_isysroot(CXX) +cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake new file mode 100644 index 0000000..8e8acc3 --- /dev/null +++ b/Modules/Platform/Darwin-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(Fortran) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake new file mode 100644 index 0000000..8a50a6a --- /dev/null +++ b/Modules/Platform/Darwin-GNU.cmake @@ -0,0 +1,64 @@ + +#============================================================================= +# 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 distribute 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(__DARWIN_COMPILER_GNU) + return() +endif() +set(__DARWIN_COMPILER_GNU 1) + +macro(__darwin_compiler_gnu lang) + # GNU does not have -shared on OS X + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") +endmacro() + +macro(cmake_gnu_has_isysroot lang) + if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x") + set(_doc "${lang} compiler has -isysroot") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "isysroot") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_HAS_ISYSROOT 1) + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_HAS_ISYSROOT 0) + endif() + endif() +endmacro() + +macro(cmake_gnu_set_osx_deployment_target_flag lang) + if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG) + set(_doc "${lang} compiler supports OSX deployment target flag") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "macosx-version-min") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + endif() + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "SET(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") + endif() +endmacro() diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake new file mode 100644 index 0000000..933f9e1 --- /dev/null +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -0,0 +1,5 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need -fpp explicitly on case-insensitive filesystem. +set(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>") diff --git a/Modules/Platform/Darwin-VisualAge-C.cmake b/Modules/Platform/Darwin-VisualAge-C.cmake new file mode 100644 index 0000000..859914f --- /dev/null +++ b/Modules/Platform/Darwin-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-XL-C) diff --git a/Modules/Platform/Darwin-VisualAge-CXX.cmake b/Modules/Platform/Darwin-VisualAge-CXX.cmake new file mode 100644 index 0000000..46c1005 --- /dev/null +++ b/Modules/Platform/Darwin-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-XL-CXX) diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake new file mode 100644 index 0000000..934ebcc --- /dev/null +++ b/Modules/Platform/Darwin-XL-C.cmake @@ -0,0 +1,5 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle") + +# Enable shared library versioning. +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake new file mode 100644 index 0000000..22ae018 --- /dev/null +++ b/Modules/Platform/Darwin-XL-CXX.cmake @@ -0,0 +1,5 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") +SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle") + +# Enable shared library versioning. +SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name") diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake new file mode 100644 index 0000000..b62036c --- /dev/null +++ b/Modules/Platform/Darwin-icc.cmake @@ -0,0 +1,128 @@ +SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" ) +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "") + +# Setup for Leopard Compatibility +EXEC_PROGRAM(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION) +# MESSAGE (STATUS "_OSX_VERSION: ${_OSX_VERSION}") +IF ( _OSX_VERSION MATCHES "^10.4" ) + #IF(CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_FLAGS_INIT "") + SET (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") + # ENDIF(CMAKE_COMPILER_IS_GNUCC) + +# IF(CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2") + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +# ENDIF(CMAKE_COMPILER_IS_GNUCXX) +ENDIF ( _OSX_VERSION MATCHES "^10.4" ) + + +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +SET(CMAKE_SHARED_MODULE_PREFIX "lib") +SET(CMAKE_SHARED_MODULE_SUFFIX ".so") +SET(CMAKE_MODULE_EXISTS 1) +SET(CMAKE_DL_LIBS "") +SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") + + +# setup for universal binaries if sysroot exists +IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES + # has more than one value + SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING + "isysroot used for universal binary support") + # set _CMAKE_OSX_MACHINE to umame -m + EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + + # check for environment variable CMAKE_OSX_ARCHITECTURES + # if it is set. + IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + SET(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}") + ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + # now put _CMAKE_OSX_MACHINE into the cache + SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE} + CACHE STRING "Build architectures for OSX") +ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + + +IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") +ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + +IF(NOT XCODE) + # Enable shared library versioning. This flag is not actually referenced + # but the fact that the setting exists will cause the generators to support + # soname computation. + SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") + SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") + SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") +ENDIF(NOT XCODE) + +# Xcode does not support -isystem yet. +IF(XCODE) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +ENDIF(XCODE) + +SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>") + +SET(CMAKE_C_CREATE_SHARED_LIBRARY + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_CXX_CREATE_SHARED_MODULE + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_C_CREATE_SHARED_MODULE + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_Fortran_CREATE_SHARED_MODULE + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + + +# We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC. +# We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler. +# I have no idea what the best way to do that would be. + + +# default to searching for frameworks first +SET(CMAKE_FIND_FRAMEWORK FIRST) +# set up the default search directories for frameworks +SET(CMAKE_SYSTEM_FRAMEWORK_PATH + ~/Library/Frameworks + /Library/Frameworks + /Network/Library/Frameworks + /System/Library/Frameworks) + +# default to searching for application bundles first +SET(CMAKE_FIND_APPBUNDLE FIRST) +# set up the default search directories for application bundles +SET(CMAKE_SYSTEM_APPBUNDLE_PATH + ~/Applications + /Applications + /Developer/Applications) + +INCLUDE(Platform/UnixPaths) +SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include) +SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib) + diff --git a/Modules/Platform/Darwin-icpc.cmake b/Modules/Platform/Darwin-icpc.cmake new file mode 100644 index 0000000..e247bae --- /dev/null +++ b/Modules/Platform/Darwin-icpc.cmake @@ -0,0 +1,3 @@ +GET_FILENAME_COMPONENT(CURRENT_SOURCE_PARENT ${CMAKE_CURRENT_LIST_FILE} PATH) +#MESSAGE (STATUS "CURRENT_SOURCE_PARENT: ${CURRENT_SOURCE_PARENT}") +INCLUDE ( ${CURRENT_SOURCE_PARENT}/Darwin-icc.cmake) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake new file mode 100644 index 0000000..c11c8fb --- /dev/null +++ b/Modules/Platform/Darwin.cmake @@ -0,0 +1,242 @@ +SET(APPLE 1) + +# Darwin versions: +# 6.x == Mac OSX 10.2 (Jaguar) +# 7.x == Mac OSX 10.3 (Panther) +# 8.x == Mac OSX 10.4 (Tiger) +# 9.x == Mac OSX 10.5 (Leopard) +# 10.x == Mac OSX 10.6 (Snow Leopard) +STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") +STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") + +# Do not use the "-Wl,-search_paths_first" flag with the OSX 10.2 compiler. +# Done this way because it is too early to do a TRY_COMPILE. +IF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) + SET(HAVE_FLAG_SEARCH_PATHS_FIRST 0) + IF("${DARWIN_MAJOR_VERSION}" GREATER 6) + SET(HAVE_FLAG_SEARCH_PATHS_FIRST 1) + ENDIF("${DARWIN_MAJOR_VERSION}" GREATER 6) +ENDIF(NOT DEFINED HAVE_FLAG_SEARCH_PATHS_FIRST) +# More desirable, but does not work: + #INCLUDE(CheckCXXCompilerFlag) + #CHECK_CXX_COMPILER_FLAG("-Wl,-search_paths_first" HAVE_FLAG_SEARCH_PATHS_FIRST) + +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +SET(CMAKE_SHARED_MODULE_PREFIX "lib") +SET(CMAKE_SHARED_MODULE_SUFFIX ".so") +SET(CMAKE_MODULE_EXISTS 1) +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + +SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") + +IF(HAVE_FLAG_SEARCH_PATHS_FIRST) + SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") + SET(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") +ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) + +SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +SET(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") + +# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree +# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex +IF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL install_name_tool) +ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) + +# Set the assumed (Pre 10.5 or Default) location of the developer tools +SET(OSX_DEVELOPER_ROOT "/Developer") + +# Find installed SDKs +FILE(GLOB _CMAKE_OSX_SDKS "${OSX_DEVELOPER_ROOT}/SDKs/*") + +# If nothing is found there, then try locating the dev tools based on the xcode-select tool +# (available in Xcode >= 3.0 installations) +IF(NOT _CMAKE_OSX_SDKS) + FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select) + IF(CMAKE_XCODE_SELECT) + EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" + OUTPUT_VARIABLE OSX_DEVELOPER_ROOT + OUTPUT_STRIP_TRAILING_WHITESPACE) + FILE(GLOB _CMAKE_OSX_SDKS "${OSX_DEVELOPER_ROOT}/SDKs/*") + ENDIF(CMAKE_XCODE_SELECT) +ENDIF(NOT _CMAKE_OSX_SDKS) + +EXECUTE_PROCESS(COMMAND sw_vers -productVersion + OUTPUT_VARIABLE CURRENT_OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + +#---------------------------------------------------------------------------- +# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... +# +STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" + _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") + +#---------------------------------------------------------------------------- +# CMAKE_OSX_DEPLOYMENT_TARGET + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +IF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") +ENDIF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + +#---------------------------------------------------------------------------- +# CMAKE_OSX_SYSROOT + +# Environment variable set by the user overrides our default. +# Use the same environment variable that Xcode uses. +SET(ENV_SDKROOT "$ENV{SDKROOT}") + +# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, +# accounting for the known specially named SDKs. +SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${_CURRENT_OSX_VERSION}.sdk") + +IF(_CURRENT_OSX_VERSION STREQUAL "10.4") + SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.4u.sdk") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4") + +IF(_CURRENT_OSX_VERSION STREQUAL "10.3") + SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.3.9.sdk") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3") + +# Use environment or default as initial cache value: +IF(NOT ENV_SDKROOT STREQUAL "") + SET(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT}) +ELSE(NOT ENV_SDKROOT STREQUAL "") + SET(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT}) +ENDIF(NOT ENV_SDKROOT STREQUAL "") + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH + "The product will be built against the headers and libraries located inside the indicated SDK.") + +#---------------------------------------------------------------------------- +function(SanityCheckSDKAndDeployTarget _sdk_path _deploy) + if(_deploy STREQUAL "") + return() + endif() + + if(_sdk_path STREQUAL "") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty") + endif() + + string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}") + if(_deploy GREATER "${SDK}") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower") + endif() +endfunction(SanityCheckSDKAndDeployTarget) +#---------------------------------------------------------------------------- + +# Make sure the combination of SDK and Deployment Target are allowed +SanityCheckSDKAndDeployTarget("${CMAKE_OSX_SYSROOT}" "${CMAKE_OSX_DEPLOYMENT_TARGET}") + +# set _CMAKE_OSX_MACHINE to uname -m +EXECUTE_PROCESS(COMMAND uname -m + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + +# check for Power PC and change to ppc +IF(_CMAKE_OSX_MACHINE MATCHES "Power") + SET(_CMAKE_OSX_MACHINE ppc) +ENDIF(_CMAKE_OSX_MACHINE MATCHES "Power") + +# check for environment variable CMAKE_OSX_ARCHITECTURES +# if it is set. +IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + SET(CMAKE_OSX_ARCHITECTURES_VALUE "$ENV{CMAKE_OSX_ARCHITECTURES}") +ELSE(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + SET(CMAKE_OSX_ARCHITECTURES_VALUE "") +ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") + +# now put _CMAKE_OSX_MACHINE into the cache +SET(CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES_VALUE} CACHE STRING + "Build architectures for OSX") + + +IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS + "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") +ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") + +IF(NOT XCODE) + # Enable shared library versioning. This flag is not actually referenced + # but the fact that the setting exists will cause the generators to support + # soname computation. + SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") +ENDIF(NOT XCODE) + +# Xcode does not support -isystem yet. +IF(XCODE) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) + SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +ENDIF(XCODE) + +# Need to list dependent shared libraries on link line. When building +# with -isysroot (for universal binaries), the linker always looks for +# dependent libraries under the sysroot. Listing them on the link +# line works around the problem. +SET(CMAKE_LINK_DEPENDENT_LIBRARY_FILES 1) + +SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w) +SET(CMAKE_C_CREATE_SHARED_LIBRARY + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_CXX_CREATE_SHARED_MODULE + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_C_CREATE_SHARED_MODULE + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_Fortran_CREATE_SHARED_MODULE + "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +SET(CMAKE_C_CREATE_MACOSX_FRAMEWORK + "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +SET(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK + "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") + + + +# default to searching for frameworks first +SET(CMAKE_FIND_FRAMEWORK FIRST) +# set up the default search directories for frameworks +SET(CMAKE_SYSTEM_FRAMEWORK_PATH + ~/Library/Frameworks + /Library/Frameworks + /Network/Library/Frameworks + /System/Library/Frameworks) + +# default to searching for application bundles first +SET(CMAKE_FIND_APPBUNDLE FIRST) +# set up the default search directories for application bundles +SET(CMAKE_SYSTEM_APPBUNDLE_PATH + ~/Applications + /Applications + /Developer/Applications) + +INCLUDE(Platform/UnixPaths) +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + /sw # Fink + /opt/local # MacPorts + ) diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake new file mode 100644 index 0000000..f6e0f81 --- /dev/null +++ b/Modules/Platform/DragonFly.cmake @@ -0,0 +1,5 @@ +# DragonFly BSD was forked from FreeBSD and is still very close to it +# http://www.dragonflybsd.org +# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361 + +INCLUDE(Platform/FreeBSD) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake new file mode 100644 index 0000000..033db06 --- /dev/null +++ b/Modules/Platform/FreeBSD.cmake @@ -0,0 +1,26 @@ +IF(EXISTS /usr/include/dlfcn.h) + SET(CMAKE_DL_LIBS "") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared + SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty + SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") + SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +ENDIF(EXISTS /usr/include/dlfcn.h) + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 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/GNU.cmake b/Modules/Platform/GNU.cmake new file mode 100644 index 0000000..4bcfd51 --- /dev/null +++ b/Modules/Platform/GNU.cmake @@ -0,0 +1,13 @@ +# GCC is the default compiler on GNU/Hurd. +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*") + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake new file mode 100644 index 0000000..cec4c2f --- /dev/null +++ b/Modules/Platform/Generic-ADSP-ASM.cmake @@ -0,0 +1,7 @@ +INCLUDE(Platform/Generic-ADSP-Common) + +SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +SET(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) +SET(CMAKE_ASM_COMPILE_OBJECT + "<CMAKE_ASM_COMPILER> <FLAGS> -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <OBJECT> <SOURCE>") + diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake new file mode 100644 index 0000000..f064468 --- /dev/null +++ b/Modules/Platform/Generic-ADSP-C.cmake @@ -0,0 +1,20 @@ + +INCLUDE(Platform/Generic-ADSP-Common) + + +SET(CMAKE_C_OUTPUT_EXTENSION ".doj") + +SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "") +SET(CMAKE_C_FLAGS_RELEASE_INIT "") +SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "") + +SET(CMAKE_C_CREATE_STATIC_LIBRARY + "<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>") + +SET(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +SET(CMAKE_C_CREATE_SHARED_LIBRARY) +SET(CMAKE_C_CREATE_MODULE_LIBRARY) + diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake new file mode 100644 index 0000000..21daa81 --- /dev/null +++ b/Modules/Platform/Generic-ADSP-CXX.cmake @@ -0,0 +1,18 @@ +INCLUDE(Platform/Generic-ADSP-Common) + +SET(CMAKE_CXX_OUTPUT_EXTENSION ".doj") + +SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "") +SET(CMAKE_CXX_FLAGS_RELEASE_INIT "") +SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "") + +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>") + +SET(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY) +SET(CMAKE_CXX_CREATE_MODULE_LIBRARY) + diff --git a/Modules/Platform/Generic-ADSP-Common.cmake b/Modules/Platform/Generic-ADSP-Common.cmake new file mode 100644 index 0000000..10fb34e --- /dev/null +++ b/Modules/Platform/Generic-ADSP-Common.cmake @@ -0,0 +1,120 @@ +# support for the Analog Devices toolchain for their DSPs +# Raphael Cotty" <raphael.cotty (AT) googlemail.com> +# +# it supports three architectures: +# Blackfin +# TS (TigerShark) +# 21k (Sharc 21xxx) + +IF(NOT ADSP) + + SET(ADSP TRUE) + + SET(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb") + SET(CMAKE_SHARED_LIBRARY_SUFFIX "") + SET(CMAKE_EXECUTABLE_SUFFIX ".dxe") + + # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has, + # assume that this is the processor name to use for the compiler + IF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) + SET(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) + ENDIF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR) + + # if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none" + IF(NOT ADSP_PROCESSOR_SILICIUM_REVISION) + SET(ADSP_PROCESSOR_SILICIUM_REVISION "none") + ENDIF(NOT ADSP_PROCESSOR_SILICIUM_REVISION) + + # this file is included from the C and CXX files, so handle both here + + GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH) + IF(NOT _ADSP_DIR) + GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH) + ENDIF(NOT _ADSP_DIR) + IF(NOT _ADSP_DIR) + GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH) + ENDIF(NOT _ADSP_DIR) + + # detect architecture + + IF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) + IF(NOT ADSP_PROCESSOR) + SET(ADSP_PROCESSOR "ADSP-BF561") + ENDIF(NOT ADSP_PROCESSOR) + SET(ADSP_BLACKFIN TRUE) + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin") + ENDIF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN) + + IF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) + IF(NOT ADSP_PROCESSOR) + SET(ADSP_PROCESSOR "ADSP-TS101") + ENDIF(NOT ADSP_PROCESSOR) + SET(ADSP_TS TRUE) + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS") + ENDIF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS) + + IF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) + IF(NOT ADSP_PROCESSOR) + SET(ADSP_PROCESSOR "ADSP-21060") + ENDIF(NOT ADSP_PROCESSOR) + SET(ADSP_21K TRUE) + + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches + IF (ADSP_PROCESSOR MATCHES "210..$") + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + ENDIF(ADSP_PROCESSOR MATCHES "210..$") + + IF (ADSP_PROCESSOR MATCHES "211..$") + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k") + ENDIF(ADSP_PROCESSOR MATCHES "211..$") + + IF (ADSP_PROCESSOR MATCHES "212..$") + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k") + ENDIF(ADSP_PROCESSOR MATCHES "212..$") + + IF (ADSP_PROCESSOR MATCHES "213..$") + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k") + ENDIF(ADSP_PROCESSOR MATCHES "213..$") + + SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") + ENDIF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k) + + + LINK_DIRECTORIES("${_ADSP_FAMILY_DIR}/lib") + + # vdk support + FIND_PROGRAM( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" ) + + MACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) + ADD_CUSTOM_COMMAND( + OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE} + COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM + DEPENDS ${VDK_KERNEL_SUPPORT_FILE} + ) + ENDMACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE) + + # loader support + FIND_PROGRAM( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" ) + + # BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO + # FORMAT: hex, ASCII, binary, include + # WIDTH: 8, 16 + MACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) + ADD_CUSTOM_COMMAND( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr + COMMENT "Building the loader file" + ) + ENDMACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH) + + MACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) + ADD_CUSTOM_COMMAND( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr -init ${INITIALIZATION_FILE} + COMMENT "Building the loader file" + ) + ENDMACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE) + +ENDIF(NOT ADSP) diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake new file mode 100644 index 0000000..ac81c35 --- /dev/null +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -0,0 +1,54 @@ + +# This file implements basic support for sdcc (http://sdcc.sourceforge.net/) +# a free C compiler for 8 and 16 bit microcontrollers. +# To use it either a toolchain file is required or cmake has to be run like this: +# cmake -DCMAKE_C_COMPILER=sdcc -DCMAKE_SYSTEM_NAME=Generic <dir...> +# Since sdcc doesn't support C++, C++ support should be disabled in the +# CMakeLists.txt using the PROJECT() command: +# PROJECT(my_project C) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".lib") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX ) +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ) +SET(CMAKE_EXECUTABLE_SUFFIX ".ihx") # intel hex file +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_C_OUTPUT_EXTENSION ".rel") + +# find sdcclib as CMAKE_AR +# since cmake may already have searched for "ar", sdcclib has to +# be searched with a different variable name (SDCCLIB_EXECUTABLE) +# and must then be forced into the cache +GET_FILENAME_COMPONENT(SDCC_LOCATION "${CMAKE_C_COMPILER}" PATH) +FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib PATHS "${SDCC_LOCATION}" NO_DEFAULT_PATH) +FIND_PROGRAM(SDCCLIB_EXECUTABLE sdcclib) +SET(CMAKE_AR "${SDCCLIB_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) + +# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file +IF(NOT DEFINED CMAKE_C_FLAGS_INIT) + SET(CMAKE_C_FLAGS_INIT "-mmcs51 --model-small") +ENDIF(NOT DEFINED CMAKE_C_FLAGS_INIT) + +IF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) + SET (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) +ENDIF(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) + +# compile a C file into an object file +SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +# link object files to an executable +SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <OBJECTS> --out-fmt-ihx -o <TARGET> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>") + +# needs sdcc 2.7.0 + sddclib from cvs +SET(CMAKE_C_CREATE_STATIC_LIBRARY + "\"${CMAKE_COMMAND}\" -E remove <TARGET>" + "<CMAKE_AR> -a <TARGET> <LINK_FLAGS> <OBJECTS> ") + +# not supported by sdcc +SET(CMAKE_C_CREATE_SHARED_LIBRARY "") +SET(CMAKE_C_CREATE_MODULE_LIBRARY "") + diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake new file mode 100644 index 0000000..a4e2ec6 --- /dev/null +++ b/Modules/Platform/Generic.cmake @@ -0,0 +1,17 @@ +# This is a platform definition file for platforms without +# operating system, typically embedded platforms. +# It is used when CMAKE_SYSTEM_NAME is set to "Generic" +# +# It is intentionally empty, since nothing is known +# about the platform. So everything has to be specified +# in the system/compiler files ${CMAKE_SYSTEM_NAME}-<compiler_basename>.cmake +# and/or ${CMAKE_SYSTEM_NAME}-<compiler_basename>-${CMAKE_SYSTEM_PROCESSOR}.cmake + +# (embedded) targets without operating system usually don't support shared libraries +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +# To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH +# works at least for some simple cases: +SET(CMAKE_SYSTEM_INCLUDE_PATH /include ) +SET(CMAKE_SYSTEM_LIBRARY_PATH /lib ) +SET(CMAKE_SYSTEM_PROGRAM_PATH /bin ) 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..eb909fe --- /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 distribute 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-HP-ASM.cmake b/Modules/Platform/HP-UX-HP-ASM.cmake new file mode 100644 index 0000000..0a85905 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-ASM.cmake @@ -0,0 +1,6 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(ASM) + +set(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-E -b +nodefaultrpath -L/usr/lib") + +set(CMAKE_ASM_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake new file mode 100644 index 0000000..d83e01b --- /dev/null +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -0,0 +1,11 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(C) + +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b +nodefaultrpath -L/usr/lib") + +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>") +set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <FLAGS> -o <OBJECT> -c <SOURCE>") + +# use ld directly to create shared libraries for hp cc +set(CMAKE_C_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake new file mode 100644 index 0000000..8f3c70c --- /dev/null +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -0,0 +1,16 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(CXX) + +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E,+nodefaultrpath -b -L/usr/lib") + +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>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o" + ) + +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake new file mode 100644 index 0000000..5a3ab19 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -0,0 +1,7 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(Fortran) + +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-E -b -L/usr/lib") + +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "ld <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake new file mode 100644 index 0000000..5e70d31 --- /dev/null +++ b/Modules/Platform/HP-UX-HP.cmake @@ -0,0 +1,34 @@ + +#============================================================================= +# Copyright 2002-2011 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 distribute 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_HP) + return() +endif() +set(__HPUX_COMPILER_HP 1) +set(_Wl_C "") +set(_Wl_CXX "-Wl,") +set(_Wl_Fortran "") +set(_Wl_ASM "") + +macro(__hpux_compiler_hp lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "${_Wl_${lang}}+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "${_Wl_${lang}}+h") + set(CMAKE_EXECUTABLE_RUNTIME_${lang}_FLAG "-Wl,+b") + + set(CMAKE_${lang}_FLAGS_INIT "") +endmacro() diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake new file mode 100644 index 0000000..ab3dc22 --- /dev/null +++ b/Modules/Platform/HP-UX.cmake @@ -0,0 +1,50 @@ +SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib) + +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so +SET(CMAKE_DL_LIBS "dld") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a") +SET(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so") + +# The HP linker needs to find transitive shared library dependencies +# in the -L path. Therefore the runtime path must be added to the +# link line with -L flags. +SET(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1) +SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) + +# set flags for gcc support +INCLUDE(Platform/UnixPaths) + +# Look in both 32-bit and 64-bit implict link directories, but tell +# CMake not to pass the paths to the linker. The linker will find the +# library for the proper architecture. In the future we should detect +# which path will be used by the linker. Since the pointer type size +# CMAKE_SIZEOF_VOID_P is not set until after this file executes, we +# would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point +# (after CMakeTest(LANG)Compiler.cmake runs for at least one language). +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32) +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /usr/lib/hpux32 /usr/lib/hpux64) + +# Initialize C and CXX 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. Note that C modules and shared +# libs are built using ld directly so we leave off the "-Wl," portion. +FOREACH(type SHARED_LIBRARY SHARED_MODULE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default") +ENDFOREACH(type) +FOREACH(type EXE) + SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive") + SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default") +ENDFOREACH(type) +FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive") + SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default") +ENDFOREACH(type) + diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake new file mode 100644 index 0000000..8277a24 --- /dev/null +++ b/Modules/Platform/Haiku.cmake @@ -0,0 +1,22 @@ +SET(BEOS 1) + +SET(CMAKE_DL_LIBS root be) +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + +INCLUDE(Platform/UnixPaths) +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include) +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib) +LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin) +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib) +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty) +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86) + +IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + SET(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH + "Install path prefix, prepended onto install directories." FORCE) +ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake new file mode 100644 index 0000000..fac941f --- /dev/null +++ b/Modules/Platform/IRIX.cmake @@ -0,0 +1,45 @@ +SET(CMAKE_DL_LIBS "") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") + SET (CMAKE_C_FLAGS_INIT "") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) +# set flags for gcc support +INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + +# 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) + +# The IRIX linker needs to find transitive shared library dependencies +# in the -L path. +SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake new file mode 100644 index 0000000..b60a7f2 --- /dev/null +++ b/Modules/Platform/IRIX64.cmake @@ -0,0 +1,73 @@ +SET(CMAKE_DL_LIBS "") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +IF(NOT CMAKE_COMPILER_IS_GNUCC) + # Set default flags init. + SET(CMAKE_C_FLAGS_INIT "") + SET(CMAKE_CXX_FLAGS_INIT "") + SET(CMAKE_Fortran_FLAGS_INIT "") + SET(CMAKE_EXE_LINKER_FLAGS_INIT "") + SET(CMAKE_SHARED_LINKER_FLAGS_INIT "") + SET(CMAKE_MODULE_LINKER_FLAGS_INIT "") + + # If no -o32, -n32, or -64 flag is given, set a reasonable default. + IF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + ELSE("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + # Check if this is a 64-bit CMake. + IF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") + EXEC_PROGRAM(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) + SET(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL + "Output of file command on ${CMAKE_COMMAND}.") + ENDIF(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") + + # Set initial flags to match cmake executable. + IF(CMAKE_FILE_SELF MATCHES " 64-bit ") + SET(CMAKE_C_FLAGS_INIT "-64") + SET(CMAKE_CXX_FLAGS_INIT "-64") + SET(CMAKE_Fortran_FLAGS_INIT "-64") + SET(CMAKE_EXE_LINKER_FLAGS_INIT "-64") + SET(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") + SET(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") + ENDIF(CMAKE_FILE_SELF MATCHES " 64-bit ") + ENDIF("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") + + # Set remaining defaults. + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) +INCLUDE(Platform/UnixPaths) + +IF(NOT CMAKE_COMPILER_IS_GNUCC) + 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>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + 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>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + ) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) + +# 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) + +# The IRIX linker needs to find transitive shared library dependencies +# in the -L path. +SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/Linux-Absoft-Fortran.cmake b/Modules/Platform/Linux-Absoft-Fortran.cmake new file mode 100644 index 0000000..beb41a3 --- /dev/null +++ b/Modules/Platform/Linux-Absoft-Fortran.cmake @@ -0,0 +1 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-X -v") # Runs gcc under the hood. diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake new file mode 100644 index 0000000..dbf8956 --- /dev/null +++ b/Modules/Platform/Linux-Clang-C.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-C) diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake new file mode 100644 index 0000000..8fe251c --- /dev/null +++ b/Modules/Platform/Linux-Clang-CXX.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-CXX) diff --git a/Modules/Platform/Linux-GNU-C.cmake b/Modules/Platform/Linux-GNU-C.cmake new file mode 100644 index 0000000..3ab142f --- /dev/null +++ b/Modules/Platform/Linux-GNU-C.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(C) diff --git a/Modules/Platform/Linux-GNU-CXX.cmake b/Modules/Platform/Linux-GNU-CXX.cmake new file mode 100644 index 0000000..9e4f904 --- /dev/null +++ b/Modules/Platform/Linux-GNU-CXX.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(CXX) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake new file mode 100644 index 0000000..e364c87 --- /dev/null +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(Fortran) diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake new file mode 100644 index 0000000..0e254c6 --- /dev/null +++ b/Modules/Platform/Linux-GNU.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2010 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 distribute 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(__LINUX_COMPILER_GNU) + return() +endif() +set(__LINUX_COMPILER_GNU 1) + +macro(__linux_compiler_gnu lang) + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") +endmacro() diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake new file mode 100644 index 0000000..c909e68 --- /dev/null +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-Intel) +__linux_compiler_intel(C) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake new file mode 100644 index 0000000..0b7daf4 --- /dev/null +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-Intel) +__linux_compiler_intel(CXX) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake new file mode 100644 index 0000000..342b5c2 --- /dev/null +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -0,0 +1,4 @@ +INCLUDE(Platform/Linux-Intel) +__linux_compiler_intel(Fortran) +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -i_dynamic -nofor_main") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake new file mode 100644 index 0000000..dea8b90 --- /dev/null +++ b/Modules/Platform/Linux-Intel.cmake @@ -0,0 +1,48 @@ + +#============================================================================= +# 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 distribute 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(__LINUX_COMPILER_INTEL) + return() +endif() +set(__LINUX_COMPILER_INTEL 1) + +if(NOT XIAR) + set(_intel_xiar_hints) + foreach(lang C CXX Fortran) + if(IS_ABSOLUTE "${CMAKE_${lang}_COMPILER}") + get_filename_component(_hint "${CMAKE_${lang}_COMPILER}" PATH) + list(APPEND _intel_xiar_hints ${_hint}) + endif() + endforeach() + find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints}) + mark_as_advanced(XIAR) +endif(NOT XIAR) + +macro(__linux_compiler_intel lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") + + if(XIAR) + # INTERPROCEDURAL_OPTIMIZATION + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO + "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "${XIAR} -s <TARGET> ") + endif() +endmacro() diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake new file mode 100644 index 0000000..353bae6 --- /dev/null +++ b/Modules/Platform/Linux-NAG-Fortran.cmake @@ -0,0 +1,10 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need one "-Wl," level to send flag through to gcc. +# Use "-Xlinker" to get through gcc to real linker. +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic") diff --git a/Modules/Platform/Linux-PGI-C.cmake b/Modules/Platform/Linux-PGI-C.cmake new file mode 100644 index 0000000..edf4f3f --- /dev/null +++ b/Modules/Platform/Linux-PGI-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(C) diff --git a/Modules/Platform/Linux-PGI-CXX.cmake b/Modules/Platform/Linux-PGI-CXX.cmake new file mode 100644 index 0000000..d425f88 --- /dev/null +++ b/Modules/Platform/Linux-PGI-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(CXX) diff --git a/Modules/Platform/Linux-PGI-Fortran.cmake b/Modules/Platform/Linux-PGI-Fortran.cmake new file mode 100644 index 0000000..e8731a3 --- /dev/null +++ b/Modules/Platform/Linux-PGI-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PGI) +__linux_compiler_pgi(Fortran) diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake new file mode 100644 index 0000000..ef06acd --- /dev/null +++ b/Modules/Platform/Linux-PGI.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 distribute 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(__LINUX_COMPILER_PGI) + return() +endif() +set(__LINUX_COMPILER_PGI 1) + +macro(__linux_compiler_pgi lang) + # Shared library compile and link flags. + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-PathScale-C.cmake b/Modules/Platform/Linux-PathScale-C.cmake new file mode 100644 index 0000000..009f398 --- /dev/null +++ b/Modules/Platform/Linux-PathScale-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(C) diff --git a/Modules/Platform/Linux-PathScale-CXX.cmake b/Modules/Platform/Linux-PathScale-CXX.cmake new file mode 100644 index 0000000..b6a5771 --- /dev/null +++ b/Modules/Platform/Linux-PathScale-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(CXX) diff --git a/Modules/Platform/Linux-PathScale-Fortran.cmake b/Modules/Platform/Linux-PathScale-Fortran.cmake new file mode 100644 index 0000000..5662d3d --- /dev/null +++ b/Modules/Platform/Linux-PathScale-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(Fortran) diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake new file mode 100644 index 0000000..c131af2 --- /dev/null +++ b/Modules/Platform/Linux-PathScale.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2002-2010 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 distribute 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(__LINUX_COMPILER_PATHSCALE) + return() +endif() +set(__LINUX_COMPILER_PATHSCALE 1) + +macro(__linux_compiler_pathscale lang) + # Shared library compile and link flags. + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake new file mode 100644 index 0000000..8ee9658 --- /dev/null +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -0,0 +1,9 @@ +# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it. +# Query the compiler flags to detect whether to use -Wl. +execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error) +if("${_cxx_flags}" MATCHES "\n-W[^\n]*component") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,") +else() + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +endif() +SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/Linux-VisualAge-C.cmake b/Modules/Platform/Linux-VisualAge-C.cmake new file mode 100644 index 0000000..0622b63 --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-C.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-C) diff --git a/Modules/Platform/Linux-VisualAge-CXX.cmake b/Modules/Platform/Linux-VisualAge-CXX.cmake new file mode 100644 index 0000000..b878ba0 --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-CXX) diff --git a/Modules/Platform/Linux-VisualAge-Fortran.cmake b/Modules/Platform/Linux-VisualAge-Fortran.cmake new file mode 100644 index 0000000..1939a8a --- /dev/null +++ b/Modules/Platform/Linux-VisualAge-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-XL-Fortran) diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake new file mode 100644 index 0000000..b1b07f6 --- /dev/null +++ b/Modules/Platform/Linux-XL-C.cmake @@ -0,0 +1 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake new file mode 100644 index 0000000..071a975 --- /dev/null +++ b/Modules/Platform/Linux-XL-CXX.cmake @@ -0,0 +1 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake new file mode 100644 index 0000000..5da574e --- /dev/null +++ b/Modules/Platform/Linux-XL-Fortran.cmake @@ -0,0 +1 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-como.cmake b/Modules/Platform/Linux-como.cmake new file mode 100644 index 0000000..7ea7320 --- /dev/null +++ b/Modules/Platform/Linux-como.cmake @@ -0,0 +1,17 @@ +# create a shared C++ library +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + +# create a C++ static library +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "<CMAKE_RANLIB> <TARGET> ") + +SET(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> --prelink_objects <OBJECTS>" + "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake new file mode 100644 index 0000000..38f469b --- /dev/null +++ b/Modules/Platform/Linux.cmake @@ -0,0 +1,57 @@ +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 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) + +# Debian policy requires that shared libraries be installed without +# executable permission. Fedora policy requires that shared libraries +# be installed with the executable permission. Since the native tools +# create shared libraries with execute permission in the first place a +# reasonable policy seems to be to install with execute permission by +# default. In order to support debian packages we provide an option +# here. The option default is based on the current distribution, but +# packagers can set it explicitly on the command line. +IF(DEFINED CMAKE_INSTALL_SO_NO_EXE) + # Store the decision variable in the cache. This preserves any + # setting the user provides on the command line. + SET(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL + "Install .so files without execute permission.") +ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE) + # Store the decision variable as an internal cache entry to avoid + # checking the platform every time. This option is advanced enough + # that only package maintainers should need to adjust it. They are + # capable of providing a setting on the command line. + IF(EXISTS "/etc/debian_version") + SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL + "Install .so files without execute permission.") + ELSE(EXISTS "/etc/debian_version") + SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL + "Install .so files without execute permission.") + ENDIF(EXISTS "/etc/debian_version") +ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE) + +# Match multiarch library directory names. +SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*") + +INCLUDE(Platform/UnixPaths) + +# Debian has lib64 paths only for compatibility so they should not be +# searched. +IF(EXISTS "/etc/debian_version") + SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) +ENDIF(EXISTS "/etc/debian_version") diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake new file mode 100644 index 0000000..1e3e239 --- /dev/null +++ b/Modules/Platform/MP-RAS.cmake @@ -0,0 +1,10 @@ +IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") + SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.") + +INCLUDE(Platform/UnixPaths) + + diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake new file mode 100644 index 0000000..0fb8636 --- /dev/null +++ b/Modules/Platform/NetBSD.cmake @@ -0,0 +1,13 @@ +IF(EXISTS /usr/include/dlfcn.h) + SET(CMAKE_DL_LIBS "") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared + SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty + SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") + SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +ENDIF(EXISTS /usr/include/dlfcn.h) + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake new file mode 100644 index 0000000..076410a --- /dev/null +++ b/Modules/Platform/OSF1.cmake @@ -0,0 +1,45 @@ +SET(CMAKE_DL_LIBS "") + +IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") +ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") +IF(CMAKE_SYSTEM MATCHES "OSF1-1.*") + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic + SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic +ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*") + + + +IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") + ELSE(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ") + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + ELSE(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ") + ENDIF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") + +SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... + +IF(CMAKE_COMPILER_IS_GNUCXX) + # include the gcc flags +ELSE (CMAKE_COMPILER_IS_GNUCXX) + # use default OSF compiler flags + SET (CMAKE_C_FLAGS_INIT "") + SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2") + SET (CMAKE_CXX_FLAGS_INIT "") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") +ENDIF(CMAKE_COMPILER_IS_GNUCXX) +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake new file mode 100644 index 0000000..b4ed66f --- /dev/null +++ b/Modules/Platform/OpenBSD.cmake @@ -0,0 +1,18 @@ +INCLUDE(Platform/NetBSD) + +# On OpenBSD, the compile time linker does not share it's configuration with +# the runtime linker. This will extract the library search paths from the +# system's ld.so.hints file which will allow CMake to set the appropriate +# -rpath-link flags +IF(NOT CMAKE_PLATFORM_RUNTIME_PATH) + EXECUTE_PROCESS(COMMAND /sbin/ldconfig -r + OUTPUT_VARIABLE LDCONFIG_HINTS + ERROR_QUIET) + STRING(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" + LDCONFIG_HINTS "${LDCONFIG_HINTS}") + STRING(REGEX REPLACE ":" ";" + CMAKE_PLATFORM_RUNTIME_PATH + "${LDCONFIG_HINTS}") +ENDIF() + +SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) diff --git a/Modules/Platform/OpenVMS.cmake b/Modules/Platform/OpenVMS.cmake new file mode 100644 index 0000000..c52effa --- /dev/null +++ b/Modules/Platform/OpenVMS.cmake @@ -0,0 +1,8 @@ +INCLUDE(Platform/UnixPaths) + +SET(CMAKE_C_CREATE_STATIC_LIBRARY + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>" + "<CMAKE_RANLIB> <TARGET>" + ) +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake new file mode 100644 index 0000000..8cdbe02 --- /dev/null +++ b/Modules/Platform/QNX.cmake @@ -0,0 +1,33 @@ +SET(QNXNTO 1) + +# 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) + +SET(CMAKE_DL_LIBS "") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") +SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 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) +# force the language to be c++ since qnx only has gcc and not g++ and c++? +SET(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/RISCos.cmake b/Modules/Platform/RISCos.cmake new file mode 100644 index 0000000..3b2a092 --- /dev/null +++ b/Modules/Platform/RISCos.cmake @@ -0,0 +1,6 @@ +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +SET(CMAKE_DL_LIBS "") +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") + +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/SCO_SV.cmake b/Modules/Platform/SCO_SV.cmake new file mode 100644 index 0000000..cbdcb7d --- /dev/null +++ b/Modules/Platform/SCO_SV.cmake @@ -0,0 +1,2 @@ +SET(CMAKE_DL_LIBS "") +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake new file mode 100644 index 0000000..4592fdd --- /dev/null +++ b/Modules/Platform/SINIX.cmake @@ -0,0 +1,2 @@ +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/SunOS-GNU-C.cmake b/Modules/Platform/SunOS-GNU-C.cmake new file mode 100644 index 0000000..6a96c00 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(C) 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-Fortran.cmake b/Modules/Platform/SunOS-GNU-Fortran.cmake new file mode 100644 index 0000000..c6b1888 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(Fortran) diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake new file mode 100644 index 0000000..7169056 --- /dev/null +++ b/Modules/Platform/SunOS-GNU.cmake @@ -0,0 +1,34 @@ + +#============================================================================= +# 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 distribute 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") + + # 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() +endmacro() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake new file mode 100644 index 0000000..9f2ee2e --- /dev/null +++ b/Modules/Platform/SunOS.cmake @@ -0,0 +1,30 @@ +IF(CMAKE_SYSTEM MATCHES "SunOS-4.*") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r") + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") + SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*") + +IF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + ELSE(CMAKE_COMPILER_IS_GNUCC) + # Take default rule from CMakeDefaultMakeRuleVariables.cmake. + ENDIF(CMAKE_COMPILER_IS_GNUCC) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) +INCLUDE(Platform/UnixPaths) + +# Add the compiler's implicit link directories. +IF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) +ENDIF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) + +# The Sun linker needs to find transitive shared library dependencies +# in the -L path. +SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) + +# Shared libraries with no builtin soname may not be linked safely by +# specifying the file path. +SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) diff --git a/Modules/Platform/Tru64.cmake b/Modules/Platform/Tru64.cmake new file mode 100644 index 0000000..cf9d17b --- /dev/null +++ b/Modules/Platform/Tru64.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/UnixPaths) + diff --git a/Modules/Platform/ULTRIX.cmake b/Modules/Platform/ULTRIX.cmake new file mode 100644 index 0000000..4d0cf75 --- /dev/null +++ b/Modules/Platform/ULTRIX.cmake @@ -0,0 +1,5 @@ +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0") +SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") +SET(CMAKE_DL_LIBS "") +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-D,08000000") +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake new file mode 100644 index 0000000..3b50e0a --- /dev/null +++ b/Modules/Platform/UNIX_SV.cmake @@ -0,0 +1,3 @@ +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport") +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake new file mode 100644 index 0000000..5ee7ddb --- /dev/null +++ b/Modules/Platform/UnixPaths.cmake @@ -0,0 +1,88 @@ + +#============================================================================= +# Copyright 2006-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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +IF(__UNIX_PATHS_INCLUDED) + RETURN() +ENDIF() +SET(__UNIX_PATHS_INCLUDED 1) + +SET(UNIX 1) + +# also add the install directory of the running cmake to the search directories +# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) + +# List common installation prefixes. These will be used for all +# search types. +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Standard + /usr/local /usr / + + # CMake install location + "${_CMAKE_INSTALL_DIR}" + + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + ) + +# List common include file locations not under the common prefixes. +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH + # Windows API on Cygwin + /usr/include/w32api + + # X11 + /usr/X11R6/include /usr/include/X11 + + # Other + /usr/pkg/include + /opt/csw/include /opt/include + /usr/openwin/include + ) + +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH + # Windows API on Cygwin + /usr/lib/w32api + + # X11 + /usr/X11R6/lib /usr/lib/X11 + + # Other + /usr/pkg/lib + /opt/csw/lib /opt/lib + /usr/openwin/lib + ) + +LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH + /usr/pkg/bin + ) + +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + /lib /usr/lib /usr/lib32 /usr/lib64 + ) + +LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) +LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) + +# Enable use of lib64 search path variants by default. +SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake new file mode 100644 index 0000000..c324bc8 --- /dev/null +++ b/Modules/Platform/UnixWare.cmake @@ -0,0 +1,3 @@ +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport") +INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake new file mode 100644 index 0000000..ebb74a1 --- /dev/null +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Borland) +__borland_language(C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake new file mode 100644 index 0000000..1260c0e --- /dev/null +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Borland) +__borland_language(CXX) diff --git a/Modules/Platform/Windows-Borland.cmake b/Modules/Platform/Windows-Borland.cmake new file mode 100644 index 0000000..5c402bd --- /dev/null +++ b/Modules/Platform/Windows-Borland.cmake @@ -0,0 +1,121 @@ + +#============================================================================= +# 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 distribute 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(__WINDOWS_BORLAND) + return() +endif() +set(__WINDOWS_BORLAND 1) + +SET(BORLAND 1) + +# Borland target type flags (bcc32 -h -t): +# -tW GUI App (implies -U__CONSOLE__) +# -tWC Console App (implies -D__CONSOLE__=1) +# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) +# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) +# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) +# +# Notes: +# - The flags affect linking so we pass them to the linker. +# - The flags affect preprocessing so we pass them to the compiler. +# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. +# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +set(_RTLDLL "-tWR -tW-") +set(_COMPILE_C "-c") +set(_COMPILE_CXX "-P -c") + +SET(CMAKE_LIBRARY_PATH_FLAG "-L") +SET(CMAKE_LINK_LIBRARY_FLAG "") + +SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") + +# uncomment these out to debug makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + +# Borland cannot handle + in the file name, so mangle object file name +SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") + +# extra flags for a win32 exe +SET(CMAKE_CREATE_WIN32_EXE "-tW" ) +# extra flags for a console app +SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) + +SET (CMAKE_BUILD_TYPE Debug CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") + +SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + +macro(__borland_language lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") + + # compile a source file into an object file + # place <DEFINES> outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${_RTLDLL} <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" + ) + + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + # "implib -c -w <TARGET_IMPLIB> <TARGET>" + ) + + # place <DEFINES> outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "cpp32 <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}" + ) + # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not + + # Create a module library. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}" + ) + + # Create an import library for another target. + set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY + "implib -c -w <TARGET_IMPLIB> <TARGET>" + ) + + # Create a shared library. + # First create a module and then its import library. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + ${CMAKE_${lang}_CREATE_SHARED_MODULE} + ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY} + ) + + # create a static library + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}" + ) + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "-tWM") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od") + set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib") +endmacro() diff --git a/Modules/Platform/Windows-G95-Fortran.cmake b/Modules/Platform/Windows-G95-Fortran.cmake new file mode 100644 index 0000000..af08008 --- /dev/null +++ b/Modules/Platform/Windows-G95-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-Fortran) diff --git a/Modules/Platform/Windows-GNU-C.cmake b/Modules/Platform/Windows-GNU-C.cmake new file mode 100644 index 0000000..ecf89dc --- /dev/null +++ b/Modules/Platform/Windows-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(C) diff --git a/Modules/Platform/Windows-GNU-CXX.cmake b/Modules/Platform/Windows-GNU-CXX.cmake new file mode 100644 index 0000000..23e6552 --- /dev/null +++ b/Modules/Platform/Windows-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(CXX) diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake new file mode 100644 index 0000000..c66feed --- /dev/null +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(Fortran) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake new file mode 100644 index 0000000..1d3e4b5 --- /dev/null +++ b/Modules/Platform/Windows-GNU.cmake @@ -0,0 +1,127 @@ + +#============================================================================= +# 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 distribute 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(__WINDOWS_GNU) + return() +endif() +set(__WINDOWS_GNU 1) + +set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") + +set(CMAKE_EXECUTABLE_SUFFIX ".exe") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +set(CMAKE_SHARED_MODULE_SUFFIX ".dll") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +if(MSYS OR MINGW) + set(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib +endif() + +if(MINGW) + set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") +endif() + +set(CMAKE_DL_LIBS "") +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LINK_LIBRARY_FLAG "-l") +set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") + +# Check if GNU ld is too old to support @FILE syntax. +set(__WINDOWS_GNU_LD_RESPONSE 1) +execute_process(COMMAND ld -v OUTPUT_VARIABLE _help ERROR_VARIABLE _help) +if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") + set(__WINDOWS_GNU_LD_RESPONSE 0) +endif() + +enable_language(RC) + +macro(__windows_compiler_gnu lang) + + if(MSYS OR MINGW) + # Create archiving rules to support large object file lists for static libraries. + set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") + + # 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) + endif() + + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) + + # We prefer "@" for response files but it is not supported by gcc 3. + execute_process(COMMAND ${CMAKE_${lang}_COMPILER} --version OUTPUT_VARIABLE _ver ERROR_VARIABLE _ver) + if("${_ver}" MATCHES "\\(GCC\\) 3\\.") + if("${lang}" STREQUAL "Fortran") + # The GNU Fortran compiler reports an error: + # no input files; unwilling to write output files + # when the response file is passed with "-Wl,@". + set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) + else() + # Use "-Wl,@" to pass the response file to the linker. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") + endif() + # The GNU 3.x compilers do not support response files (only linkers). + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0) + elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS) + # Use "@" to pass the response file to the front-end. + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") + endif() + + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_${lang}_COMPILER> <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> <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>") + + # Support very long lists of object files. + if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@") + foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE) + # The gcc/collect2/ld toolchain does not use response files + # internally so we cannot pass long object lists. Instead pass + # the object file list in a response file to the archiver to put + # them in a temporary archive. Hand the archive to the linker. + string(REPLACE "<OBJECTS>" "-Wl,--whole-archive <OBJECT_DIR>/objects.a -Wl,--no-whole-archive" + CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + set(CMAKE_${lang}_${rule} + "<CMAKE_COMMAND> -E remove -f <OBJECT_DIR>/objects.a" + "<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>" + "${CMAKE_${lang}_${rule}}" + ) + endforeach() + endif() +endmacro() diff --git a/Modules/Platform/Windows-Intel-ASM.cmake b/Modules/Platform/Windows-Intel-ASM.cmake new file mode 100644 index 0000000..31d08c7 --- /dev/null +++ b/Modules/Platform/Windows-Intel-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(ASM) diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake new file mode 100644 index 0000000..767fec5 --- /dev/null +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(C) diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake new file mode 100644 index 0000000..2845b0f --- /dev/null +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Windows-Intel) +set(_COMPILE_CXX " /TP") +set(_FLAGS_CXX " /GX /GR") +__windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake new file mode 100644 index 0000000..c959287 --- /dev/null +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -0,0 +1,11 @@ +include(Platform/Windows-Intel) +set(CMAKE_BUILD_TYPE_INIT Debug) +set(_COMPILE_Fortran " /fpp") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +__windows_compiler_intel(Fortran) +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake new file mode 100644 index 0000000..e7462ba --- /dev/null +++ b/Modules/Platform/Windows-Intel.cmake @@ -0,0 +1,108 @@ + +#============================================================================= +# Copyright 2002-2010 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 distribute 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(__WINDOWS_INTEL) + return() +endif() +set(__WINDOWS_INTEL 1) + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(WIN32 1) +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") +SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) + +# default to Debug builds +#SET(CMAKE_BUILD_TYPE_INIT Debug) +SET(CMAKE_BUILD_TYPE_INIT Release) + +SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +IF(MSVC_C_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +ELSEIF(MSVC_CXX_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +ELSEIF(MSVC_Fortran_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +ENDIF() +SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") + +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + +INCLUDE("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) + +IF(NOT _INTEL_XILINK_TEST_RUN) + EXECUTE_PROCESS(COMMAND xilink /? + ERROR_VARIABLE _XILINK_ERR + OUTPUT_VARIABLE _XILINK_HELP) + IF(_XILINK_HELP MATCHES MANIFEST) + SET(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) + ENDIF(_XILINK_HELP MATCHES MANIFEST) + IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") + FILE(WRITE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake + " +SET(_INTEL_XILINK_TEST_RUN 1) +SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) +") + ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") +ENDIF(NOT _INTEL_XILINK_TEST_RUN) + +macro(__windows_compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") + + if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + SET(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + SET(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + SET(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + endif() +endmacro() diff --git a/Modules/Platform/Windows-NMcl.cmake b/Modules/Platform/Windows-NMcl.cmake new file mode 100644 index 0000000..7add0b0 --- /dev/null +++ b/Modules/Platform/Windows-NMcl.cmake @@ -0,0 +1,4 @@ +# this is for the numega compiler which is really a front +# end for visual studio, but adds memory checking code. + +include(Platform/Windows-cl) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake new file mode 100644 index 0000000..56582ff --- /dev/null +++ b/Modules/Platform/Windows-cl.cmake @@ -0,0 +1,253 @@ +# try to load any previously computed information for C on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +# try to load any previously computed information for CXX on this platform +INCLUDE( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) + +SET(WIN32 1) + +INCLUDE(Platform/cl) + +SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") + MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") +# does the compiler support pdbtype and is it the newer compiler +IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +# for nmake we need to compute some information about the compiler +# that is being used. +# the compiler may be free command line, 6, 7, or 71, and +# each have properties that must be determined. +# to avoid running these tests with each cmake run, the +# test results are saved in CMakeCPlatform.cmake, a file +# that is automatically copied into try_compile directories +# by the global generator. +SET(MSVC_IDE 1) +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MSVC_IDE 0) + IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) + SET(CMAKE_VC_COMPILER_TESTS 1) + SET(testNmakeCLVersionFile + "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") + STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") + MESSAGE(STATUS "Check for CL compiler version") + SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) + IF (NOT CMAKE_C_COMPILER) + SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) + ENDIF(NOT CMAKE_C_COMPILER) + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} + ARGS /nologo -EP \"${testNmakeCLVersionFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(NOT CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining the version of compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") + STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" + compilerVersion "${compilerVersion}") + MESSAGE(STATUS "Check for CL compiler version - ${compilerVersion}") + SET(MSVC60) + SET(MSVC70) + SET(MSVC71) + SET(MSVC80) + SET(CMAKE_COMPILER_2005) + IF("${compilerVersion}" LESS 1300) + SET(MSVC60 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) + ENDIF("${compilerVersion}" LESS 1300) + IF("${compilerVersion}" EQUAL 1300) + SET(MSVC70 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1300) + IF("${compilerVersion}" EQUAL 1310) + SET(MSVC71 1) + SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) + ENDIF("${compilerVersion}" EQUAL 1310) + IF("${compilerVersion}" EQUAL 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" EQUAL 1400) + IF("${compilerVersion}" EQUAL 1500) + SET(MSVC90 1) + ENDIF("${compilerVersion}" EQUAL 1500) + IF("${compilerVersion}" EQUAL 1600) + SET(MSVC10 1) + ENDIF("${compilerVersion}" EQUAL 1600) + SET(MSVC_VERSION "${compilerVersion}") + ELSE(NOT CMAKE_COMPILER_RETURN) + MESSAGE(STATUS "Check for CL compiler version - failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining the version of compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + ENDIF(NOT CMAKE_COMPILER_RETURN) + # try to figure out if we are running the free command line + # tools from Microsoft. These tools do not provide debug libraries, + # so the link flags used have to be different. + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") + SET(testForFreeVCFile + "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") + STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") + MESSAGE(STATUS "Check if this is a free VC compiler") + EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 + ARGS /nologo /MD /EHsc + \"${testForFreeVCFile}\" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT + RETURN_VALUE CMAKE_COMPILER_RETURN + ) + IF(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if this is a free VC compiler failed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - yes") + SET(CMAKE_USING_VC_FREE_TOOLS 1) + ELSE(CMAKE_COMPILER_RETURN) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if this is a free VC compiler passed with the following output:\n" + "${CMAKE_COMPILER_OUTPUT}\n\n") + MESSAGE(STATUS "Check if this is a free VC compiler - no") + SET(CMAKE_USING_VC_FREE_TOOLS 0) + ENDIF(CMAKE_COMPILER_RETURN) + MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") + ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + +IF(MSVC_C_ARCHITECTURE_ID MATCHES 64) + SET(CMAKE_CL_64 1) +ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64) + SET(CMAKE_CL_64 0) +ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64) +IF(CMAKE_FORCE_WIN64) + SET(CMAKE_CL_64 1) +ENDIF(CMAKE_FORCE_WIN64) + +IF("${MSVC_VERSION}" GREATER 1599) + SET(MSVC_INCREMENTAL_DEFAULT ON) +ENDIF() + +# default to Debug builds +IF(MSVC_VERSION GREATER 1310) + # for 2005 make sure the manifest is put in the dll with mt + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") + # create a C shared library + SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + # create a C shared module just copy the shared library rule + SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") + SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") + + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") + SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") +ELSE(MSVC_VERSION GREATER 1310) + IF(CMAKE_USING_VC_FREE_TOOLS) + MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") + SET(CMAKE_BUILD_TYPE_INIT Release) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") + ELSE(CMAKE_USING_VC_FREE_TOOLS) + SET(CMAKE_BUILD_TYPE_INIT Debug) + SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + ENDIF(CMAKE_USING_VC_FREE_TOOLS) + SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") +ENDIF(MSVC_VERSION GREATER 1310) + +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +# set the stack size and the machine type +SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) +IF(NOT _MACHINE_ARCH_FLAG) + SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +ENDIF(NOT _MACHINE_ARCH_FLAG) +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype +# on versions that support it +SET( MSVC_INCREMENTAL_YES_FLAG "") +IF(NOT MSVC_INCREMENTAL_DEFAULT) + SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") +ELSE() + SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) +ENDIF() + +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") + +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + +# save computed information for this platform +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") + +IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) +ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in new file mode 100644 index 0000000..82a0e59 --- /dev/null +++ b/Modules/Platform/Windows-cl.cmake.in @@ -0,0 +1,14 @@ +SET(CMAKE_VC_COMPILER_TESTS_RUN 1) +SET(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@) +SET(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@) +SET(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@) +SET(CMAKE_CL_64 @CMAKE_CL_64@) +SET(MSVC60 @MSVC60@) +SET(MSVC70 @MSVC70@) +SET(MSVC71 @MSVC71@) +SET(MSVC80 @MSVC80@) +SET(MSVC90 @MSVC90@) +SET(MSVC10 @MSVC10@) +SET(MSVC_IDE @MSVC_IDE@) +SET(MSVC_VERSION @MSVC_VERSION@) +SET(WIN32 1) diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake new file mode 100644 index 0000000..f5046bf --- /dev/null +++ b/Modules/Platform/Windows-df.cmake @@ -0,0 +1,70 @@ +# compiler support for fortran CVF compiler on windows + +SET(CMAKE_WINDOWS_OBJECT_PATH 1) +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(WIN32 1) +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) + +SET(CMAKE_Fortran_MODDIR_FLAG "-module:") + +SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) + +# create a C++ static library +SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + +# compile a C++ file into an object file +SET(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /object:<OBJECT> <FLAGS> /compile_only <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") + +SET(CMAKE_Fortran_LINK_EXECUTABLE + "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /exe:<TARGET> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CREATE_WIN32_EXE /winapp) +SET(CMAKE_CREATE_CONSOLE_EXE ) + +IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") + SET (CMAKE_NO_BUILD_TYPE 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") + SET (CMAKE_NO_BUILD_TYPE 1) + SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING + "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") +# does the compiler support pdbtype and is it the newer compiler + +SET(CMAKE_BUILD_TYPE_INIT Debug) +SET (CMAKE_Fortran_FLAGS_INIT "") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/Optimize:2 /Define:NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/Optimize:1 /Define:NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/Optimize:1 /debug:full /Define:NDEBUG") + +SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") +IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") +ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") +ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) + +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake new file mode 100644 index 0000000..e96ebb5 --- /dev/null +++ b/Modules/Platform/Windows-wcl386.cmake @@ -0,0 +1,83 @@ +SET(CMAKE_LIBRARY_PATH_FLAG "libpath ") +SET(CMAKE_LINK_LIBRARY_FLAG "library ") +SET(CMAKE_LINK_LIBRARY_FILE_FLAG "library") + +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_WCL_QUIET) + SET(CMAKE_WLINK_QUIET) + SET(CMAKE_LIB_QUIET) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_WCL_QUIET "-zq") + SET(CMAKE_WLINK_QUIET "option quiet") + SET(CMAKE_LIB_QUIET "-q") +ENDIF(CMAKE_VERBOSE_MAKEFILE) + +set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) +SET(CMAKE_CREATE_CONSOLE_EXE "system nt" ) + +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) + +set (CMAKE_SHARED_LIBRARY_C_FLAGS "-bd" ) + +SET(CMAKE_RC_COMPILER "rc" ) + +SET(CMAKE_BUILD_TYPE_INIT Debug) +SET (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") +SET (CMAKE_C_FLAGS_INIT "-w=3 ") +SET (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") +SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +SET (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") +SET (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") +SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +SET(CMAKE_C_CREATE_IMPORT_LIBRARY + "wlib -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'") +SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) + +SET(CMAKE_C_LINK_EXECUTABLE + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + + +SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) + +# compile a C++ file into an object file +SET(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + +# compile a C file into an object file +SET(CMAKE_C_COMPILE_OBJECT + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + +# preprocess a C source file +SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + +# preprocess a C++ source file +SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_SHARED_MODULE + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + ${CMAKE_CXX_CREATE_SHARED_MODULE} + ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) + +# create a C shared library +SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) + +# create a C shared module +SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) + +# create a C++ static library +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ") + +# create a C static library +SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake new file mode 100644 index 0000000..8bc1b15 --- /dev/null +++ b/Modules/Platform/Windows-windres.cmake @@ -0,0 +1 @@ +SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff <FLAGS> <DEFINES> <SOURCE> <OBJECT>") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake new file mode 100644 index 0000000..09cb8d3 --- /dev/null +++ b/Modules/Platform/Windows.cmake @@ -0,0 +1,36 @@ +SET(WIN32 1) + +SET(CMAKE_STATIC_LIBRARY_PREFIX "") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") +SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +SET(CMAKE_IMPORT_LIBRARY_PREFIX "") +SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe +SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib") +SET(CMAKE_DL_LIBS "") + +SET(CMAKE_FIND_LIBRARY_PREFIXES "") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + +# for borland make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "Borland") + SET(CMAKE_START_TEMP_FILE "@&&|\n") + SET(CMAKE_END_TEMP_FILE "\n|") +ENDIF(CMAKE_GENERATOR MATCHES "Borland") + +# for nmake make long command lines are redirected to a file +# with the following syntax, see Windows-bcc32.cmake for use +IF(CMAKE_GENERATOR MATCHES "NMake") + SET(CMAKE_START_TEMP_FILE "@<<\n") + SET(CMAKE_END_TEMP_FILE "\n<<") +ENDIF(CMAKE_GENERATOR MATCHES "NMake") + +INCLUDE(Platform/WindowsPaths) + +# uncomment these out to debug nmake and borland makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake new file mode 100644 index 0000000..c7b15b3 --- /dev/null +++ b/Modules/Platform/WindowsPaths.cmake @@ -0,0 +1,96 @@ + +#============================================================================= +# Copyright 2006-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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Block multiple inclusion because "CMakeCInformation.cmake" includes +# "Platform/${CMAKE_SYSTEM_NAME}" even though the generic module +# "CMakeSystemSpecificInformation.cmake" already included it. +# The extra inclusion is a work-around documented next to the include() +# call, so this can be removed when the work-around is removed. +IF(__WINDOWS_PATHS_INCLUDED) + RETURN() +ENDIF() +SET(__WINDOWS_PATHS_INCLUDED 1) + +# Add the program-files folder(s) to the list of installation +# prefixes. +# +# Windows 64-bit Binary: +# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] +# ENV{ProgramFiles} = [C:\Program Files] +# ENV{ProgramW6432} = <not set> +# (executed from cygwin): +# ENV{ProgramFiles(x86)} = <not set> +# ENV{ProgramFiles} = [C:\Program Files] +# ENV{ProgramW6432} = <not set> +# +# Windows 32-bit Binary: +# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] +# ENV{ProgramFiles} = [C:\Program Files (x86)] +# ENV{ProgramW6432} = [C:\Program Files] +# (executed from cygwin): +# ENV{ProgramFiles(x86)} = <not set> +# ENV{ProgramFiles} = [C:\Program Files (x86)] +# ENV{ProgramW6432} = [C:\Program Files] +IF(DEFINED "ENV{ProgramW6432}") + # 32-bit binary on 64-bit windows. + # The 64-bit program files are in ProgramW6432. + LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") + + # The 32-bit program files are in ProgramFiles. + IF(DEFINED "ENV{ProgramFiles}") + LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + ENDIF() +ELSE() + # 64-bit binary, or 32-bit binary on 32-bit windows. + IF(DEFINED "ENV{ProgramFiles}") + LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") + ENDIF() + IF(DEFINED "ENV{ProgramFiles(x86)}") + # 64-bit binary. 32-bit program files are in ProgramFiles(x86). + LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles(x86)}") + ELSEIF(DEFINED "ENV{SystemDrive}") + # Guess the 32-bit program files location. + IF(EXISTS "$ENV{SystemDrive}/Program Files (x86)") + LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + "$ENV{SystemDrive}/Program Files (x86)") + ENDIF() + ENDIF() +ENDIF() + +# Add the CMake install location. +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) +GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") + +# Add other locations. +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + + # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) + / + ) + +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH + ) + +# mingw can also link against dlls which can also be in /bin, so list this too +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${CMAKE_INSTALL_PREFIX}/bin" + "${_CMAKE_INSTALL_DIR}/bin" + /bin + ) + +LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH + ) diff --git a/Modules/Platform/Xenix.cmake b/Modules/Platform/Xenix.cmake new file mode 100644 index 0000000..cf9d17b --- /dev/null +++ b/Modules/Platform/Xenix.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/UnixPaths) + diff --git a/Modules/Platform/cl.cmake b/Modules/Platform/cl.cmake new file mode 100644 index 0000000..c0f014b --- /dev/null +++ b/Modules/Platform/cl.cmake @@ -0,0 +1,62 @@ +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(MSVC 1) + +# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree +# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex +IF(NOT DEFINED CMAKE_LINKER) + SET(CMAKE_LINKER link) +ENDIF(NOT DEFINED CMAKE_LINKER) + +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) +# create a shared C++ library +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") +SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) + +# create a C shared library +SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") + +# create a C shared module +SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") + +# create a C++ static library +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + +# create a C static library +SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}") + +# compile a C++ file into an object file +SET(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + +# compile a C file into an object file +SET(CMAKE_C_COMPILE_OBJECT + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) +SET(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) +SET(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE + "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}") + diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake new file mode 100644 index 0000000..f0881c0 --- /dev/null +++ b/Modules/Platform/eCos.cmake @@ -0,0 +1,58 @@ +# support for eCos http://ecos.sourceware.org +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "") # -shared +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty + +SET(CMAKE_LINK_LIBRARY_SUFFIX "") +SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".a") # .a +SET(CMAKE_EXECUTABLE_SUFFIX ".elf") # same suffix as if built using UseEcos.cmake +SET(CMAKE_DL_LIBS "" ) + +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + + +INCLUDE(Platform/UnixPaths) + +# eCos can be built only with gcc +GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) +IF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + MESSAGE(FATAL_ERROR "GNU gcc is required for eCos") +ENDIF(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) +IF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + MESSAGE(FATAL_ERROR "GNU g++ is required for eCos") +ENDIF(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) + +# find eCos system files +FIND_PATH(ECOS_SYSTEM_CONFIG_HEADER_PATH NAMES pkgconf/system.h) +FIND_LIBRARY(ECOS_SYSTEM_TARGET_LIBRARY NAMES libtarget.a) + +IF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) + MESSAGE(FATAL_ERROR "Could not find eCos pkgconf/system.h. Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +ENDIF(NOT ECOS_SYSTEM_CONFIG_HEADER_PATH) + +IF(NOT ECOS_SYSTEM_TARGET_LIBRARY) + MESSAGE(FATAL_ERROR "Could not find eCos \"libtarget.a\". Build eCos first and set up CMAKE_FIND_ROOT_PATH correctly.") +ENDIF(NOT ECOS_SYSTEM_TARGET_LIBRARY) + +GET_FILENAME_COMPONENT(ECOS_LIBTARGET_DIRECTORY "${ECOS_SYSTEM_TARGET_LIBRARY}" PATH) +INCLUDE_DIRECTORIES(${ECOS_SYSTEM_CONFIG_HEADER_PATH}) +ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1) + +# special link commands for eCos executables +SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>") +SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostdlib -nostartfiles -L${ECOS_LIBTARGET_DIRECTORY} -Ttarget.ld <LINK_LIBRARIES>") + +# eCos doesn't support shared libs +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +SET(CMAKE_CXX_LINK_SHARED_LIBRARY ) +SET(CMAKE_CXX_LINK_MODULE_LIBRARY ) +SET(CMAKE_C_LINK_SHARED_LIBRARY ) +SET(CMAKE_C_LINK_MODULE_LIBRARY ) + diff --git a/Modules/Platform/gas.cmake b/Modules/Platform/gas.cmake new file mode 100644 index 0000000..c34aef1 --- /dev/null +++ b/Modules/Platform/gas.cmake @@ -0,0 +1,19 @@ +IF(UNIX) + SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) +ELSE(UNIX) + SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj) +ENDIF(UNIX) + +SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") + +SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY + "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> " + "<CMAKE_RANLIB> <TARGET> ") + +SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE + "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +# to be done +SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) +SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE) + diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake new file mode 100644 index 0000000..c1295fb --- /dev/null +++ b/Modules/Platform/kFreeBSD.cmake @@ -0,0 +1,4 @@ +# kFreeBSD looks just like Linux. +INCLUDE(Platform/Linux) + +SET(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*") diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake new file mode 100644 index 0000000..3ce42f6 --- /dev/null +++ b/Modules/Platform/syllable.cmake @@ -0,0 +1,31 @@ +# this is the platform file for the Syllable OS (http://www.syllable.org) +# Syllable is a free OS (GPL), which is mostly POSIX conform +# the linker accepts the rpath related arguments, but this is later on +# ignored by the runtime linker +# shared libs are found exclusively via the environment variable DLL_PATH, +# which may contain also dirs containing the special variable @bindir@ +# by default @bindir@/lib is part of DLL_PATH +# in order to run the cmake tests successfully it is required that also +# @bindir@/. and @bindir@/../lib are in DLL_PATH + + +SET(CMAKE_DL_LIBS "dl") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +#SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# 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) + +# these are Syllable specific: +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /usr/indexes) |