[CMake] execute short program during cmake configuration ?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Jun 2 17:56:47 EDT 2016


On 2016-06-02 20:10-0000 Ilias Miroslav wrote:

>
> Greetings, dear experts,
>
>
> we have (two) short Fortran programs (detection of integer*4/8 for math libraries) which we would like to build and execute during project's  configuration phase.
>
>
> There is the " CheckFortranSourceCompiles" command to compile a Fortran source code during project's  configure time.  However, we would be glad also to execute the resulting a.out binary and check if it passes or crashes.
>
>
> Any help, please ? Is there a way to compile/execute short program in the configuration  stage of the (big) project ?

Hi Ilias:

It appears you want the Fortran equivalent of the CHECK_C_SOURCE_RUNS
macro. So I suggest you copy that macro (found in
Modules/CheckCSourceRuns.cmake) to your own source code where your
other home-grown CMake macros are located, rename that macro to
CHECK_FORTRAN_SOURCE_RUNS, and make the minor modifications to that
macro that are appropriate for the Fortran case.

By the way, such copy and modification is permitted/encouraged by the
copyright license for CMake as given in Modules/CheckCSourceRuns.cmake
although as that source file licensing text summary says you do have
to put the full text of the license in that modified file.

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); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); 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