Skip to content

Issue-5369-Fix CMake Oauthbearer OIDC on Windows#5370

Open
Marc Gutman (icanhasmath) wants to merge 2 commits intoconfluentinc:masterfrom
ActiveState:fix/cmake-oauthbearer-oidc-msvc
Open

Issue-5369-Fix CMake Oauthbearer OIDC on Windows#5370
Marc Gutman (icanhasmath) wants to merge 2 commits intoconfluentinc:masterfrom
ActiveState:fix/cmake-oauthbearer-oidc-msvc

Conversation

@icanhasmath
Copy link
Copy Markdown

Define the same conditions for WITH_OAUTHBEARER_OIDC in Cmake as are defined at the top level CMakelists.txt

Closes #5369

WITH_CURL and WITH_OAUTHBEARER_OIDC were missing from Windows CMAKE setup, causing them to be treated as 0 by the
preprocessor regardless of the CMake option values, as cmake does not use win32_config.h.
Use WITH_SSL and WITH_CURL only.
@icanhasmath Marc Gutman (icanhasmath) requested a review from a team as a code owner March 27, 2026 20:30
Copilot AI review requested due to automatic review settings March 27, 2026 20:30
@confluent-cla-assistant
Copy link
Copy Markdown

Please sign the Contributor License Agreement here before this PR can be approved.
❌ icanhasmath
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses #5369 by aligning Windows CMake builds (when WITHOUT_WIN32_CONFIG is enabled) with the top-level CMakeLists.txt feature gating so that WITH_OAUTHBEARER_OIDC is reflected correctly at compile time when WITH_CURL and WITH_SSL are enabled.

Changes:

  • Add WITH_CURL compile definitions (1/0) under the WITHOUT_WIN32_CONFIG path.
  • Add WITH_OAUTHBEARER_OIDC compile definitions gated on WITH_SSL AND WITH_CURL under the WITHOUT_WIN32_CONFIG path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +186 to +187
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Defining WITH_OAUTHBEARER_OIDC=0 still makes the macro defined, which can unintentionally enable #ifdef WITH_OAUTHBEARER_OIDC code paths. In particular, src/rdkafka_conf.c includes <curl/curl.h> under #ifdef WITH_OAUTHBEARER_OIDC, so this change can force a curl header dependency even when WITH_CURL/OIDC are disabled and break builds where libcurl headers aren't present. Prefer only defining WITH_OAUTHBEARER_OIDC when it is enabled (omit the =0 definition), or switch the C code to #if WITH_OAUTHBEARER_OIDC so 0 behaves as disabled.

Suggested change
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)

Copilot uses AI. Check for mistakes.
Comment on lines +184 to +188
if(WITH_SSL AND WITH_CURL)
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=1)
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)
endif()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

For maintainability and to avoid condition drift, consider basing the compile definition on the already-derived CMake variable (WITH_OAUTHBEARER_OIDC) rather than duplicating the WITH_SSL AND WITH_CURL condition here.

Suggested change
if(WITH_SSL AND WITH_CURL)
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=1)
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)
endif()
if(WITH_OAUTHBEARER_OIDC)
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=1)
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)
endif(WITH_OAUTHBEARER_OIDC)

Copilot uses AI. Check for mistakes.
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=1)
else()
list(APPEND rdkafka_compile_definitions WITH_OAUTHBEARER_OIDC=0)
endif()
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Minor consistency: the surrounding blocks in this same WITHOUT_WIN32_CONFIG section use endif(<condition>) (e.g., endif(WITH_CURL) / endif(WITH_PLUGINS)). Using endif(WITH_SSL AND WITH_CURL) here as well would keep the style consistent and reduce ambiguity when scanning the file.

Suggested change
endif()
endif(WITH_SSL AND WITH_CURL)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window Cmake build ignores WITH_CURL affecting WITH_OAUTHBEARER_OIDC

3 participants