<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[154368] trunk/dports/_resources/port1.0/group/cmake-1.1.tcl</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/154368">154368</a></dd>
<dt>Author</dt> <dd>mk@macports.org</dd>
<dt>Date</dt> <dd>2016-10-28 22:12:22 +0200 (Fri, 28 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>cmake-1.1.tcl: new version of cmake portgroup (closes issue #52699)</pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdports_resourcesport10groupcmake11tcl">trunk/dports/_resources/port1.0/group/cmake-1.1.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdports_resourcesport10groupcmake11tcl"></a>
<div class="addfile"><h4>Added: trunk/dports/_resources/port1.0/group/cmake-1.1.tcl (0 => 154368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/_resources/port1.0/group/cmake-1.1.tcl                              (rev 0)
+++ trunk/dports/_resources/port1.0/group/cmake-1.1.tcl 2016-10-28 20:12:22 UTC (rev 154368)
</span><span class="lines">@@ -0,0 +1,309 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id$
+# $Id$
+#
+# Copyright (c) 2009 Orville Bennett <illogical1 at gmail.com>
+# Copyright (c) 2010-2015 The MacPorts Project
+# Copyright (c) 2015, 2016 R.J.V. Bertin
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# Usage:
+# PortGroup     cmake 1.1
+
+namespace eval cmake {
+    # our directory:
+    variable currentportgroupdir [file dirname [dict get [info frame 0] file]]
+}
+
+options cmake.out_of_source cmake.build_dir cmake.set_osx_architectures
+options cmake.install_rpath
+
+# make out-of-source builds the default (finally)
+default cmake.out_of_source         yes
+
+# set CMAKE_OSX_ARCHITECTURES when necessary.
+# This can be deactivated when (non-Apple) compilers are used
+# that don't support the corresponding -arch options.
+default cmake.set_osx_architectures yes
+
+default cmake.build_dir             {${workpath}/build}
+
+# minimal/initial value for the install rpath:
+default cmake.install_rpath         ${prefix}/lib
+
+# standard place to install extra CMake modules
+set cmake_share_module_dir ${prefix}/share/cmake/Modules
+
+# can use cmake or cmake-devel; default to cmake if not installed
+depends_build-append path:bin/cmake:cmake
+
+proc _cmake_get_build_dir {} {
+    if {[option cmake.out_of_source]} {
+        return [option cmake.build_dir]
+    }
+    return [option worksrcpath]
+}
+
+default configure.dir {[_cmake_get_build_dir]}
+
+pre-configure {
+    file mkdir ${configure.dir}
+}
+
+#FIXME: ccache works with cmake on linux
+configure.ccache    no
+
+configure.cmd       ${prefix}/bin/cmake
+
+configure.pre_args  -DCMAKE_INSTALL_PREFIX=${prefix}
+
+configure.args \
+                    -DCMAKE_VERBOSE_MAKEFILE=ON \
+                    -DCMAKE_COLOR_MAKEFILE=ON \
+                    -DCMAKE_BUILD_TYPE=MacPorts \
+                    -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
+                    -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \
+                    -DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
+                    -DCMAKE_MODULE_PATH=${cmake_share_module_dir} \
+                    -DCMAKE_FIND_FRAMEWORK=LAST \
+                    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
+                    -Wno-dev
+
+default configure.post_args {${worksrcpath}}
+
+# CMake honors set environment variables CFLAGS, CXXFLAGS, and LDFLAGS when it
+# is first run in a build directory to initialize CMAKE_C_FLAGS,
+# CMAKE_CXX_FLAGS, CMAKE_[EXE|SHARED|MODULE]_LINKER_FLAGS. However, be aware
+# that a CMake script can always override these flags when it runs, as they
+# are frequently set internally in functions of other CMake build variables!
+#
+# Attention: If you want to be sure that no compiler flags are passed via
+# configure.args, you have to manually clear configure.optflags, as it is set
+# to "-Os" by default and added to all language-specific flags. If you want to
+# turn off optimization, explicitly set configure.optflags to "-O0".
+
+# TODO: Handle configure.objcflags (cf. to CMake upstream ticket #4756
+#       "CMake needs an Objective-C equivalent of CMAKE_CXX_FLAGS"
+#       <http://public.kitware.com/Bug/view.php?id=4756>)
+
+# TODO: Handle the Fortran-specific configure.* variables:
+#       configure.fflags, configure.fcflags, configure.f90flags
+
+# TODO: Handle the Java-specific configure.classpath variable.
+
+pre-configure {
+    # The environment variable CPPFLAGS is not considered by CMake.
+    # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS"
+    # <http://www.cmake.org/Bug/view.php?id=12928>).
+    #
+    # But adding -I${prefix}/include to CFLAGS/CXXFLAGS is a bad idea.
+    # If any other flags are needed, we need to add them.
+
+    # In addition, CMake provides build-type-specific flags for
+    # Release (-O3 -DNDEBUG), Debug (-g), MinSizeRel (-Os -DNDEBUG), and
+    # RelWithDebInfo (-O2 -g -DNDEBUG). If the configure.optflags have been
+    # set (-Os by default), we have to remove the optimization flags from the
+    # from the concerned Release build type so that configure.optflags
+    # gets honored (Debug used by the +debug variant does not set
+    # optimization flags by default).
+    # NB: more recent CMake versions (>=3?) no longer take the env. variables into
+    # account, and thus require explicit use of ${configure.c*flags} below:
+#     if {${configure.optflags} ne ""} {
+#         configure.args-append   -DCMAKE_C_FLAGS="-DNDEBUG ${configure.cflags}" \
+#                                 -DCMAKE_CXX_FLAGS="-DNDEBUG ${configure.cxxflags}"
+#     }
+    # Using a custom BUILD_TYPE we can simply append to the env. variables,
+    # but why do we set -DNDEBUG?
+    configure.cflags-append     -DNDEBUG
+    configure.cxxflags-append   -DNDEBUG
+    # force newer CMake versions to take a change in compiler choice into account
+    # even if it is invoked in a build.dir that was configured before.
+    if {${configure.cc} ne ""} {
+        configure.args-append \
+                    -DCMAKE_C_COMPILER=${configure.cc}
+    }
+    if {${configure.cxx} ne ""} {
+        configure.args-append \
+                    -DCMAKE_CXX_COMPILER=${configure.cxx}
+    }
+
+
+    # process ${configure.cppflags} to extract include directives and other options
+    if {${configure.cppflags} ne ""} {
+        set cppflags [split ${configure.cppflags}]
+        # reset configure.cppflags; we don't want options in double in CPPFLAGS and CFLAGS/CXXFLAGS
+        set configure.cppflags ""
+        set next_is_path 0
+        foreach flag ${cppflags} {
+            if {${next_is_path}} {
+                # previous option was a lone -I
+                configure.cppflags-append       -I${flag}
+                set next_is_path 0
+            } else {
+                if {[string match "-I" ${flag}]} {
+                    # lone -I, store the next argument as a path
+                    # (or ignore if this is the last argument)
+                    set next_is_path 1
+                } elseif {[string match "-I*" ${flag}]} {
+                    # a -Ipath option
+                    configure.cppflags-append   ${flag}
+                } else {
+                    # everything else must go into CFLAGS and CXXFLAGS
+                    configure.cflags-append     ${flag}
+                    configure.cxxflags-append   ${flag}
+                    # append to the ObjC flags too, even if CMake ignores them:
+                    configure.objcflags-append  ${flag}
+                    configure.objcxxflags-append   ${flag}
+                }
+            }
+        }
+        if {${configure.cppflags} ne ""} {
+            ui_debug "-DINCLUDE_DIRECTORIES=${configure.cppflags}"
+            configure.args-append   -DINCLUDE_DIRECTORIES:PATH="${configure.cppflags}"
+        }
+        ui_debug "CFLAGS=\"${configure.cflags}\" CXXFLAGS=\"${configure.cxxflags}\""
+    }
+
+    if {${cmake.install_rpath} ne ""} {
+        ui_debug "Adding -DCMAKE_INSTALL_RPATH=[join ${cmake.install_rpath} \;] to configure.args"
+        configure.args-append -DCMAKE_INSTALL_RPATH="[join ${cmake.install_rpath} \;]"
+    }
+}
+
+post-configure {
+    # either compile_commands.json was created because of -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+    # in which case touch'ing it won't change anything. Or else it wasn't created, in which case
+    # we'll create a file that corresponds, i.e. containing an empty json array.
+    if {![file exists ${build.dir}/compile_commands.json]} {
+        if {![catch {set fd [open "${build.dir}/compile_commands.json" "w"]} err]} {
+            puts ${fd} "\[\n\]"
+            close ${fd}
+        }
+    }
+    if {![catch {set fd [open "${workpath}/.macports.${subport}.configure.cmd" "w"]} err]} {
+        foreach var [array names ::env] {
+            puts ${fd} "${var}=$::env(${var})"
+        }
+        puts ${fd} "[join [lrange [split ${configure.env} " "] 0 end] "\n"]"
+        # the following variables are no longer set in the environment at this point:
+        puts ${fd} "CPP=\"${configure.cpp}\""
+        puts ${fd} "CC=\"${configure.cc}\""
+        puts ${fd} "CXX=\"${configure.cxx}\""
+        if {${configure.objcxx} ne ${configure.cxx}} {
+            puts ${fd} "OBJCXX=\"${configure.objcxx}\""
+        }
+        puts ${fd} "CFLAGS=\"${configure.cflags}\""
+        puts ${fd} "CXXFLAGS=\"${configure.cxxflags}\""
+        if {${configure.objcflags} ne ${configure.cflags}} {
+            puts ${fd} "OBJCFLAGS=\"${configure.objcflags}\""
+        }
+        if {${configure.objcxxflags} ne ${configure.cxxflags}} {
+            puts ${fd} "OBJCXXFLAGS=\"${configure.objcxxflags}\""
+        }
+        puts ${fd} "LDFLAGS=\"${configure.ldflags}\""
+        if {${configure.optflags} ne ""} {
+            puts ${fd} "configure.optflags=\"${configure.optflags}\""
+        }
+        puts ${fd} "\ncd ${worksrcpath}"
+        puts ${fd} "${configure.cmd} ${configure.pre_args} ${configure.args} ${configure.post_args}"
+        close ${fd}
+        unset fd
+    }
+}
+
+platform darwin {
+    set cmake._archflag_vars {cc_archflags cxx_archflags ld_archflags objc_archflags objcxx_archflags \
+        universal_cflags universal_cxxflags universal_ldflags universal_objcflags universal_objcxxflags}
+    pre-configure {
+        # cmake will add the correct -arch flag(s) based on the value of CMAKE_OSX_ARCHITECTURES.
+        if {[variant_exists universal] && [variant_isset universal]} {
+            if {[info exists universal_archs_supported]} {
+                merger_arch_compiler no
+                merger_arch_flag no
+                if {${cmake.set_osx_architectures}} {
+                    global merger_configure_args
+                    foreach arch ${universal_archs_to_use} {
+                        lappend merger_configure_args(${arch}) -DCMAKE_OSX_ARCHITECTURES=${arch}
+                    }
+                }
+            } elseif {${cmake.set_osx_architectures}} {
+                configure.universal_args-append \
+                    -DCMAKE_OSX_ARCHITECTURES="[join ${configure.universal_archs} \;]"
+            }
+        } elseif {${cmake.set_osx_architectures}} {
+            configure.args-append \
+                -DCMAKE_OSX_ARCHITECTURES="${configure.build_arch}"
+        }
+
+        # Setting our own -arch flags is unnecessary (in the case of a non-universal build) or even
+        # harmful (in the case of a universal build, because it causes the compiler identification to
+        # fail; see http://public.kitware.com/pipermail/cmake-developers/2015-September/026586.html).
+        # Save all archflag-containing variables before changing any of them, because some of them
+        # declare their default value based on the value of another.
+        foreach archflag_var ${cmake._archflag_vars} {
+            global cmake._saved_${archflag_var}
+            set cmake._saved_${archflag_var} [option configure.${archflag_var}]
+        }
+        foreach archflag_var ${cmake._archflag_vars} {
+            configure.${archflag_var}
+        }
+
+        configure.args-append -DCMAKE_OSX_DEPLOYMENT_TARGET="${macosx_deployment_target}"
+
+        if {${configure.sdkroot} != ""} {
+            configure.args-append -DCMAKE_OSX_SYSROOT="${configure.sdkroot}"
+        } else {
+            configure.args-append -DCMAKE_OSX_SYSROOT="/"
+        }
+    }
+    post-configure {
+        # Although cmake wants us not to set -arch flags ourselves when we run cmake,
+        # ports might have need to access these variables at other times.
+        foreach archflag_var ${cmake._archflag_vars} {
+            global cmake._saved_${archflag_var}
+            configure.${archflag_var} [set cmake._saved_${archflag_var}]
+        }
+    }
+}
+
+configure.universal_args-delete --disable-dependency-tracking
+
+variant debug description "Enable debug binaries" {
+    configure.args-replace  -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Debug
+}
+
+# cmake doesn't like --enable-debug, so in case a portfile sets
+# --enable-debug (regardless of variant) we remove it
+if {[string first "--enable-debug" ${configure.args}] > -1} {
+    configure.args-delete     --enable-debug
+}
+
+default build.dir {${configure.dir}}
+
+default build.post_args {VERBOSE=ON}
</ins><span class="cx">Property changes on: trunk/dports/_resources/port1.0/group/cmake-1.1.tcl
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Id
</ins><span class="cx">\ No newline at end of property
</span><a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span></div>

</body>
</html>