Skip to content

cmake: use numeric comparison for HAVE_WIN32_WINNT#14409

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:cm-hex-compare
Closed

cmake: use numeric comparison for HAVE_WIN32_WINNT#14409
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:cm-hex-compare

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Aug 6, 2024

Turns out CMake supports numeric comparison with hexadecimal values.
Confirmed in GHA/linux-old with CMake 3.7.2. I could not find
documentation about this, but our CMakeLists.txt already used it before
this patch.

Extend that method to two more comparisons.

Also pad the value in the existing one to 4 digits.

The padding/lowercasing logic when setting HAVE_WIN32_WINNT is no
longer required, but keep it anyway for uniform log output.

Follow-up to 2100d9f #12044
Closes #14409

Turns out CMake supports numeric comparison with hexadecimal values.
Confirmed in GHA/linux-old with CMake 3.7.2. I could not find
documentation about this, but our CMakeLists.txt already used it
before this patch.

Extend that method to two more comparisons.

Also pad the value in the existing one to 4 digits.

The padding/lowercasing logic when setting `HAVE_WIN32_WINNT` is no
longer required, but keep it anyway for uniform log output.

Follow-up to 2100d9f curl#12044
Closes #xxxxx
@vszakats vszakats closed this in 72ae0d8 Aug 6, 2024
@vszakats vszakats deleted the cm-hex-compare branch August 6, 2024 09:06
vszakats added a commit to vszakats/curl that referenced this pull request Aug 7, 2024
- unquote numeric value.

- replace macro with variable name.
  It also avoids this error when the variable is undefined:
  ```
  CMake Error at CMakeLists.txt:1529 (if):
  if given arguments:
    "GREATER" "4"
  Unknown arguments specified
  ```
  https://github.com/curl/curl/actions/runs/10289921657/job/28478722584#step:30:356

Follow-up to 72ae0d8 curl#14409
Follow-up to acbc6b7 curl#14197

Closes #xxxxx
vszakats added a commit that referenced this pull request Aug 7, 2024
- unquote numeric value.

- `NOT LESS` -> `GREATER_EQUAL`.

- replace macro with variable name.
  It also avoids this error when the variable is undefined:
  ```
  CMake Error at CMakeLists.txt:1529 (if):
  if given arguments:
    "GREATER" "4"
  Unknown arguments specified
  ```
  https://github.com/curl/curl/actions/runs/10289921657/job/28478722584#step:30:356

Follow-up to 72ae0d8 #14409
Follow-up to acbc6b7 #14197

Closes #14449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants