Hi,

I am experiencing a problem related with dependencies on fortran mod files. Basically, the "make -j" it's failing with: make[2]: *** No rule to make target `dsfdm3d/inc/modacqui.mod', needed by `dsfdm3d/src/CMakeFiles/dsfdm_sp-exe.dir/main.f90.o'. Stop.


mod file are generated as a side effect of source file compilation, so a file A.f90 using a mod B.mod must be compiled after the file producing the module (say B.f90).

cmake seems to be able to convert those constraints in terms of build order (that is, B.f90 will be compiled before A.f90) and insert a dependency from A.f90 to B.mod. But sinces there are no specific rule to build B.mod, a full parallel build will fail on the dependencies. That is, before building anything, make will detect that A.f90 depends on a non existing file (yet) and fail to see that the compilation of B.f90 would have produced the file.

For some reason, the problem seems to appears only if I build an executable (from A.f90) and have many files suc a B.f90 used to build a library. When building with a simple 'make' everything is okay (I guess because the build order is good), the problem only appears with "make -j".

I have the problem with cmake  3.1.0-rc1 and 2.8.12.2

the CMakeLists.txt looks like:

add_library(somelib OBJECT
 [some 52 source files>.f90
  )

set_target_properties(somelib PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../inc")
set_target_properties(somelib PROPERTIES COMPILE_FLAGS "<compile flags>")

add_executable(exe main.f90 $<TARGET_OBJECTS:somelib>)
set_target_properties(exe PROPERTIES COMPILE_FLAGS "<compile flags>")


add_dependencies(exe somelib)

Is this something expected ?

Thanks

--

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:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to