[CMake] Problem with Fortran conditionals

Arjen Markus Arjen.Markus at deltares.nl
Fri May 1 02:56:52 EDT 2015


Hi Nikolaus,



I think the parser for Fortran sources indeed does not take care of such conditionals (they are also compiler-dependent, COCO never really got off the ground). A workaround might be to define a dummy module by that name.

As for the selection of the Fortran compiler, you might check the name of the compiler once it has been found and if it is not the one you support, issue an informative message.

Regards,

Arjen


> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Nikolaus Rath
> Sent: Friday, May 01, 2015 12:05 AM
> To: CMake
> Subject: [CMake] Problem with Fortran conditionals
>
> Hello,
>
> I am in the process of converting a bigger project from pure GNU Make to CMake -
> mostly because managing dependencies for the Fortran sources has become too
> painful.
>
> Things seem to be mostly working, but I'm hitting one problem. When trying to run
> the (CMake-generated) Makefile, it fails with:
>
> $ make VERBOSE=1
> [...]
> make[2]: Entering directory `/home/nrath/Q2D/LamyRidge/src/model/build'
> /home/nrath/.local/stow/cmake/bin/cmake -E cmake_copy_f90_mod
> dagmg_allroutines CMakeFiles/LR_model.dir/dagmg_allroutines.mod.stamp Intel
> /home/nrath/.local/stow/cmake/bin/cmake -E cmake_copy_f90_mod dagmg_mem
> CMakeFiles/LR_model.dir/dagmg_mem.mod.stamp Intel
> /home/nrath/.local/stow/cmake/bin/cmake -E cmake_copy_f90_mod dagmg_pardiso
> CMakeFiles/LR_model.dir/dagmg_pardiso.mod.stamp Intel Error copying Fortran
> module "dagmg_pardiso".  Tried "DAGMG_PARDISO.mod"
> and "dagmg_pardiso.mod".
> make[2]: ***
> [CMakeFiles/LR_model.dir/home/nrath/Q2D/LamyRidge/src/comm/agmg-
> seq/dagmg.f90.o.provides.build]
> Error 1
> make[2]: Leaving directory `/home/nrath/Q2D/LamyRidge/src/model/build'
> make[1]: *** [CMakeFiles/LR_model.dir/all] Error 2
> make[1]: Leaving directory `/home/nrath/Q2D/LamyRidge/src/model/build'
> make: *** [all] Error 2
>
> I am not sure why CMake is trying to copy module files around, but when I looked at
> the file that provides the "dagmg_pardiso" module, I found this code:
>
> !DEC$ IF DEFINED(_MKL_)
>   MODULE dagmg_PARDISO
>     USE dagmg_PARDISSO
>     INTERFACE
>  [...]
>     END INTERFACE
>   END MODULE dagmg_PARDISO
> !DEC$ ENDIF
> !-----------------------------------------------------------------------
> !DEC$ IF .NOT. DEFINED(_MKL_)
>     SUBROUTINE PARDISO( PT, MAXFCT, MNUM, MTYPE, PHASE, N, A, IA, JA
> &
>          , PERM, NRHS, IPARM, MSGLVL, B, X, ERROR ) [...]
>      END SUBROUTINE PARDISO
> !DEC$ ENDIF
>
> I do not define __MKL__. Is it possible that the CMake dependency parser doesn't
> understand this way of defining conditionals, and thus looks for a module that does
> not exist?
>
> If so, what would be the best way to work around this?
>
> (The code is from a third-party library, so unfortunately I cannot easily change it).
>
>
> Best,
> -Nikolaus
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150501/84ce4247/attachment-0001.html>


More information about the CMake mailing list