View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015536CMakeCMakepublic2015-04-26 06:412015-11-02 09:13
ReporterPaul Romano 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake 3.2.2 
Target VersionFixed in Version 
Summary0015536: Include directories for .mod files produced with IBM XL Fortran
DescriptionWhen the IBM XL Fortran compiler is detected, the following is set:

set(CMAKE_Fortran_MODDIR_Flag "-qmoddir=")

According to the xlf documentation, this flag specifies where .mod files produced should be placed. However, unlike the -J option for gfortran and the -module option for ifort, -qmoddir does not tell the compiler to search for module files in this directory; for that, one also needs to specify -I. Thus, in order to work properly, you really need something like:

-qmoddir=includedir -Iincludedir
Additional InformationI'm using the IBM XL Fortran 14.1 for BlueGene/Q compiler on the Mira supercomputer at Argonne National Laboratory.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038600)
Paul Romano (reporter)
2015-04-26 07:36

I should have mentioned before -- this prevents compilation when one module uses another with xlf giving the following error:

1514-219 (S) Unable to access module symbol file for module _____. Check path and file permissions of file. Use association not done for this module.
(0038618)
Brad King (manager)
2015-04-27 10:55

It is expected that the project use include_directories or target_include_directories to specify this.
(0038624)
Paul Romano (reporter)
2015-04-27 19:04

Perhaps I didn't explain the issue clearly enough. Take the following example: two source files, a main program main.f90 and a module foo.f90 which is used by main.f90. The following CMakeLists.txt will fail with the above error when the IBM XL Fortran compiler is used:

project(main Fortran)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
add_executable(main main.f90 foo.f90)

This fails because foo.mod is generated in the include directory, and then when it tries to compile main.f90, the -qmoddir argument says "put any mod files generated in include" but it doesn't include a -I argument that tells it "search for .mod files in this directory".

Note that this simple example works fine with other Fortran compilers. With gfortran CMAKE_Fortran MODDIR_FLAG is set to -J which tells gfortran both where to generate .mod files and where to search for them. Similarly with ifort, CMAKE_Fortran_MODDIR_FLAG is -module which tells it where to generate and find .mod files. So it's really an idiosyncrasy of the XL compiler that it doesn't have an option similar to other compilers.
(0038628)
Brad King (manager)
2015-04-28 13:58

Re 0015536:0038624: Your example is missing

 include_directories(${CMAKE_BINARY_DIR}/include)

The Fortran_MODULE_DIRECTORY API is documented to specify the *output* location. It has no influence on include directories.
(0039793)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-04-26 06:41 Paul Romano New Issue
2015-04-26 07:36 Paul Romano Note Added: 0038600
2015-04-27 10:55 Brad King Note Added: 0038618
2015-04-27 10:55 Brad King Status new => resolved
2015-04-27 10:55 Brad King Resolution open => no change required
2015-04-27 19:04 Paul Romano Note Added: 0038624
2015-04-28 13:58 Brad King Note Added: 0038628
2015-11-02 09:13 Robert Maynard Note Added: 0039793
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team