[CMake] Excluding targets from install set

Gordon Koefner gordon.koefner at vires.com
Tue Jul 23 04:55:04 EDT 2019


Hi all!

We have been migrating our buildsystem to CMake and are trying to use
the `install` command to deploy different parts of the software.
However `make install` also installs artifacts from our dependencies,
internal as well as 3rd party, that are unnecessary/unwanted.

Is there a native way to exclude certain subdirectories or build targets
from the install set? The only solution I could think of is to manually
add an option, e.g.:  

option(${TARGET_NAME}_INSTALL on "") # on by default
if(${TARGET_NAME}_INSTALL)
    install(...) 
endif()

Maybe the culprit is also that we are using find_path and
add_subdirectory to add any internal dependencies we have to the build
tree - I am starting to think that this is a mistake.

I have read about ExternalProject - but I am unsure whether this is the
correct way to go about it but it does allow modification of another build.

How do you guys solve this issue, how can I define which dependencies I
want installed?

I really want to avoid writing a shellscript to filter out any unwanted
stuff.

Best Regards and thank you in advance!
Gordon


-- 

Gordon Koefner - Software Engineer

VIRES Simulationstechnologie GmbH
A Member of the MSC.Software Group of Companies
Grassinger Strasse 8 ▪ 83043 Bad Aibling ▪ Germany
Phone: +49.8061.939093-54
Fax: +49.8061.939093-13
Email: gordon.koefner at vires.com
Internet: www.vires.com

VIRES Simulationstechnologie GmbH, Firmensitz: Grassinger Strasse 8, D-83043 Bad Aibling
Registergericht: Traunstein - HRB 10410, Geschäftsführer: Marius Dupuis
Email Disclaimer: https://vires.com/e-mail-disclaimer/



More information about the CMake mailing list