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 - using the set_source_files_properties command on the objects files generated by pfind build with GENERATED option set to true.

Which approach do you think suit the best to my purpose ? If this is the second one: is there an easy way to get/specify the list of the
object files generated during the pfind build ?

thanks a lot

Eric

--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France

--
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