[CMake] Problem with generated source files and Fortran90 modules

Julien Bigot julien at julien-bigot.fr
Mon Mar 11 06:41:16 EDT 2013


Hi,

I'm using cmake with something like that

add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/gen.f90"
	COMMAND bash ARGS "${CMAKE_SOURCE_DIR}/gen.f90.sh" ">" 
"${CMAKE_BINARY_DIR}/gen.f90"
	MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/gen.f90.sh"
	VERBATIM
)

add_library(mylib STATIC usegen.f90 "${CMAKE_BINARY_DIR}/gen.f90")

gen.f90 defines a module gen_module and usegen uses this module

unfortunately cmake doesn't seem to catch the dependency and tries to compile 
usegen.f90 before gen.f90 resulting in an error of missing gen_module.mod

I've tried to set the gen.f90 property GENERATED to TRUE but this does not 
seem to have any effect ...

Could someone give me some hint to understand what I'm doing wrong ?

Regards,
-- 
Julien Bigot, Ph.D.  --  http://work.julien-bigot.fr
Maison de la Simulation USR 3441 - bât. 565 - CEA Saclay
91191 Gif-sur-Yvette CEDEX - FRANCE
phone: (+33) 1 69 08 01 75  --  xmpp: jbigot at jabber.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130311/0599790b/attachment.pgp>


More information about the CMake mailing list