On 3/1/2012 11:21 AM, Matthew Schuchard wrote:
In particular, I have noticed that CMake cannot do module dependency scanning 
outside of the current directory/subdirectories.

For example, if /topdir/dir1/src/ has a Fortran file with a dependency on a 
module built in /topdir/dir2/mod/, CMake will not instruct the module in 
/dir2/mod/ to be built before the Fortran file in /dir1/src/. This is not 
necessarily an issue as I can simply instruct CMake to build the /dir2/mod
directory before the /dir1/src/ directory via add_subdirectory ordering.

When scanning dependencies of sources in a given target CMake
looks at targets to which that target links to find possible
module providers.  If a target uses a module provided by
another target but does not link to it then the link will
fail.

It does not matter whether the targets are in the same
directory or different directories so long as they are
all handled during a single CMake configuration.  The
case is even covered in the test suite:

http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/CMakeLists.txt;hb=v2.8.7
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/a.f90;hb=v2.8.7
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/b.f90;hb=v2.8.7
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Executable/CMakeLists.txt;hb=v2.8.7
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Executable/main.f90;hb=v2.8.7

-Brad
--

Powered by www.kitware.com

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

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

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

Reply via email to