Excluding targets from install set

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Excluding targets from install set

Gordon Koefner
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: [hidden email]
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/

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Excluding targets from install set

Craig Scott-3


On Tue, Jul 23, 2019 at 7:04 PM Gordon Koefner <[hidden email]> wrote:
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.


A bit late, but clearing my inbox and found this one still unanswered. ;) I typically handle this situation by defining install components for my own part of the build (i.e. including COMPONENT options with my install() commands). Then when I want to make packages, I populate CPACK_COMPONENTS_ALL with just those components I want included. All dependencies are part of the build (using FetchContent), it's just that I don't add their install components to my list so they are left out. I don't do a bare "make install", I always create packages, so this works for me. If you did want to do an install directly, you could use the new "cmake --install" functionality added in CMake 3.15 which supports specifying the component to install. The end of the documentation page for the install() command also shows another way to install components selectively (under the heading Generated Installation Script).

--
Craig Scott
Melbourne, Australia

Get the hand-book for every CMake user: Professional CMake: A Practical Guide

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake