[CMake] Fortran project compiling with -isystem causing error
Hugh Sorby
h.sorby at auckland.ac.nz
Wed Mar 25 20:26:23 EDT 2015
Right got it, the problem occurs when I add the target_link_libraries
command to the dependent project. The attached tar.gz contains my not
working example source, layout:
Konsole output
.
|-- ex
| |-- CMakeLists.txt
| `-- use_mod.f90
|-- ex-build
|-- install
|-- modsrc
| |-- CMakeLists.txt
| `-- a.f90
`-- modsrc-build
commands (from base directory)
Konsole output
cd modsrc-build/
Konsole output
cmake ../modsrc
Konsole output
make install
Konsole output
cd ../ex-build/
Konsole output
cmake ../ex
Konsole output
make
This will show the error where it is using the -isystem to include the
include directories, if you comment out the target_link_libraries
command in ex/CMakeLists.txt the build will succeed and -I will be used
to include the include directories.
I am using:
CMake 3.2.1
gfrotran 4.9.2
On 03/26/15 12:48, Hugh Sorby wrote:
>
> My first simple example worked, so I looked at adding an imported
> target, as this is what my actual script has, to install the dependent
> modules but this also worked as expected. I am now going to go back
> to the original CMakeLists.txt file to see if I can make it the same
> as my second example, hopefully I will inadvertently fix my problem.
> I'll report back on the outcome.
>
> On 03/26/15 04:18, Brad King wrote:
>> On Tue, Mar 24, 2015 at 11:03 PM, Hugh Sorby wrote:
>>> I am trying to create a simple Fortran project that relies on a
>>> module file
>>> that has been built by another project. I have added the directory
>>> containing the module file into the include_directories command but the
>>> project isn't compiling and raises an error can't find module. The
>>> directory that I want to include shows up in the compile command but
>>> it is
>>> prefixed with -isystem if I change this manually to -I (capital i)
>>> then the
>>> project compiles successfully. As I understand it the -isystem
>>> should be
>>> used for includes to be considered as system includes, but I haven't
>>> specified this in my include_directories command.
>> Please post an example CMakeLists.txt file demonstrating the problem
>> and Cc me.
>>
>> Thanks,
>> -Brad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150326/185a8774/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minex.tar.gz
Type: application/gzip
Size: 1130 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150326/185a8774/attachment.bin>
More information about the CMake
mailing list