Skip to content

cmake: allow ENABLE_CURLDEBUG=OFF with ENABLE_DEBUG=ON#13792

Closed
vszakats wants to merge 4 commits intocurl:masterfrom
vszakats:cmake-allow-disabling-curldebug-with-debugbuild
Closed

cmake: allow ENABLE_CURLDEBUG=OFF with ENABLE_DEBUG=ON#13792
vszakats wants to merge 4 commits intocurl:masterfrom
vszakats:cmake-allow-disabling-curldebug-with-debugbuild

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented May 27, 2024

Before this patch, ENABLE_CURLDEBUG (memory tracking) was
unconditionally enabled when ENABLE_DEBUGBUILD was set. This made
testing some build configurations complicated. To fix it, this patch
makes ENABLE_CURLDEBUG to receive the value of ENABLE_DEBUG by
default, while allowing free override by the user.

This allows to use the config:
ENABLE_DEBUGBUILD=ON ENABLE_CURLDEBUG=OFF
to enable debug features, without also enabling memory tracking.

This is important because some other build methods allow to set one of
these features but not the other. This patch allows to test any
combination with CMake.

This makes it unnecessary to use the workaround of passing
-DDEBUGBUILD via CMAKE_C_FLAGS. Which has the disadvantage that our
CMake logic cannot easily detect it, e.g. for disabling symbol hiding on
Windows for ENABLE_DEBUG/DEBUGBUILD builds.

Cherry-picked from #13718
Closes #13792

@github-actions github-actions bot added the CI Continuous Integration label May 27, 2024
vszakats added 2 commits May 27, 2024 16:29
Before this patch, `ENABLE_CURLDEBUG` (memory tracking) was
unconditionally enabled when `ENABLE_DEBUGBUILD` was set. This made
testing some build configurations complicated. To fix this, after this
patch we only enable `ENABLE_CURLDEBUG` if not already defined by the
user.

This allows to use this config:
ENABLE_DEBUGBUILD=ON
ENABLE_CURLDEBUG=OFF
to enable debug features, without also enabling memory tracking.

This is important because some other build methods allow to set
one of these features but not the other. This patch allows to test
any combination with CMake.

This makes it unnecessary to use the workaround of passing
`-DDEBUGBUILD` via `CMAKE_C_FLAGS`. Which has the disadvantage
that our CMake logic cannot easily detect it, e.g. for disabling
symbol hiding on Windows for `ENABLE_DEBUG`/`DEBUGBUILD` builds.

Cherry-picked from curl#13718
Closes #xxxxx
@vszakats vszakats force-pushed the cmake-allow-disabling-curldebug-with-debugbuild branch from e790429 to c53a2d0 Compare May 27, 2024 14:29
@vszakats vszakats marked this pull request as draft May 27, 2024 14:31
rework by making CURLDEBUG default on the DEBUG value.
@vszakats vszakats changed the title cmake: allow disabling ENABLE_CURLDEBUG with ENABLE_DEBUG=ON cmake: allow ENABLE_CURLDEBUG=OFF with ENABLE_DEBUG=ON May 27, 2024
@vszakats vszakats marked this pull request as ready for review May 27, 2024 15:00
This reverts commit c53a2d0.
@vszakats vszakats closed this in 9866e2e May 27, 2024
@vszakats vszakats deleted the cmake-allow-disabling-curldebug-with-debugbuild branch May 27, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cmake tests

Development

Successfully merging this pull request may close these issues.

1 participant