[CMake] Fortran project compiling with -isystem causing error
Hugh Sorby
h.sorby at auckland.ac.nz
Thu Mar 26 14:34:47 EDT 2015
Thanks Brad,
I looked at the documentation for gfortran and it says (before asking
about my problem, I also read the CMake documentation but failed to
comprehend it properly)
|-isystem|dir
Searchdirfor header files, after all directories specified by-Ibut
before the standard system directories. Mark it as a system
directory, so that it gets the same special treatment as is applied
to the standard system directories. Ifdirbegins with|=|, then
the|=|will be replaced by the sysroot prefix; see--sysrootand-isysroot.
and
|-I|dir
These affect interpretation of the|INCLUDE|directive (as well as of
the|#include|directive of thecpppreprocessor).
Also note that the general behavior of-Iand|INCLUDE|is pretty much
the same as of-Iwith|#include|in thecpppreprocessor, with regard to
looking forheader.gccfiles and other such things.
This path is also used to search for.modfiles when previously
compiled modules are required by a|USE|statement.
SeeOptions for Directory Search
<https://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Directory-Options.html#Directory-Options>,
for information on the-Ioption.
I guess their documentation should be more explicit and say that
-isystem dirs are not searched for .mod files. The documentation as it
stands implies to me that -isystem is the same as -I but for ordering.
Again thanks,
Hugh.
On 03/27/15 02:35, Brad King wrote:
> On 03/25/2015 08:26 PM, Hugh Sorby wrote:
>> |-- ex
>> | |-- CMakeLists.txt
>> | `-- use_mod.f90
>> |-- ex-build
>> |-- install
>> |-- modsrc
>> | |-- CMakeLists.txt
>> | `-- a.f90
>> `-- modsrc-build
> Thanks for the detailed example. It was trivial to reproduce the
> issue with that!
>
> Since this commit:
>
> Always consider includes from IMPORTED targets to be SYSTEM.
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a63fcbcb
>
> which was first included in CMake 3.0, include directories taken
> from imported targets are treated as SYSTEM automatically. You
> can avoid it with a target property on the imported target:
>
> http://www.cmake.org/cmake/help/v3.2/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html
>
> Doing that will workaround the problem. I think the real issue
> is that we cannot reliably use -isystem with gfortran at all
> because it won't look in such paths for module files. I've
> fixed that here:
>
> GNU: Do not use -isystem with gfortran
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8e7a104
>
> Thanks,
> -Brad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150327/76e1709c/attachment.html>
More information about the CMake
mailing list