Commit Graph

24 Commits

Author SHA1 Message Date
Chuck Atkins 3e84e78c3f Use a more reliable regex for extracting binary INFO strings
A few different regular expressions were being used in various
places to extract info strings from binaries.  This uses a
consistent regex amongst all of them now.  This also fixes the
broken ABI detection for Cray compilers.
2014-09-03 17:00:48 -04:00
Daniele E. Domenichelli 1890c668e9 Keep cmake_minimum_required calls in sync with current version
Update cmake_minimum_required calls in CMakeLists.txt in Modules and in
CMakeLists.txt generated by other modules, so that they are always in
sync with current CMake version.
2014-05-19 16:55:12 +02:00
Rolf Eike Beer 2622bc3f65 Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
The matches have already been calculated and can simply be taken from
CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very
similar regular expressions.
2014-04-14 18:16:58 +02:00
Michel Zou d7a65a2f2c FortranCInterface: Fix cross-compiling Linux to MinGW (#14358)
After building the test binary tell find_program to search for it with
the ${CMAKE_EXECUTABLE_SUFFIX} so that the .exe can be found.  Since
find_program is normally used to locate host tools while cross-compiling
it needs this hint to find the target binary.

Suggested-by: Denis Barbier <bouzim@gmail.com>
2013-08-14 19:31:31 -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 a7ce26d837 Move IntelVSImplicitPath project to better location
This project is not part of the FortranCInterface module.  Make it a
sibling instead of a child directory.
2011-09-14 13:49:40 -04:00
Bill Hoffman 555f589a5a For VS Intel Fortran IDE builds, add a check to find the Fortran library PATH.
To use VS C and Fotran in the same solution, it is required that VS be
able to find the Fortran run time libraries as they will be implicitly
linked by any Fortran library used by VS C programs.  This adds a check
into CMakeDetermineCompilerABI using a try-compile to find the correct
PATH.
2011-09-08 17:42:49 -04:00
Brad King 71402eb252 FortranCInterface: Compile separate Fortran lib in VerifyC[XX]
The Intel Fortran plugin for Visual Studio requires Fortran source files
to be compiled in a separate target from C and C++ code.  Compile the
VerifyFortran.f source file in a separate library and link the main
VerifyFortanC executable to it.
2011-09-08 14:56:48 -04:00
Brad King d0203fb567 FortranCInterface: Fix mangling detection with Cray Fortran >= 7.3.2
The Cray Fortran compiler started using module init symbols in version 7.3.2.
Starting in commit 71287734 (Teach FortranC interface for Intel, PGI, and gcc
4.2, 2009-08-05) we provide C versions of the module init symbols so that the
detection executable can link when the C versions of the module-mangled symbols
are picked up.

If no C module-mangled symbol matches then we cannot let the C module init
symbol appear because it will be duplicated by the Fortran copy that provides
the module-mangled symbol.  This was first handled for the PathScale compiler
in commit 21faaa5d (FortranCInterface: Fix PathScale detection, 2010-01-22) and
commit 46858720 (FortranCInterface: Fix PathScale detection again, 2010-02-16).
Handle it now for the Cray compiler too.
2011-03-24 16:06:58 -04:00
Brad King 09d1c1080d FortranCInterface: Recognize NAG Fortran module symbols 2010-12-09 18:12:42 -05:00
Brad King 4685872078 FortranCInterface: Fix PathScale detection again
PathScale Fortran mangles module symbols as "MY_SUB.in.MY_MODULE" and
also requires "my_module_" when the module is imported.  We cannot
provide the symbol with ".in." mangling so we should not provide
"my_module_" because it would duplicate the one in the Fortran-provided
object file.

Commit "FortranCInterface: Fix PathScale detection" (2010-01-22) already
made the same fix for the non-underscore module case.
2010-02-16 13:24:44 -05:00
Brad King 21faaa5d7f FortranCInterface: Fix PathScale detection
PathScale Fortran mangles module symbols as "MYSUB.in.MYMODULE" and also
requires "mymodule_" when the module is imported.  We cannot provide the
symbol with ".in." mangling so we should not provide "mymodule_" because
it would duplicate the one in the Fortran-provided object file.
2010-01-22 14:15:47 -05: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 f7cfd5c99f FortranCInterface: Mangling for Intel on Windows
The Intel Fortran compiler for Windows uses upper-case symbol names with
no trailing underscore.
2009-10-05 16:30:58 -04: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 dc78838737 Fix FortranCInterface_VERIFY for non-C++ case
The verification program entry point (main) is defined in a C source
file, so the C compiler should be used to link when only Fortran and C
are involved.  The C++ compiler should still be used when the CXX option
is enabled.
2009-09-01 13:03:12 -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 f33bcd6c50 Teach FortranCInterface about g77 mangling
The old GNU g77 Fortran compiler uses the suffix '__' for symbols
containing an underscore in their name.
2009-08-06 07:53:41 -04:00
Brad King 8dd02cb78d Sort FortranCInterface global mangling symbols
This just cleans up the list ordering so more entries can be added while
keeping everything organized.
2009-08-06 07:53:32 -04:00
Brad King edcddb522c Cleanup FortranCInterface for PGI and GCC 4.2
This documents the purpose of the extra my_module_.c and mymodule.c
source files, and sorts the symbols.
2009-08-05 17:07:36 -04:00
Bill Hoffman 71287734a9 Teach FortranC interface for Intel, PGI, and gcc 4.2 2009-08-05 16:55:57 -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