[CMake] try_run or similar to find available Fortran integer kinds

Zaak Beekman zbeekman at gmail.com
Thu Sep 19 16:03:14 EDT 2013


Caveat: I am somewhat new to CMake.

I am programming a library to compute diagnostic statistics on VERY large
data sets. (Possibly in parallel too.) The algorithm is numerically stable
and online/streaming. The Fortran standard makes no guarantee of what
(signed) integer types are available on a given system, but provides a
means of requesting integers of different sizes and will let you know at
run time whether or not they exist. However, kind (type) specification of
variables must occur at compile time. (This isn't strictly true in F03/F08
but compiler support is limited ATM.) Since the algorithm is designed for
extremely large data sets (9TB!) and the number of elements visited in the
set so far appears in the algorithm, I would like to use the largest
available integer kind to keep track of this quantity so that it doesn't
overflow.

I think what I need to do is create a test program and use try_run() and
then configure_file(), which leads me to my questions:

   1. Can I have a multiple source file program and pass it to try_run()?
   It seems like the answer is no.
   2. Since Fortran has no concept of a return value (not formally as far
   as the standard is concerned) it looks like I need to pass the information
   about available kind types in the RUN_OUTPUT_VARIABLE back to CMake and
   manipulate it there. Does this variable just get populated with a string
   which is whatever your code (that you try_ran) outputs to stdout?
   3. Has someone written a module to diagnose available Fortran kind
   types? That they're willing to share?
   4. If not, where do I look for advice and best practices to write one
   myself?

TIA,
Izaak Beekman
===================================
(301)244-9367
Princeton University Doctoral Candidate
Mechanical and Aerospace Engineering
ibeekman at princeton.edu

UMD-CP Visiting Graduate Student
Aerospace Engineering
ibeekman at umiacs.umd.edu
ibeekman at umd.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130919/b4e4f022/attachment.htm>


More information about the CMake mailing list