[macports/macports-ports] cmake-1.[01].tcl: Ensure that cmake based ports use the correct compiler (#66)
René J.V. Bertin
rjvbertin at gmail.com
Tue Nov 29 13:21:17 CET 2016
On Monday November 28 2016 23:33:21 René J.V. Bertin wrote:
Taking this to the -dev ML because I hope for an answer during my regular working hours today.
I started merging Jeremy's changes to the cmake portgroup and tested the default configure.args thing first:
```
default configure.args {[list \
-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 \
{-DCMAKE_C_COMPILER=${configure.cc}} \
{-DCMAKE_CXX_COMPILER=${configure.cxx}} \
-Wno-dev
]}
```
In a test port, `ui_msg "${configure.args}"` now shows
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib {-DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr"} -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON {-DCMAKE_C_COMPILER=${configure.cc}} {-DCMAKE_CXX_COMPILER=${configure.cxx}} -Wno-dev -DECM_MKSPECS_INSTALL_DIR=/opt/local/share/qt5/mkspecs/modules -DPLUGIN_INSTALL_DIR=/opt/local/share/qt5/plugins -DKDE_INSTALL_QTPLUGINDIR=/opt/local/share/qt5/plugins -DQML_INSTALL_DIR=/opt/local/share/qt5/qml -DBUILD_doc=OFF -DBUILD_docs=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_STRIP:FILEPATH=/bin/echo -DBUNDLE_INSTALL_DIR=/Applications/MacPorts/KF5 -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON -DAPPLE_SUPPRESS_X11_WARNING=ON -DCMAKE_INSTALL_LIBEXECDIR=/opt/local/libexec -DKDE_INSTALL_LIBEXECDIR=/opt/local/libexec/kde5 -DCMAKE_MACOSX_RPATH=ON -DSYSCONF_INSTALL_DIR=\"/opt/local/etc\" -DDOCBOOKXSL_DIR=/opt/local/share/xsl/docbook-xsl -DGETTEXT_INCLUDE_DIR=/opt/local/include -DGETTEXT_LIBRARY=/opt/local/lib/libgettextlib.dylib -DGIF_INCLUDE_DIR=/opt/local/include -DGIF_LIBRARY=/opt/local/lib/libgif.dylib -DJASPER_INCLUDE_DIR=/opt/local/include -DJASPER_LIBRARY=/opt/local/lib/libjasper.dylib -DJPEG_INCLUDE_DIR=/opt/local/include -DJPEG_LIBRARY=/opt/local/lib/libjpeg.dylib -DLBER_LIBRARIES=/opt/local/lib/liblber.dylib -DLDAP_INCLUDE_DIR=/opt/local/include -DLDAP_LIBRARIES=/opt/local/lib/libldap.dylib -DLIBEXSLT_INCLUDE_DIR=/opt/local/include -DLIBEXSLT_LIBRARIES=/opt/local/lib/libexslt.dylib -DLIBICALSS_LIBRARY=/opt/local/lib/libicalss.dylib -DLIBICAL_INCLUDE_DIRS=/opt/local/include -DLIBICAL_LIBRARY=/opt/local/lib/libical.dylib -DLIBINTL_INCLUDE_DIR=/opt/local/include -DLIBINTL_LIBRARY=/opt/local/lib/libintl.dylib -DLIBXML2_INCLUDE_DIR=/opt/local/include/libxml2 -DLIBXML2_LIBRARIES=/opt/local/lib/libxml2.dylib -DLIBXML2_XMLLINT_EXECUTABLE=/opt/local/bin/xmllint -DLIBXSLT_INCLUDE_DIR=/opt/local/include -DLIBXSLT_LIBRARIES=/opt/local/lib/libxslt.dylib -DPYTHON_EXECUTABLE=/opt/local/bin/python2.7
However, when I configure it I get the error I was half expecting:
Executing: cd "/Volumes/VMs/MPbuild/_opt_local_site-ports_kf5_kf5-kruler/kf5-kruler/work/build" && /opt/local/bin/cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_MODULE_PATH=/opt/local/share/cmake/Modules -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=${configure.cc} -DCMAKE_CXX_COMPILER=${configure.cxx} -Wno-dev -DECM_MKSPECS_INSTALL_DIR=/opt/local/share/qt5/mkspecs/modules -DPLUGIN_INSTALL_DIR=/opt/local/share/qt5/plugins -DKDE_INSTALL_QTPLUGINDIR=/opt/local/share/qt5/plugins -DQML_INSTALL_DIR=/opt/local/share/qt5/qml -DBUILD_SHARED_LIBS=ON -DCMAKE_STRIP:FILEPATH=/bin/echo -DBUNDLE_INSTALL_DIR=/Applications/MacPorts/KF5 -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON -DAPPLE_SUPPRESS_X11_WARNING=ON -DCMAKE_INSTALL_LIBEXECDIR=/opt/local/libexec -DKDE_INSTALL_LIBEXECDIR=/opt/local/libexec/kde5 -DCMAKE_MACOSX_RPATH=ON -DSYSCONF_INSTALL_DIR="/opt/local/etc" -DDOCBOOKXSL_DIR=/opt/local/share/xsl/docbook-xsl -DGETTEXT_INCLUDE_DIR=/opt/local/include -DGETTEXT_LIBRARY=/opt/local/lib/libgettextlib.dylib -DGIF_INCLUDE_DIR=/opt/local/include -DGIF_LIBRARY=/opt/local/lib/libgif.dylib -DJASPER_INCLUDE_DIR=/opt/local/include -DJASPER_LIBRARY=/opt/local/lib/libjasper.dylib -DJPEG_INCLUDE_DIR=/opt/local/include -DJPEG_LIBRARY=/opt/local/lib/libjpeg.dylib -DLBER_LIBRARIES=/opt/local/lib/liblber.dylib -DLDAP_INCLUDE_DIR=/opt/local/include -DLDAP_LIBRARIES=/opt/local/lib/libldap.dylib -DLIBEXSLT_INCLUDE_DIR=/opt/local/include -DLIBEXSLT_LIBRARIES=/opt/local/lib/libexslt.dylib -DLIBICALSS_LIBRARY=/opt/local/lib/libicalss.dylib -DLIBICAL_INCLUDE_DIRS=/opt/local/include -DLIBICAL_LIBRARY=/opt/local/lib/libical.dylib -DLIBINTL_INCLUDE_DIR=/opt/local/include -DLIBINTL_LIBRARY=/opt/local/lib/libintl.dylib -DLIBXML2_INCLUDE_DIR=/opt/local/include/libxml2 -DLIBXML2_LIBRARIES=/opt/local/lib/libxml2.dylib -DLIBXML2_XMLLINT_EXECUTABLE=/opt/local/bin/xmllint -DLIBXSLT_INCLUDE_DIR=/opt/local/include -DLIBXSLT_LIBRARIES=/opt/local/lib/libxslt.dylib -DPYTHON_EXECUTABLE=/opt/local/bin/python2.7 -DCMAKE_INSTALL_RPATH="/opt/local/lib" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.9" -DCMAKE_OSX_SYSROOT="/" /Volumes/VMs/MPbuild/_opt_local_site-ports_kf5_kf5-kruler/kf5-kruler/work/kruler-16.08.2
sh: -DCMAKE_C_COMPILER=${configure.cc}: bad substitution
I tried a few things, but I end up with either
1- the above error
2- the compiler choice hardcoded in configure.args (presumably as soon as configure.args-append is used). This defeats the purpose of the default command as it means a Portfile cannot change the compiler setting easily in the (hopefully rare) cases where this might be justified or required.
If 2) is not an issue, then why use default at all? For me it just adds an unjustified layer or runtime (event-driven?) complexity.
FWIW, this looks like the reason why we cannot put `${cmake.generator}` in a default expression for configure.pre_args .
R
More information about the macports-dev
mailing list