[CMake] cmake support D programming?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Aug 7 12:04:25 EDT 2011


On 2011-08-07 09:21+0200 jonathan MERCIER wrote:

> Le samedi 06 août 2011 à 20:00 -0700, Alan W. Irwin a écrit :

> Thanks for your answer, i have read this file:
> http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/cmake/modules/language_support/cmake/Platform/Linux-dmd.cmake?revision=10805&view=markup
>
> And i see a problem, line 28:
> SET (CMAKE_D_FLAGS_INIT "-version=Posix ${DSTDLIB_FLAGS} -I
> $ENV{D_PATH}/include -I$ENV{D_PATH}/import")
>
> include dir and import dir is same thing and in fedora d includedir is
> loctated in /usr/include/d or here path have a hardcoded suffix
> "/include" & "/import"

Hi Jonathan:

On my Debian Squeeze system, it is even worse.  The includedir is versioned so that
it is /usr/include/d/4.3/.  But it makes no actual difference; the
CMake D language support with PLplot still works fine on that system.

Here is why.  I looked further for the use of D_PATH, and I found the
following in CMakeTestDCompiler.cmake

   MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} --
broken")
   message(STATUS "To force a specific D compiler set the DC
environment variable")
   message(STATUS "    ie - export DC=\"/opt/dmd/bin/dmd\"")
   message(STATUS "If the D path is not set please use the D_PATH
variable")
   message(STATUS "    ie - export D_PATH=\"/opt/dmd\"")

So it appears D_PATH is an emergency backup measure that is used if
all else fails.  Under these emergency conditions, the authors of this
module had to make some assumption about the layout of the special
version of the D compiler package.  They obviously made the simplest
assumption (the D include files would be stored in
$ENV{D_PATH}/include and/or $ENV{D_PATH}/import).  That assumption
might work in an emergency (presumably they had access to some D
compiler package with that layout) or they may have just blindly
copied it from somewhere else.  In any case, that assumption does
no harm at all for the usual case where the D_PATH environment
variable is not set since all it does is set some additional -I flags
that point to /include and /import directories that don't exist and
which are therefore effectively ignored.

I should also point out that one of the PLplot users has taken on
the responsibilty of packaging PLplot for Fedora, and he has not
reported any difficulty with D.  Thus, I suggest if you give these
language support modules a try on your own Fedora system, they will
probably work for you as well.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list