I thought that CMake had Fortran submodule support as of 3.8 or 3.10.
However, when compiling a single library target with submodules in parallel
on macOS with GFortran trunk (or GFortran 7.3) I get:

    f951: Fatal Error: Module file 'mylib.smod' has not been generated,
either because the module does not contain a MODULE PROCEDURE or there is
an error in the module.
    Compilation terminated

   make[2]: *** [src/MyLib/CMakeFiles/MyLib.dir/MyLib_implementation.f90.o]
Error 1

So it seems that CMake is not generating a Makefile in such a way that it
requires MyLib_interface.f90 containing the interface top level module
mylib.mod to be processed/compiled *before* MyLib_interface.f90. Because of
this, there is no mylib.mod file generated from MyLib_interface.f90 before
MyLib_implementation.f90 is compiled.

Am I missing something? Is there a way to express this dependency in such a
way that CMake will generate a make file that ensures the source files are
processed in the correct order, even with `make -j`?

Thanks,
Zaak

Izaak "Zaak" Beekman

-------------------------------------------------------------------------------

HPC Scientist
ParaTools Inc. <http://www.paratools.com/>
1509 16th St, NW
Washington, DC 20036
mobile: (917) 797-3239
-------------------------------------------------------------------------------
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to