[CMake] How to configure Fortran compiler, flags, and so on.
Daniel Carrera
dcarrera at gmail.com
Sat Mar 30 20:33:30 EDT 2013
Hello all,
I am starting to learn about CMake. So far I have only written very
minimal CMakeLists.txt files. I am wondering how hard it would be to
make CMake read some configuration options for Fortran 95 from an
external file similar to this:
---- myprogram.conf ----
FC = mpif90
F77 = $(FC)
FFLAGS = -fbounds-check -I/usr/lib/openmpi/include/
FFLAGS_DOUBLE = -fdefault-real-8
The "end users" are largely the developers. The program is recompiled
and rerun regularly and these settings rarely change, so they need to
be in some sort of global config file. I was thinking that it might
make sense to write a thin shell script wrapper around CMake that
basically does this:
source $CONF_PATH/myprogram.conf
cmake $SOURCE_PATH
So then all those settings become environment variables. And then I'd
do something inside CMakeLists.txt to make sure that CMake uses the
contents of those variables to compile the program.
Am I on the right track here? Or am I just badly re-inventing the
wheel? If I am on the right track, can someone show me how I would get
CMake to use these variables? I have tried to find documentation, but
what I've found seems specific to C/C++:
http://www.cmake.org/Wiki/CMake_Useful_Variables
Thanks for the help.
Cheers,
Daniel.
--
Lord of the rings calendar in your Linux/Unix/Mac terminal: cat
/usr/share/calendar/calendar.lotr
More information about the CMake
mailing list