Skip to content

cmake: add support#400

Closed
vszakats wants to merge 61 commits intocurl:masterfrom
vszakats:cm
Closed

cmake: add support#400
vszakats wants to merge 61 commits intocurl:masterfrom
vszakats:cm

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented Oct 19, 2025

It supports building the manual, completions, run tests and install all
these.

Options:

  • TRURL_EMABLE_MANUAL: Build the trurl man page (requires Perl). Default: ON
  • TRURL_COMPLETION_ZSH: Install zsh completions (requires POSIX shell). Default: OFF
  • TRURL_TESTS: Run tests (requires Python). Default: ON
    Test targets: trurl-test, trurl-test-memory.
  • TURLS_DISABLE_INSTALL: Disable installation targets. Default OFF
  • TRURL_WERROR: Turn compiler warnings into errors. Default: OFF
  • CURL_INCLUDE_DIR: Absolute path to curl include directory.
  • CURL_LIBRARY: Absolute path to libcurl library.
  • CURL_USE_STATIC_LIBS: Look for static libcurl library (requires CMake v3.28).

Also:

  • CI: test CMake builds on Linux, macOS, Cygwin, Windows (MSVC). Windows
    uses the latest curl-for-win binary from curl.se/windows.
  • trurl: disable punycode feature for Windows. It doesn't pass the 4
    tests requiring this feature, as tested with both Unicode and non-Unicode
    libcurl builds.
  • trurl: fix dangling variable (reported by MSVC).
    trurl.c(1206,1): warning C4701: potentially uninitialized local variable 'olen' used
    
  • trurl: fix unreachable code (reported by MSVC).
    trurl.c(830,1): warning C4702: unreachable code
    
  • trurl: disable MSVC CRT warnings on insecure fopen() and
    strerror().
  • include cmake documentation in CMakeLists.txt itself.
  • test.py: show filename of trurl binary.
  • generate_completions.sh: replace hardcoded output with stdout.
    To not pollute the source tree in out-of-tree builds.
  • generate_completions.sh: convert to POSIX shell.
  • generate_completions.sh: set -eu.
  • generate_completions.sh: fix indent.
  • merge completions directory into scripts.
  • .gitignore: not building kernel modules.
  • CI: add cmake linter.
  • CI: make Cygwin build steps "hermetic", by excluding everything from
    PATH, except Cygwin.
  • CI: drop a redundant Cygwin package.
  • CI: dedupe checksrc into its own job.
    Also to untie it from Makefile.

  • CI tests.

@vszakats
Copy link
Copy Markdown
Member Author

vszakats commented Oct 19, 2025

4 tests fail on Windows. I presume it's due to missing Unicode support in trurl and/or libcurl.

All for tests with 'required: "punycode"':
https://github.com/curl/trurl/actions/runs/18636413448/job/53128179515?pr=400

When running the first test with wine, test.py crashes with:

  File "trurl/test.py", line 103, in runCommand
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 9: invalid continuation byte

Oh, this was with a libcurl-x64.dll picked up by wine from somewhere on the disk, versioned 7.83.1:

trurl version 0.16.1 libcurl/7.83.1 [built-with 8.16.0]
features: get-empty imap-options no-guess-scheme normalize-ipv4 punycode punycode2idn url-strerror white-space zone-id

It fails normally with the matching 8.16.0 dll (latest curl-for-win official):

trurl version 0.16.1 libcurl/8.16.0 [built-with 8.16.0]
features: get-empty imap-options no-guess-scheme normalize-ipv4 punycode punycode2idn url-strerror white-space zone-id uppercase-hex

Same failure happens with a 8.15.0 dll with Unicode enabled (a private curl-for-win build):

trurl version 0.16.1 libcurl/8.15.0 [built-with 8.15.0]
features: get-empty imap-options no-guess-scheme normalize-ipv4 punycode punycode2idn url-strerror white-space zone-id uppercase-hex

This suggests that trurl doesn't support punycode on Windows.

```
trurl.c(463,9): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
trurl.c(2093,41): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
trurl.c(2114,36): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
```
Fixing (MSVC):
```
trurl.c(830,1): warning C4702: unreachable code
```
Ref: https://github.com/curl/trurl/actions/runs/18633529826/job/53121570241#step:5:82
@vszakats vszakats force-pushed the cm branch 2 times, most recently from 6b21b28 to 426c5d3 Compare October 20, 2025 10:11
@vszakats vszakats closed this in 9fe363e Oct 20, 2025
@vszakats vszakats deleted the cm branch October 20, 2025 10:24
vszakats added a commit that referenced this pull request Oct 20, 2025
Also fixing a bad typo in the original name.

Follow-up to 9fe363e #400
vszakats added a commit that referenced this pull request Oct 20, 2025
vszakats added a commit that referenced this pull request Oct 20, 2025
vszakats added a commit to curl/curl-for-win that referenced this pull request Oct 21, 2025
vszakats added a commit to vszakats/trurl that referenced this pull request Oct 31, 2025
vszakats added a commit that referenced this pull request Oct 31, 2025
vszakats added a commit to vszakats/trurl that referenced this pull request Jan 22, 2026
Fixing:
```
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_BUILD_TYPE
```

Follow-up to 9fe363e curl#400
vszakats added a commit that referenced this pull request Jan 22, 2026
Fixing:
```
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_BUILD_TYPE
```

Follow-up to 9fe363e #400
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.

1 participant