Skip to content

Conversation

@schell244
Copy link
Contributor

@schell244 schell244 commented Jan 10, 2026

🍰 Pullrequest

Skip install rules for cpptrace and its dependencies to avoid copying unnecessary lib and include folders.

  • cpptrace: Disable install rules (statically linked, not needed at runtime)
  • zstd: Use add_subdirectory(..., EXCLUDE_FROM_ALL) instead of
    FetchContent_MakeAvailable so its install rules are not executed
  • libdwarf: Same change as zstd

Proof

  • None

Issues

  • None

How2Test

  • None

Todo / Checklist

  • None

include(cmake/InstallRules.cmake)
endif()
# Disabled: cpptrace is statically linked and not needed at runtime
# if(NOT CMAKE_SKIP_INSTALL_RULES)
Copy link
Collaborator

@0blu 0blu Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just CMAKE_SKIP_INSTALL_RULES=TRUE inside <root>/dep/CMakeLists.txt:24, so we don't modify the cpptrace tree.
It's hard to keep track of those changes if we upgrade the version of cpptrace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I've tried with the first commit, but it broke the install process.

Copy link
Collaborator

@0blu 0blu Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let us try this in dep/CMakeLists.txt

set(PREV_SKIP_INSTALL_RULES ${CMAKE_SKIP_INSTALL_RULES})
set(CMAKE_SKIP_INSTALL_RULES TRUE)
add_subdirectory(cpptrace)
set(CMAKE_SKIP_INSTALL_RULES ${PREV_SKIP_INSTALL_RULES})

( And also please add a comment explaining why we are doing that :P )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting CMAKE_SKIP_INSTALL_RULES = TRUE prevents CMake from generating cpptrace/cmake_install.cmake. But it seems the parent install script dep/cmake_install.cmake (auto-generated) always tries to include install scripts from all subdirectories

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what are we settling on? Is the current solution the best approach?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schell244 can you please document your current change in dep/cpptrace/README.md under "## Manual Changes"

@mserajnik
Copy link
Contributor

mserajnik commented Jan 18, 2026

Hmm, this doesn't seem to be working as intended for me; but maybe I'm misunderstanding something.

I am currently already manually removing include and lib in my Docker setup. (Yes, instead I should've just used --exclude with the COPY, but I only realized this afterwards and I was too lazy to change it 😄)

In preparation for this PR, I added some logging to confirm my manual cleanup would no longer be necessary when it gets merged. But when I build a Docker image from your PR branch, include and lib are still present for me until I manually delete them:

###BEFORE_CLEANUP###
total 32
drwxr-xr-x 8 vmangos vmangos 4096 Jan 18 15:14 .
drwxr-xr-x 1 root    root    4096 Jan 18 15:04 ..
drwxr-xr-x 3 vmangos vmangos 4096 Jan 18 15:14 bin
drwxr-xr-x 2 vmangos vmangos 4096 Jan 18 15:04 config
drwxr-xr-x 2 vmangos vmangos 4096 Jan 18 15:14 etc
drwxr-xr-x 2 vmangos vmangos 4096 Jan 18 15:14 include <-----------
drwxr-xr-x 4 vmangos vmangos 4096 Jan 18 15:14 lib <-----------
drwxr-xr-x 5 vmangos vmangos 4096 Jan 18 15:04 storage
###AFTER_CLEANUP###
total 32
drwxr-xr-x 1 vmangos vmangos 4096 Jan 18 15:14 .
drwxr-xr-x 1 root    root    4096 Jan 18 15:04 ..
drwxr-xr-x 3 vmangos vmangos 4096 Jan 18 15:14 bin
drwxr-xr-x 2 vmangos vmangos 4096 Jan 18 15:04 config
drwxr-xr-x 2 vmangos vmangos 4096 Jan 18 15:14 etc
drwxr-xr-x 5 vmangos vmangos 4096 Jan 18 15:04 storage

I am using a customCMAKE_INSTALL_PREFIX, but that shouldn't matter for this, right?

@schell244
Copy link
Contributor Author

Oh ok, thanks for pointing that out. The include/ and lib/ directories are most likely coming from zstd (and potentially libdwarf). These dependencies are dynamically fetched on Linux, which is probably why this issue only occurs there and not on Windows. Sorry for the delayed response, I'm currently on vacation and traveling.

@schell244 schell244 force-pushed the cpptrace_skip_install branch from 5e533af to c972274 Compare January 29, 2026 03:46
@schell244 schell244 force-pushed the cpptrace_skip_install branch from c972274 to 44d2a9e Compare January 30, 2026 04:52
@mserajnik
Copy link
Contributor

The include/ and lib/ directories are most likely coming from zstd (and potentially libdwarf).

Ah, sorry, that would make sense. I somehow didn't consider checking what is actually inside these directories, otherwise I would've probably realized myself that what's left in there is not targeted by your original changes here. 😅

Have a nice vacation!

@schell244 schell244 changed the title Exclude cpptrace from install target Exclude cpptrace and its deps from install to avoid copying lib/include Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants