[CMake] Fortran project compiling with -isystem causing error

Brad King brad.king at kitware.com
Thu Mar 26 09:35:18 EDT 2015


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



More information about the CMake mailing list