Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions dep/cpptrace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,11 @@ if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF)
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
URL "${CPPTRACE_ZSTD_URL}"
)
FetchContent_MakeAvailable(zstd)
FetchContent_GetProperties(zstd)
if(NOT zstd_POPULATED)
FetchContent_Populate(zstd)
add_subdirectory(${zstd_SOURCE_DIR}/build/cmake ${zstd_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
# Libdwarf itself
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
Expand All @@ -438,7 +442,11 @@ if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF)
GIT_TAG ${CPPTRACE_LIBDWARF_TAG}
GIT_SHALLOW ${CPPTRACE_LIBDWARF_SHALLOW}
)
FetchContent_MakeAvailable(libdwarf)
FetchContent_GetProperties(libdwarf)
if(NOT libdwarf_POPULATED)
FetchContent_Populate(libdwarf)
add_subdirectory(${libdwarf_SOURCE_DIR} ${libdwarf_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
target_include_directories(
dwarf
PRIVATE
Expand Down Expand Up @@ -601,9 +609,10 @@ endif()

# =============================================== Install ===============================================

if(NOT CMAKE_SKIP_INSTALL_RULES)
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"

# include(cmake/InstallRules.cmake)
# endif()

# =============================================== Demo/test ===============================================

Expand Down
51 changes: 51 additions & 0 deletions dep/cpptrace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,54 @@ README.md -> README_original.md

# create config file that points to targets file
```

### Disabled install rules to prevent cmake_install.cmake generation
```diff
--- a/dep/cpptrace/CMakeLists.txt
+++ b/dep/cpptrace/CMakeLists.txt
@@ -598,6 +598,9 @@ endif()

# =============================================== Install ===============================================

-if(NOT CMAKE_SKIP_INSTALL_RULES)
- include(cmake/InstallRules.cmake)
-endif()
+# if(NOT CMAKE_SKIP_INSTALL_RULES)
+# include(cmake/InstallRules.cmake)
+# endif()

# =============================================== Demo/test ===============================================
```

### Prevent zstd, libdwarf from installing files (EXCLUDE_FROM_ALL)
Use `FetchContent_Populate` + `add_subdirectory(EXCLUDE_FROM_ALL)` instead of
`FetchContent_MakeAvailable` so the subprojects are excluded from the install step.
```diff
--- a/dep/cpptrace/CMakeLists.txt
+++ b/dep/cpptrace/CMakeLists.txt
@@ -424,7 +424,11 @@ if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF)
URL "${CPPTRACE_ZSTD_URL}"
)
- FetchContent_MakeAvailable(zstd)
+ FetchContent_GetProperties(zstd)
+ if(NOT zstd_POPULATED)
+ FetchContent_Populate(zstd)
+ add_subdirectory(${zstd_SOURCE_DIR}/build/cmake ${zstd_BINARY_DIR} EXCLUDE_FROM_ALL)
+ endif()
endif()
# Libdwarf itself
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
@@ -435,7 +439,11 @@ if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF)
GIT_TAG ${CPPTRACE_LIBDWARF_TAG}
GIT_SHALLOW ${CPPTRACE_LIBDWARF_SHALLOW}
)
- FetchContent_MakeAvailable(libdwarf)
+ FetchContent_GetProperties(libdwarf)
+ if(NOT libdwarf_POPULATED)
+ FetchContent_Populate(libdwarf)
+ add_subdirectory(${libdwarf_SOURCE_DIR} ${libdwarf_BINARY_DIR} EXCLUDE_FROM_ALL)
+ endif()
target_include_directories(
dwarf
PRIVATE
```