[CPack] Avoiding packaging (some) dependencies

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

[CPack] Avoiding packaging (some) dependencies

Drago Trusk
Hi everyone,

I have particular problem which I'm unable to solve.

Lets say there are following components:
 - Main: library/executable
 - Ignorable: Main requires it to build, but not for packaging

Main simply defines:
add_dependencies(Main Ignorable)

FindIgnorable.cmake contains something like:
add_custom_target(Ignorable
  COMMAND ... ... && cmake --build --target install .
  # ...
)

Problem is that deb cpack generator picks this from install tree (tar/zip doesn't contain Ignorable). So deb ends up with:
# ... correct fs hierarchy
/home/saduser/projects/ignorableinstall

I need to avoid dependency used only for building artifacts. 

What I found:
- Remove add_dependency
---- Problem: have to build dependencies manually and will break CI and other people builds
- Disable automatic packaging of everything and specify custom components to package
---- Problem: Dependency tree which might be bigger and requires to know too many details. In addition requires for outside  changes so that all targets have (appropriate)  install conponents.

I tried everything else that is possible. Am i missing something or are those two only viable options?

Bye,
Drago

--

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: [CPack] Avoiding packaging (some) dependencies

Eric Noulard


2018-05-16 9:33 GMT+02:00 Drago Trusk <[hidden email]>:
Hi everyone,

I have particular problem which I'm unable to solve.

Lets say there are following components:
 - Main: library/executable
 - Ignorable: Main requires it to build, but not for packaging

Main simply defines:
add_dependencies(Main Ignorable)

FindIgnorable.cmake contains something like:
add_custom_target(Ignorable
  COMMAND ... ... && cmake --build --target install .
  # ...
)

Problem is that deb cpack generator picks this from install tree (tar/zip doesn't contain Ignorable). So deb ends up with:
# ... correct fs hierarchy
/home/saduser/projects/ignorableinstall

I need to avoid dependency used only for building artifacts. 

What I found:
- Remove add_dependency
---- Problem: have to build dependencies manually and will break CI and other people builds
- Disable automatic packaging of everything and specify custom components to package
---- Problem: Dependency tree which might be bigger and requires to know too many details. In addition requires for outside  changes so that all targets have (appropriate)  install conponents.

I tried everything else that is possible. Am i missing something or are those two only viable options?

I think the second option should be ok and not that complicated.
Put the "Ignorable" in an "IgnoredComp" install component and remove this
component from the list of installed components.

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL """)


AFAIR you don't need to defined a component for every install because CPack already does that for you.
I think that every bits installed without component specification ends-up in the trap-them-all 
"Unspecified" component which is automatically created by CPack.


Another way to do that even more simply (**if you are sure no component are defined**)
would be to:

1) install ignorable in "IgnoredComp" component
2) let all other be in your default component
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "InstallThatOnly")
3) only install your default component
set(CPACK_COMPONENTS_ALL "InstallThatOnly")


--
Eric

--

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: [CPack] Avoiding packaging (some) dependencies

Drago Trusk
Thank you for your answer!

I was afraid there was no other option.
Problem is that "Ignorable" is a transient dependency of a target which I need (both don't specify components) and therefore both are somewhat out of my control, but I guess modification to them will be necessary.

I wasn't aware of REMOVE_ITEM CPACK_COMPONENTS_ALL and hint is much appreciated (though sadly I cannot use it). Good to know ;)

On Wed, May 16, 2018 at 10:37 AM Eric Noulard <[hidden email]> wrote:


2018-05-16 9:33 GMT+02:00 Drago Trusk <[hidden email]>:
Hi everyone,

I have particular problem which I'm unable to solve.

Lets say there are following components:
 - Main: library/executable
 - Ignorable: Main requires it to build, but not for packaging

Main simply defines:
add_dependencies(Main Ignorable)

FindIgnorable.cmake contains something like:
add_custom_target(Ignorable
  COMMAND ... ... && cmake --build --target install .
  # ...
)

Problem is that deb cpack generator picks this from install tree (tar/zip doesn't contain Ignorable). So deb ends up with:
# ... correct fs hierarchy
/home/saduser/projects/ignorableinstall

I need to avoid dependency used only for building artifacts. 

What I found:
- Remove add_dependency
---- Problem: have to build dependencies manually and will break CI and other people builds
- Disable automatic packaging of everything and specify custom components to package
---- Problem: Dependency tree which might be bigger and requires to know too many details. In addition requires for outside  changes so that all targets have (appropriate)  install conponents.

I tried everything else that is possible. Am i missing something or are those two only viable options?

I think the second option should be ok and not that complicated.
Put the "Ignorable" in an "IgnoredComp" install component and remove this
component from the list of installed components.

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL """)


AFAIR you don't need to defined a component for every install because CPack already does that for you.
I think that every bits installed without component specification ends-up in the trap-them-all 
"Unspecified" component which is automatically created by CPack.


Another way to do that even more simply (**if you are sure no component are defined**)
would be to:

1) install ignorable in "IgnoredComp" component
2) let all other be in your default component
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "InstallThatOnly")
3) only install your default component
set(CPACK_COMPONENTS_ALL "InstallThatOnly")


--
Eric

--

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