On 03/11/2013 06:41 AM, Julien Bigot wrote: > 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
This is expected to work. The custom command should be evaluated during the build before CMake scans dependencies. I just tested this case and it works for me. Perhaps something about the actual content of gen.f90 prevents CMake from picking up the module it generates. Can you post its content here? Even better, can you provide a *minimal* but complete source tarball that reproduces the problem? -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