[CMake] install common resource files

Lars laasunde at hotmail.com
Mon Jun 12 03:59:31 EDT 2017


Hello,

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;

root
 - 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170612/5fd1f45d/attachment.html>


More information about the CMake mailing list