Skip to content

CMake: Don't fail if sandbox is "auto"#209

Closed
bansan85 wants to merge 1 commit into
tukaani-project:masterfrom
bansan85:sandbox-vs-sanitize
Closed

CMake: Don't fail if sandbox is "auto"#209
bansan85 wants to merge 1 commit into
tukaani-project:masterfrom
bansan85:sandbox-vs-sanitize

Conversation

@bansan85

Copy link
Copy Markdown

If sandbox is set to "auto", it means that CMake will make its best effort to enable sandbox. But CMake should not fail to configure if it can't enable sandbox.

Related to microsoft/vcpkg#49986

If sandbox is set to "auto", it means that CMake will make its best
effort to enable sandbox. But CMake should not fail to configure if
it can't enable sandbox.
@bansan85 bansan85 force-pushed the sandbox-vs-sanitize branch from d4b03ed to 9a9fe2f Compare February 19, 2026 09:25
@Larhzu

Larhzu commented Feb 19, 2026 via email

Copy link
Copy Markdown
Member

@bansan85

Copy link
Copy Markdown
Author
  1. I explicitly set -fsanitize=thread *_FLAGS in my triplet:
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CXX_FLAGS "-fsanitize=thread")
set(VCPKG_C_FLAGS "-fsanitize=thread")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_CUDA_FLAGS="-fsanitize=thread")
set(VCPKG_LINKER_FLAGS "-fsanitize=thread")

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_FIXUP_ELF_RPATH ON)
  1. Yes, I can do something like:
if (PORT STREQUAL "liblzma")
  set(VCPKG_CMAKE_CONFIGURE_OPTIONS ${VCPKG_CMAKE_CONFIGURE_OPTIONS} -DXZ_SANDBOX=no)
endif()

But I don't like writing packet-specific things in the triplet. But custom triplet are not officially supported by vcpkg. So I try to reduce impact in port implementation.

  1. Yes, I can modify the port to check if sanitize is enabled by reading VCPKG_C_FLAGS variable and updating XZ_SANDBOX variable.

There is a lot of solution. This is why I requested your opinion. To reduce maintenance in vcpkg project, patches are usually reported upstream. So if patching CMakeLists.txt is not the good solution, I will set XZ_SANDBOX.

Thanks

@bansan85 bansan85 closed this Feb 19, 2026
@Larhzu

Larhzu commented Feb 19, 2026 via email

Copy link
Copy Markdown
Member

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.

2 participants