Skip to content

Bump minimum CMake to 3.13 so option() honors parent-set variables (CMP0077)#525

Merged
slabko merged 1 commit into
masterfrom
cmake-miminum-version-3.13
Jun 26, 2026
Merged

Bump minimum CMake to 3.13 so option() honors parent-set variables (CMP0077)#525
slabko merged 1 commit into
masterfrom
cmake-miminum-version-3.13

Conversation

@slabko

@slabko slabko commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

When clickhouse-cpp is consumed via add_subdirectory(), setting one of its options from the parent project does not take effect. For example:

 set(WITH_OPENSSL ON)
 add_subdirectory(contrib/clickhouse-cpp)

The setting is not applied - WITH_OPENSSL stays OFF, i.e. it option silently reverts to the default declared in its OPTION() call.

The project declared CMAKE_MINIMUM_REQUIRED (VERSION 3.12). Policy CMP0077 (option() honors normal variables) was introduced in CMake 3.13, so under 3.12 it is unset and uses OLD behavior: option() ignores the normal variable set by the parent and overwrites the value with the option's default. The parent's set() is silently discarded, which is especially misleading for WITH_OPENSSL (default OFF) since the build still succeeds, just without TLS.

CMake 3.13 (Nov 2018) is available on all currently supported platforms and CI images, so the bump is low-risk. Standalone configure/build is unaffected.

…MP0077)

When clickhouse-cpp is consumed via add_subdirectory(), setting one of its options from the parent
project does not take effect. For example:

     set(WITH_OPENSSL ON)
     add_subdirectory(contrib/clickhouse-cpp)

The setting is not applied -  WITH_OPENSSL stays OFF, i.e. it option silently reverts to the default
declared in its OPTION() call.

The project declared CMAKE_MINIMUM_REQUIRED (VERSION 3.12). Policy CMP0077 ("option() honors
normal variables") was introduced in CMake 3.13, so under 3.12 it is unset and uses OLD behavior:
option() ignores the normal variable set by the parent and overwrites the value with the option's
default. The parent's set() is silently discarded, which is especially misleading for WITH_OPENSSL
(default OFF) since the build still succeeds, just without TLS.

CMake 3.13 (Nov 2018) is available on all currently supported platforms and CI images, so the bump
is low-risk. Standalone configure/build is unaffected.
@slabko slabko requested a review from mzitnik as a code owner June 26, 2026 14:38
@slabko slabko merged commit 06b21ba into master Jun 26, 2026
54 checks passed
@slabko slabko deleted the cmake-miminum-version-3.13 branch June 26, 2026 15:42
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