On 05/25/2011 08:18 AM, sind...@gmail.com wrote:
> I also like your suggestion of having all source files in one directory

They don't actually have to be in one directory.  You only need to name
them from one directory.  For example:

  add_executable(myMain
    exe/mymain.f90
    lib1/lib1.f90
    lib2/lib2.f90
    lib3/lib3.f90
  )

> and just build a giant target and let CMake figure out the dependencies
> within that target, I tried it with this simple example and it worked
> fine as well. I wonder if this approach has any drawbacks though?

If you want to build more than one executable that shares the same
libraries then it is better to build the individual libraries and
link to them from each executable.  Otherwise each source file will
compile separately for each executable.  In C this is just slower, but
in Fortran the .mod files might conflict.  If you're building exactly
one executable then the approach has no significant drawbacks, at
least of which I can think now.

-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