[MacPorts] #19781: modify cmake Modules for MacPorts prefix
MacPorts
noreply at macports.org
Thu May 28 10:38:21 PDT 2009
#19781: modify cmake Modules for MacPorts prefix
-----------------------------------------+----------------------------------
Reporter: dweber@… | Owner: macports-tickets@…
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 1.7.1
Keywords: FindITK.cmake cmake modules | Port: cmake
-----------------------------------------+----------------------------------
Comment(by dweber@…):
More information about this...
I've got a new revision of InsightToolkit working nicely, but it works
best with a modification to the cmake module for FindITK.cmake. This file
is installed at
{{{
/opt/local/share/cmake-2.6/Modules/FindITK.cmake
}}}
In the current testing revision of InsightToolkit is at:
https://svn.macosforge.org/repository/macports/users/dweber/graphics/InsightToolkit/Portfile
http://trac.macports.org/changeset/51573
The post-destroot creates version specific library and include paths, with
symlinks to them from a generic path, and also modifies a few
configuration files, including FindITK.cmake, so the system can find these
version specific installations:
{{{
post-destroot {
# For some reason, cmake does not install into the
CMAKE_INSTALL_NAME_DIR
move ${destroot}${prefix}/lib/${name} ${destroot}${itkLibPath}
move ${destroot}${prefix}/include/${name} ${destroot}${itkIncPath}
# Create a symlink from the generic lib and include for InsightToolkit
to this version
ln -sf ${distname} ${destroot}${prefix}/lib/${name}
ln -sf ${distname} ${destroot}${prefix}/include/${name}
# copy FindITK.cmake to a version specific file, which might persist
even
# when cmake is updated, deactivated, etc.
set findITK [glob ${prefix}/share/cmake-*/Modules/FindITK.cmake]
set findITKbranch [strsed ${findITK} #FindITK#FindITK-${branch}#]
copy ${findITK} ${destroot}${findITK}
copy ${findITK} ${destroot}${findITKbranch}
# Change the content of $findITK and $findITKbranch, to find MacPorts
lib
set stdlib /usr/local/lib/InsightToolkit
set newlib ${prefix}/lib/InsightToolkit
reinplace "s|${stdlib}|${newlib}\\\n ${newlib}-${branch}\\\n
${stdlib}|g" ${destroot}${findITK}
reinplace "s|${stdlib}|${newlib}\\\n ${newlib}-${branch}\\\n
${stdlib}|g" ${destroot}${findITKbranch}
# Change the content of ITKConfig.cmake
reinplace "s|${name}|${distname}|g"
${destroot}${itkLibPath}/ITKConfig.cmake
copy ${destroot}${itkLibPath}/ITKConfig.cmake
${destroot}${itkLibPath}/itk-${branch}-config.cmake
}
}}}
Note the reinplace commands in the post-destroot, which result in the
following diff on FindITK.cmake:
{{{
--- FindITK.cmake-orig 2009-05-28 09:57:35.000000000 -0700
+++ FindITK.cmake 2009-05-28 10:00:09.000000000 -0700
@@ -50,6 +50,8 @@
${ITK_DIR_SEARCH}
# Look in standard UNIX install locations.
+ /opt/local/lib/InsightToolkit
+ /opt/local/lib/InsightToolkit-3.12
/usr/local/lib/InsightToolkit
/usr/lib/InsightToolkit
}}}
Note that similar additions could be made for FindVTK.cmake, at about:
{{{
# Look in standard UNIX install locations.
/usr/local/lib/vtk
/usr/lib/vtk
}}}
The problem with modification to FindITK.cmake in the InsightToolkit is
that the activation stage will fail without the -f flag to force an
overwrite of the FindITK.cmake file provided by cmake. It makes more
sense to modify the cmake port directly.
Do you agree these are useful changes to the cmake port? Can I assume
responsibility for making these changes to the cmake port?
Thanks, Darren
--
Ticket URL: <http://trac.macports.org/ticket/19781#comment:1>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list