alternate configuration step with cmake rather than ./configure

Ryan Schmidt ryandesign at macports.org
Fri Oct 16 07:29:16 PDT 2009


On Oct 16, 2009, at 07:04, Jonathan Tomshine wrote:

> I'm attempting to make a portfile for an application that uses cmake
> for its configuration step, as opposed to the standard ./configure.
> I'm running into a confusing error with regards to my alternate
> configure{} though.  My configure stage is this:
>
> configure {
>    exec cmake ${worksrcpath} \
>    -DWITH_CFITSIO=OFF \
>    -DWITH_FLI=OFF \
>    -DCMAKE_INSTALL_PREFIX=${destroot}${prefix} \
>    -DNOVA_INCLUDE_DIR=${prefix}/include \
>    -DNOVA_LIBRARIES=${prefix}/lib/libnova.a
> }
>
> (adding the ${worksrcpath} behind cmake shouldn't be necessary, but it
> delays failure from the configure to the build stage)
>
> For whatever reason, my alternate configuration step appears to be
> running in the directory:
>
> /opt/local/var/macports/sources/rsync.macports.org/release/ports/ 
> devel/openssl
> (?!?)
>
> Based on the macports manual:
> http://guide.macports.org/#reference.phases , it appears that it
> should be running in ${worksrcpath}, which it certainly isn't.  Since
> "cd" seems to have been specifically disabled, I'm at a loss as to how
> to fix this problem.  Do I just need to copy all of the resulting
> configure files to ${worksrcpath} manually?  Surely I can't be the
> first person to use cmake to write a Makefile, so this must have been
> addressed before...

MacPorts does not guarantee what the current working directory will be  
when you "system" or "exec" any commands. You must go there yourself.  
For "exec" this isn't so easy, so most ports use "system", as in:

system "cd ${worksrcpath} && cmake ........"

However, please use the cmake portgroup instead of reinventing this  
particular wheel. :)




More information about the macports-dev mailing list