On Tuesday 04 October 2011, pellegrini wrote: > Hi all, > > I would need your advise about the strategy to adopt when two > executables share common object files. > > Here is the context. I have a project that consists in a program (e.g. > console_prog) that was historically a console program > on top of which a GUI (gui_prog) was built. The gui_prog calling > directly the console program via an input file generated by the GUI. > > As the gui by itself does not mean anything without its console partner, > I built a CMakeLists.tx file that contains two add_executables: > > - add_executable(console_prog console_prog.f90 module1.f90 > module2.f90 module3.f90 ...) > - add_executable(gui_prog gui_prog.f90 module1.f90 module2.f90) > > My problem is that gui_prog uses some routines included in the source > files of the console program (e.g. module1.f90 module2.f90). > I would like to avoid a double build of module1.f90, module2.f90 > > I see two possibilities: > - building a static libraries out of the common files and linking it > to both console_prog and gui_prog executables
Yes, I'd say that's the way to go (if I didn't overlook any special issues). Alex -- 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
