Commit Graph

28 Commits

Author SHA1 Message Date
Brad King 71491bbe8f FortranCInterface: Pass all flags to VERIFY project (#13579)
Teach FortranCInterface_VERIFY to build the test project in a specific
configuration and pass all flags for that configuration.  This ensures
that any modifications made by the user or project to the flag are used in
the test project consistently.
2012-10-10 15:42:55 -04:00
Kitware Robot 9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Brad King 4cb73c43ac FortranCInterface: Work around mingw32-make trouble with parens
The mingw32-make tool does not handle parenthesis in the path to a
source file consistently.  When CMake is installed in a typical location
like "c:\Program Files (x86)\CMake 2.8\" the mingw32-make tool fails on
the FortranCInterface detection project sometimes with errors like

 >mingw32-make -f CMakeFiles\myfort.dir\build.make CMakeFiles/myfort.dir/my_module.f90.obj
 mingw32-make: *** No rule to make target `x86)/CMake 2.8/share/cmake-2.8/Modules/FortranCInterface/my_module.f90)',
 needed by `CMakeFiles/myfort.dir/my_module.f90.obj'.  Stop.

due to parens in the path to the FortranCInterface source directory.
However, the behavior varies with the file name of build.make:

 >copy CMakeFiles\myfort.dir\build.make CMakeFiles\myfort.dir\build2.make
 >mingw32-make -f CMakeFiles\myfort.dir\build2.make CMakeFiles/myfort.dir/my_module.f90.obj
 [  3%] Building Fortran object CMakeFiles/myfort.dir/my_module.f90.obj

Tested with

 >mingw32-make -v
 GNU Make 3.82
 Built for i386-pc-mingw32

Work around the problem by copying the whole FortranCInterface source
directory in to the project build tree.
2011-12-09 09:40:14 -05:00
Brad King e872f5d70a FortranCInterface: Fix doc typo FC.h -> FCMangle.h 2010-08-17 16:43:20 -04:00
Todd Gamblin 2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Brad King 0306080e6e FortranCInterface: Support '=' in language flags
The commit "FortranCInterface: Honor language flags in checks" taught
the FortranCInterface module to pass C and Fortran flags into its
detection and verification checks.  We improve on the change to allow
the '=' character in the language flags.  This requires passing the
cache entry type with the -D options.
2009-12-15 14:02:52 -05:00
Brad King 1699836b06 FortranCInterface: Honor language flags in checks
We pass CMAKE_C_FLAGS, CMAKE_CXX_FLAGS, and CMAKE_Fortran_FLAGS through
try_compile() for the FortranCInterface Detect and Verify projects.
This honors user-specified compiler flags for each language, thus
supporting flags that affect the Fortran mangling.
2009-11-19 17:42:48 -05:00
Brad King 184a3418e6 FortranCInterface: Use CMake 2.8.0 behavior
The FortranCInterface module should execute with CMake 2.8.0 behavior
even if policies are set differently by the including project.  In
particular, it makes use of empty list elements and therefore expects
NEW behavior of CMP0007.
2009-11-17 14:33:28 -05:00
Brad King 3a666595c9 Convert CMake non-find modules to BSD License
This adds copyright/license notification blocks CMake's non-find
modules.  Most of the modules had no notices at all.  Some had notices
referring to the BSD license already.  This commit normalizes existing
notices and adds missing notices.
2009-09-28 11:46:51 -04:00
Brad King 78160cee6e Make FortranCInterface_VERIFY verbose on failure
We enable verbose build output in the try_compile of the simple project.
This makes valuable information available in the case of failure.
2009-09-01 08:52:43 -04:00
Brad King a9be85da2e Create FortranCInterface_VERIFY function
This function builds a simple test project using a combination of
Fortran and C (and optionally C++) to verify that the compilers are
compatible.  The idea is to help projects report very early to users
that the compilers specified cannot mix languages.
2009-08-24 08:49:35 -04:00
Brad King 14f7a043e3 Teach FortranCInterface to load outside results
We split the main detection logic into a Detect.cmake support module and
load it only when detection results are not already available.  This
allows results computed by the main project to be used in try-compile
projects without recomputing them.  The call to try_compile() need only
to pass FortranCInterface_BINARY_DIR through the CMAKE_FLAGS option.
2009-08-24 08:49:07 -04:00
Brad King f64f9940af Teach FortranCInterface to verify languages
This module requires both C and Fortran to be enabled, so error-out if
they are not.
2009-08-20 16:21:53 -04:00
Brad King 80f0201b37 Rewrite FortranCInterface module
This is a new FortranCInterface.cmake module to replace the previous
prototype.  All module support files lie in a FortranCInterface
directory next to it.

This module uses a new approach to detect Fortran symbol mangling.  We
build a single test project which defines symbols in a Fortran library
(one per object-file) and calls them from a Fortran executable.  The
executable links to a C library which defines symbols encoding all known
manglings (one per object-file).  The C library falls back to the
Fortran library for symbols it cannot provide.  Therefore the executable
will always link, but prefers the C-implemented symbols when they match.
These symbols store string literals of the form INFO:symbol[<name>] so
we can parse them out of the executable.

This module also provides a simpler interface.  It always detects the
mangling as soon as it is included.  A single macro is provided to
generate mangling macros and optionally pre-mangled symbols.
2009-08-05 13:40:29 -04:00
Bill Hoffman a8b17d9e9a ENH: fix for intel module on linux 2008-10-31 07:50:28 -04:00
Bill Hoffman b7f75016a6 ENH: better output if module linkage is not found 2008-10-30 17:48:03 -04:00
Bill Hoffman 6066a3fca6 ENH: fix uppercase version so defines are not upper as well 2008-10-30 16:50:12 -04:00
Bill Hoffman c0e7bcd4ae ENH: fix check for intel windows module mangling 2008-10-29 19:49:18 -04:00
Bill Hoffman 574530c07d ENH: fix check for intel windows module mangling 2008-10-29 19:34:12 -04:00
Bill Hoffman 4dd0afd069 ENH: add check for intel windows module mangling 2008-10-29 17:40:35 -04:00
Bill Hoffman ae70a5b327 ENH: add check for intel windows module mangling 2008-10-29 17:40:05 -04:00
Bill Hoffman 5995ff36df ENH: fix upper case 2008-10-29 17:37:01 -04:00
Bill Hoffman 351ef7c187 ENH: only check for module linkage if f90 is available 2008-10-29 12:24:07 -04:00
Bill Hoffman 4cb360afd2 ENH: fix for xlf module linkage 2008-10-29 11:50:20 -04:00
Bill Hoffman 84a4222314 ENH: add test for FortranCInterface 2008-10-29 10:58:40 -04:00
Bill Hoffman 3155ff600d ENH: add support for g77 extra _ at the end of functions that have an _ in the name... 2008-10-28 19:53:54 -04:00
Bill Hoffman 2866984b4d ENH: add support for module functions 2008-10-27 21:42:41 -04:00
Bill Hoffman 3a97e4699c ENH: add fortran link discovery module 2008-10-27 15:23:14 -04:00