raven icon indicating copy to clipboard operation
raven copied to clipboard

cmake --install should only install raven, not dependent libraries

Open jminor opened this issue 1 year ago • 1 comments
trafficstars

If you run cmake --install . after building raven, it installs the raven executable, and all the dependent libraries in /usr/local/ even though we statically link those libraries into the raven executable. Instead, only the executable should be installed.

Example:

~/git/raven/build ⭐ sudo cmake --install .
Password:
-- Install configuration: "Release"
-- Installing: /usr/local/bin/raven
-- Installing: /usr/local/include/Imath/ImathConfig.h
-- Installing: /usr/local/lib/pkgconfig/Imath.pc
-- Installing: /usr/local/lib/cmake/Imath/ImathConfig.cmake
-- Installing: /usr/local/lib/cmake/Imath/ImathConfigVersion.cmake
-- Old export file "/usr/local/lib/cmake/Imath/ImathTargets.cmake" will be replaced.  Removing files [/usr/local/lib/cmake/Imath/ImathTargets-debug.cmake, /usr/local/lib/cmake/Imath/ImathTargets-release.cmake].
-- Installing: /usr/local/lib/cmake/Imath/ImathTargets.cmake
-- Installing: /usr/local/lib/cmake/Imath/ImathTargets-release.cmake
-- Installing: /usr/local/lib/libImath-3_2.a
-- Installing: /usr/local/include/Imath/half.h
-- Up-to-date: /usr/local/include/Imath/halfFunction.h
-- Up-to-date: /usr/local/include/Imath/halfLimits.h
-- Up-to-date: /usr/local/include/Imath/ImathBox.h
-- Up-to-date: /usr/local/include/Imath/ImathBoxAlgo.h
...etc.

jminor avatar Oct 10 '24 20:10 jminor

Notes to an implementor: I believe the solution runs along the lines of explicitly only installing raven,

install(TARGETS raven)

and then using this flag

set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)

If it's necessary to install SOMETHING, an alternative is explicitly exclude the install step for things that shouldn't be installed, using the uninituitively named EXCLUDE_FROM_ALL option.

set_target_properties(Imath PROPERTIES EXCLUDE_FROM_ALL TRUE)

meshula avatar Oct 10 '24 21:10 meshula