install common resource files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

install common resource files

Lars Lars


We have a set of configuration files located in a common location that multiple target rely on at runtime.

The structure looks something like this;

 - CMakeLists.txt
 - targetA
   - CMakeLists.txt
 - targetB
   - CMakeLists.txt
 - targetC
   - CMakeLists.txt
 - common
   - config.xml
   - config.ini
Both targetA and targetB depend on config.xml and config.ini. TargetC does not depend on the files.
What is the preferred way using CMake to install the resource given the above mentioned dependencies?

Two options;
- add CMakeLists.txt to common folder and install files from there. Do not like this option as this means I always install the files regardless of which target I want to install (targetC does not require does files).
- add install rules to targetA/CMakeLists.txt and targetB/CMakeLists.txt. This is a better option but still requires same logic in multiple files.

Any other options?

Regards, Lars


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: