Feature request: Explicitly select objects from a target object library created by add_library(... OBJECT ...)
In case of FORTRAN I have a project that creates several binaries that use common, but not all, objects. Since I wish to compile in parallel, I tried two methods:
- Amass all the objects to be linked into one single library and then link them to each binary.
- For each binary create an OBJECT library with different MODULE output directories (otherwise parallel compilation does not work because of mod files). In this case some of the sources are compiled multiple times.
They both worked but I disliked it, since I also have older Makefile scripts that avoided this, but I made a transition to CMake since it beats the calling of custom compile and install scripts.
So my question is when creating a collection of objects with add_library(<name> OBJECT <src> ...)
is it possible to select only a few objects from the object library? As explained, we first compile all the dependency objects, and then link them to binaries as required. I failed to discern this from the properties documentation.