[CMake] Fortran 90 modules not rebuilt

Eric Noulard eric.noulard at gmail.com
Tue Nov 16 16:48:41 EST 2010


2010/11/16 Belcourt, K. Noel <kbelco at sandia.gov>:
>
> On Nov 16, 2010, at 2:05 PM, Belcourt, K. Noel wrote:
>
>> On Nov 16, 2010, at 1:59 PM, Brad King wrote:
>>
>>> On 11/16/2010 01:11 PM, K. Noel Belcourt wrote:
>>>>
>>>> I've attached my project's top-level Makefile.  I'm trying to force
>>>> all the modules in the project to build first so I created a single
>>>> library called modules that contains all my Fortran 90 module files.
>>>> I'm invoking the Makefile explicitly passing the modules as the
>>>> target to build (so I can build a clean project in two steps: make
>>>> modules ; make)
>>>
>>
>>> The Fortran module dependencies implementation is hidden inside the
>>> Makefile generators.  There is no API to access any of its timestamp
>>> files or scanning rules.
>
> What's interesting is that in a project that's fully update to date, running
> the make modules command gives this curious output:
>
> S896822:tools kbelco$ make modules
> [ 16%] Built target util
> [ 19%] Built target tp
> [ 25%] Built target spr
> [ 35%] Built target rn2
> [ 61%] Built target rn1
> [ 61%] Built target mp
> [100%] Built target modules
>
> which is the same list of libraries in these SUBDIRS commands in the
> top-level CMakeLists.txt file (in reverse order).

Is there any reason you are using SUBDIRS instead of ADD_SUBDIRECTORY?

SUBDIRS is deprecated and as far as I remember it has a different
"search-ordering" than add_subdirectory

> There's a single library
> in each of these subdirs of the same lower-cased name.
>
> ...
> SUBDIRS(Modules)
> SUBDIRS(MP)
> SUBDIRS(Rn1)
> SUBDIRS(RN2)
> SUBDIRS(SPR)
> SUBDIRS(TP)
> SUBDIRS(Util)
>
> So it looks like the subdirs command plays a role in this behavior.

try replacing your SUBDIRS with add_subdirectory.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list