History log of /curl/lib/CMakeLists.txt (Results 1 – 25 of 89)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 6a1dcdc5 26-Aug-2024 Viktor Szakats

cmake: tidy up

- unroll two short loops.
- unfold lines.
- merge lines with their comments.
- add missing quotes.
- tidy up grammar in error/warning messages.

Cherry

cmake: tidy up

- unroll two short loops.
- unfold lines.
- merge lines with their comments.
- add missing quotes.
- tidy up grammar in error/warning messages.

Cherry-picked from #14692
Closes #14998

show more ...


# 7100c5bc 06-Sep-2024 Viktor Szakats

build: tidy up and improve versioned-symbols options

- autotools: add support for custom prefix.
Usage: `--enable-versioned-symbols=MYPREFIX_`
Catching up with cmake.

-

build: tidy up and improve versioned-symbols options

- autotools: add support for custom prefix.
Usage: `--enable-versioned-symbols=MYPREFIX_`
Catching up with cmake.

- add default versioned prefix for Rustls builds.

- delete `HIDDEN` entry from version script `lib/libcurl.vers.in`.
It referred to symbol names that never existed in libcurl.

- cmake: use `lib/libcurl.vers.in` as a template instead of generating
it from scratch. Adapt `./configure` accordingly, and add comments
to keep hard-wired soname in sync with `lib/Makefile.soname`.

- autotools: delete Schannel and Secure Transport version prefixes.
Windows and macOS don't support the versioned symbols option.

Follow-up to 7b1444979094a365c82c665cce0e2ebc6b69467b #14378
Closes #14818

show more ...


# 445fb812 02-Sep-2024 Viktor Szakats

cmake, `Makefile.mk`: use `-isystem` for dep headers, silence BearSSL issues

Patch started out for working around compiler warnings in BearSSL latest
tarball release v0.6 (2018-08-14) an

cmake, `Makefile.mk`: use `-isystem` for dep headers, silence BearSSL issues

Patch started out for working around compiler warnings in BearSSL latest
tarball release v0.6 (2018-08-14) and Apple clang 14 with CMake.

Then turned into patching CMake and `Makefile.mk` builds to use
`-isystem` instead `-I` when adding header directories for
dependencies. This avoids compiler warnings in dependency headers,
syncing behaviour with autotools.

Also:
- `Makefile.mk`: add support for BearSSL.
- delete warning suppression for mbedTLS headers. No longer necessary
after this patch.
Follow-up to 434db995a7566a76f6a16391897816ddd1011adc #12720

Silenced BearSSL warnings:
```
In file included from curl/lib/vtls/bearssl.c:28:
In file included from bearssl/inc/bearssl.h:127:
bearssl/inc/bearssl_hash.h:727:5: warning: 'BR_DOXYGEN_IGNORE' is not defined, evaluates to 0 [-Wundef]
^
bearssl/inc/bearssl_hash.h:745:5: warning: 'BR_DOXYGEN_IGNORE' is not defined, evaluates to 0 [-Wundef]
^
In file included from curl/lib/vtls/bearssl.c:28:
In file included from bearssl/inc/bearssl.h:136:
bearssl/inc/bearssl_ssl.h:1253:20: warning: implicit conversion loses integer precision: 'unsigned int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
cc->version_min = version_min;
~ ^~~~~~~~~~~
bearssl/inc/bearssl_ssl.h:1254:20: warning: implicit conversion loses integer precision: 'unsigned int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
cc->version_max = version_max;
~ ^~~~~~~~~~~
bearssl/inc/bearssl_ssl.h:1327:28: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
ctx->protocol_names_num = num;
~ ^~~
5 warnings generated.
```

(These warnings were fixed in BearSSL Git master in 2019 via
2893441f2efd4603ddd6d7f49011bdda096a4a87 and
ecdf89770ee82dfea6186fb4369cff3d06cd852e.)

Also these two cases, which are caused by an unidentified component
(outside curl) cranking up MSVC warnings in external headers to `/W4`
when ZLIB is deselected:
https://github.com/curl/curl/pull/14859#issuecomment-2351809153

mbedTLS 3.6.1:
```
C:\vcpkg\installed\x64-windows\include\psa\crypto_struct.h(254,13): error C2220: the following warning is treated as an error [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
(compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
C:\vcpkg\installed\x64-windows\include\psa\crypto_struct.h(254,13): warning C4200: nonstandard extension used: zero-sized array in struct/union [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
(compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
```
Ref: https://github.com/curl/curl/actions/runs/10842694205/job/30107466989?pr=14859#step:10:29

nghttp3 1.5.0:
```
C:\vcpkg\installed\x64-windows\include\nghttp3\nghttp3.h(2678,1): error C2220: the following warning is treated as an error [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
(compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
C:\vcpkg\installed\x64-windows\include\nghttp3\nghttp3.h(2678,1): warning C4324: 'nghttp3_pri': structure was padded due to alignment specifier [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
(compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
```
Ref: https://github.com/curl/curl/actions/runs/10871875297/job/30166233862?pr=14859#step:10:28

Closes #14763

show more ...


# 0d1504b2 05-Sep-2024 Daniel Stenberg

libcurl.def: move from / into lib

It is meant for the library, it belongs in lib/

Closes #14796


# 8b091380 19-Aug-2024 Viktor Szakats

cmake: minor tidy-ups

- show `OpenSSL v3+` when detected (as in `./configure`).
(this string also makes its way to `curl-config`.)
- prefer `unset(VAR)` over `set(VAR)`.
Same

cmake: minor tidy-ups

- show `OpenSSL v3+` when detected (as in `./configure`).
(this string also makes its way to `curl-config`.)
- prefer `unset(VAR)` over `set(VAR)`.
Same effect, but `unset()` tells the intent unambiguously.
https://cmake.org/cmake/help/latest/command/set.html
- drop "implementation" from an `option()` description.
- FindGSS: replace legacy keyword alias with modern alternative.
https://cmake.org/cmake/help/latest/command/get_filename_component.html
- move `CURL_STATIC_CRT` logic next to its `option()`.
- improve order of `libcurl.pc`/`curl-config` variable init lines.
- tests: drop/shorten custom target names.
They inflated generated make files by 550KB.
Keep target name logic for sync between code snippets.
Follow-up to a2ef5d36b3cdec8120a4a9b782d18d58a70d4236 #14660
- clear a variable after use.
- restore `STATUS` for `Features:`/`Protocols:` `message()`s:
Without it the output goes to stderr, and appears in red in CMake GUI.
It doesn't seem possible to show a line on stdout without leading
underscores to match `curl -V` and `./configure` output.
Partial revert of acbc6b703f6b0ee568d053f6f2565fbc107b5fd3 #14197
- WindowsCache: move `HAVE_LINUX_TCP_H` into the header group.
- move strings to the same line as their `STRING` keyword.
- formatting in generated code.
- delete bogus comment.
- unfold lines for readability.
- fix a too long line. (for cmakelint)
- missing quotes, whitespace, comments.

Closes #14610

show more ...


# d8de4806 15-Aug-2024 Viktor Szakats

cmake: tidy-up continues

- move variable dump to a GHA foldable group.
- minimize scope for an include().
- rename `HIDES_CURL_PRIVATE_SYMBOLS` to `CURL_HIDES_PRIVATE_SYMBOLS`,

cmake: tidy-up continues

- move variable dump to a GHA foldable group.
- minimize scope for an include().
- rename `HIDES_CURL_PRIVATE_SYMBOLS` to `CURL_HIDES_PRIVATE_SYMBOLS`,
to keep it in the curl namespace.
- drop quotes from a version number.
- add missing `Makefile.inc` var refs to comment.
- FindNGTCP2: rename internal var to underscore/lowercase.
- FindBearSSL, FindGSS: whitespace.

Closes #14571

show more ...


# db39c668 14-Aug-2024 Viktor Szakats

cmake: sync up result variable names in Find modules

- bearssl, c-ares, gss, libpsl, libssh2, mbedtls:
Before this patch these Find modules returned results via
`<NAME>_INCLUDE_D

cmake: sync up result variable names in Find modules

- bearssl, c-ares, gss, libpsl, libssh2, mbedtls:
Before this patch these Find modules returned results via
`<NAME>_INCLUDE_DIR` and `<NAME>_LIBRARY`.

This patch makes them return `<NAME>_INCLUDE_DIRS` (note the `S`)
and `<NAME>_LIBRARIES` like other modules already did.

- bearssl, mbedtls:
Before this patch these Find modules allowed custom configuration
via `<NAME>_INCLUDE_DIRS` (note the `S`).

This patch makes them accept `<NAME>_INCLUDE_DIR`, like the rest of
the modules did.

Deprecate the old variables, but keep accepting them for
compatibility.

- bearssl: add missing `mark_as_advanced()` call.

Closes #14542

show more ...


# c2889a7b 04-Aug-2024 Viktor Szakats

cmake: more syntax tidy-up

- quote string literals.
In the hope it improves syntax-highlighting and readability.

- use lowercase, underscore-prefixed local var names.
As

cmake: more syntax tidy-up

- quote string literals.
In the hope it improves syntax-highlighting and readability.

- use lowercase, underscore-prefixed local var names.
As a hint for scope, to help readability.

- prefer `pkg_search_module` (over `pkg_check_modules`).
They are the same, but `pkg_search_module` stops searching
at the first hit.

- more `IN LISTS` in `foreach()`.

- OtherTests.cmake: clear `CMAKE_EXTRA_INCLUDE_FILES` after use.

- add `PROJECT_LABEL` for http/client and unit test targets.

- sync `Find*` module comments and formatting.

- drop a few local variables.

- drop bogus `CARES_LIBRARIES` from comment.

- unquote numeric literal.

Follow-up to acbc6b703f6b0ee568d053f6f2565fbc107b5fd3 #14197
Closes #14388

show more ...


# c6fb9895 06-Aug-2024 Viktor Szakats

cmake: cleanup header paths

- sync build-dir/source-dir header path order with autotools, by
including build-dir first, then source-dir.
This prevents out-of-tree builds breaking

cmake: cleanup header paths

- sync build-dir/source-dir header path order with autotools, by
including build-dir first, then source-dir.
This prevents out-of-tree builds breaking due to leftover generated
headers in the source tree.

- tests/unit: move `src` ahead of `libtest` in header path, syncing with
autotools.

- stop adding non-existing generated `include` dir to header path.
There are no generated `include` headers and this directory is either
missing in out-of-tree builds or the same as the one already added
globally via the root `CMakeLists.txt`.

- lib: stop adding a duplicate source include directory to the header
path.
It's already added globally via the root `CMakeLists.txt`.

- lib: stop adding the project root to the header path.

- docs/examples: drop internal header paths.
Examples do not and should not use internal headers.

- replace `curl_setup_once.h` in comments with `curl_setup.h`,
the header actually used, and also referred to in autotools comments.

- add comment why we need `src` in include path for `tests/server`.

- add quotes around header directories.

Closes #14416

show more ...


# 7b144497 04-Aug-2024 Viktor Szakats

cmake: add support for versioned symbols option

Implement the `--enable-versioned-symbols` feature available in
`./configure` for CMake.

Enable with `-DCURL_LIBCURL_VERSIONED_SY

cmake: add support for versioned symbols option

Implement the `--enable-versioned-symbols` feature available in
`./configure` for CMake.

Enable with `-DCURL_LIBCURL_VERSIONED_SYMBOLS=ON`. Customize the version
prefix with `-DCURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX=MYPREFIX_`. By
default the prefix matches what autotools uses.

When enabled, the feature is detected and a warning shown if
unavailable. (E.g. on Apple and Windows, it isn't.)

Included `HIDDEN {};` to match autotools, though I don't know if it's
necessary, useful or making any difference.

Differences from the autotools implementation:
- soversion is dynamic instead of hard-coded.
- omits referencing non-curl symbols.
- allows prefix/flavour override.
- more universal feature detection.
- doesn't rely on the in-repo `lib/libcurl.vers.in` file.

Also:
- add mbedTLS and BearSSL versioned symbol prefix support to autotools.
- enable this option in an old-linux job.

Follow-up to 7cc2e8b349df28d55d5f40bfae323485df9f0cf2
Fixes #14349
Closes #14378

show more ...


# acbc6b70 12-Jul-2024 Viktor Szakats

cmake: tidy-ups

- tidy-up comments.
- use lowercase, underscore prefixed names for internal variables.
- use `IN LISTS` and `IN ITEMS` in `foreach()` loops.
- rename variable nam

cmake: tidy-ups

- tidy-up comments.
- use lowercase, underscore prefixed names for internal variables.
- use `IN LISTS` and `IN ITEMS` in `foreach()` loops.
- rename variable name `OUTPUT` to a more distinctive one.
- tidy-up `STREQUAL` syntax.
- delete commented code.
- indent/whitespace.

Closes #14197

show more ...


# e5a35b49 13-Jun-2024 Viktor Szakats

cmake: enable SOVERSION for Cygwin and `CMAKE_DLL_NAME_WITH_SOVERSION`

- enable SOVERSION when `CMAKE_DLL_NAME_WITH_SOVERSION=ON` is set.
Ref: https://cmake.org/cmake/help/v3.27/variab

cmake: enable SOVERSION for Cygwin and `CMAKE_DLL_NAME_WITH_SOVERSION`

- enable SOVERSION when `CMAKE_DLL_NAME_WITH_SOVERSION=ON` is set.
Ref: https://cmake.org/cmake/help/v3.27/variable/CMAKE_DLL_NAME_WITH_SOVERSION.html
Use: https://github.com/search?q=-DCMAKE_DLL_NAME_WITH_SOVERSION&type=code

- enable SOVERSION for Cygwin builds by default.

Ref: #13936
Ref: #13944
Closes #13898

show more ...


# bd2d5db5 13-Jun-2024 Viktor Szakats

cmake: allow SOVERSION override with `CURL_LIBCURL_SOVERSION`

Allow overriding SOVERSION with the new CMake option:
`CURL_LIBCURL_SOVERSION=ON/OFF`

For certain target platforms

cmake: allow SOVERSION override with `CURL_LIBCURL_SOVERSION`

Allow overriding SOVERSION with the new CMake option:
`CURL_LIBCURL_SOVERSION=ON/OFF`

For certain target platforms the shared libcurl library filename
contains the SOVERSION. This new option allows to enable/disable
this behavior manually. If set, it takes precedence over the default
setting.

Ref: #13898
Closes #13944

show more ...


# 831047fd 13-Jun-2024 Viktor Szakats

cmake: stop setting SOVERSION for the static lib target

Also move the logic closer to its use and related tidy-ups.

Cherry-picked from #13898
Closes #13936


# 739ef980 19-May-2024 Viktor Szakats

cmake: use `APPLE` instead of `CMAKE_SYSTEM_NAME` string

Follow-up to a86254b39307af1a53735b065a382567805cd9b8 #12515
Closes #13713


# 0e176cab 19-May-2024 Viktor Szakats

cmake: whitespace, formatting/tidy-up in comments

Also correct casing in a few option descriptions.

Closes #13711


# 0b31c713 18-May-2024 Viktor Szakats

cmake: merge two `if(BUILD_TESTING)` branches

Closes #13708


# 7860f575 28-Nov-2023 Jay Satiro

dllmain: Call OpenSSL thread cleanup for Windows and Cygwin

- Call OPENSSL_thread_stop on thread termination (DLL_THREAD_DETACH)
to prevent a memory leak in case OpenSSL is linked stat

dllmain: Call OpenSSL thread cleanup for Windows and Cygwin

- Call OPENSSL_thread_stop on thread termination (DLL_THREAD_DETACH)
to prevent a memory leak in case OpenSSL is linked statically.

- Warn in libcurl-thread.3 that if OpenSSL is linked statically then it
may require thread cleanup.

OpenSSL may need per-thread cleanup to stop a memory leak. For Windows
and Cygwin if libcurl was built as a DLL then we can do that for the
user by calling OPENSSL_thread_stop on thread termination. However, if
libcurl was built statically then we do not have notification of thread
termination and cannot do that for the user.

Also, there are several other unusual cases where it may be necessary
for the user to call OPENSSL_thread_stop, so in the libcurl-thread
warning I added a link to the OpenSSL documentation.

Co-authored-by: Viktor Szakats

Reported-by: southernedge@users.noreply.github.com
Reported-by: zmcx16@users.noreply.github.com

Ref: https://www.openssl.org/docs/man3.0/man3/OPENSSL_thread_stop.html#NOTES

Fixes https://github.com/curl/curl/issues/12327
Closes https://github.com/curl/curl/pull/12408

show more ...


# aace27b0 06-Nov-2023 Charlie C

cmake: option to disable install & drop `curlu` target when unused

This patch makes the following changes:
- adds the option `CURL_DISABLE_INSTALL` - to disable 'install' targets.
-

cmake: option to disable install & drop `curlu` target when unused

This patch makes the following changes:
- adds the option `CURL_DISABLE_INSTALL` - to disable 'install' targets.
- Removes the target `curlu` when the option `BUILD_TESTING` is set to
`OFF` - to prevent it from being loaded in Visual Studio.

Closes #12287

show more ...


# f42a279e 03-Oct-2023 Viktor Szakats

cmake: fix unity with Windows Unicode + TrackMemory

Found the root cause of the startup crash in unity builds with Unicode
and TrackMemory enabled at the same time.

We must make

cmake: fix unity with Windows Unicode + TrackMemory

Found the root cause of the startup crash in unity builds with Unicode
and TrackMemory enabled at the same time.

We must make sure that the `memdebug.h` header doesn't apply to
`lib/curl_multibyte.c` (as even noted in a comment there.) In unity
builds all headers apply to all sources, including `curl_multibyte.c`.
This probably resulted in an infinite loop on startup.

Exclude this source from unity compilation with TrackMemory enabled,
in both libcurl and curl tool. Enable unity mode for a debug Unicode
CI job to keep it tested. Also delete the earlier workaround that
fully disabled unity for affected builds.

Follow-up to d82b080f6374433ce7c98241329189ad2d3976f8 #12005
Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 #11095

Closes #11928

show more ...


# ca7daadd 28-Sep-2023 Viktor Szakats

cmake: fix `HAVE_WRITABLE_ARGV` detection

Move detection before the creation of detection results in
`curl_config.h`.

Ref: #11964 (effort to sync cmake detections with autotools

cmake: fix `HAVE_WRITABLE_ARGV` detection

Move detection before the creation of detection results in
`curl_config.h`.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11978

show more ...


# a8ebde99 22-Sep-2023 Viktor Szakats

cmake: lib `CURL_STATICLIB` fixes (Windows)

- always define `CURL_STATICLIB` when building libcurl for Windows.

This disables `__declspec(dllexport)` for exported libcurl symbols.

cmake: lib `CURL_STATICLIB` fixes (Windows)

- always define `CURL_STATICLIB` when building libcurl for Windows.

This disables `__declspec(dllexport)` for exported libcurl symbols.
In normal mode (hide symbols) these exported symbols are specified
via `libcurl.def`. When not hiding symbols, all symbols are exported
by default.

Regression from 1199308dbc902c52be67fc805c72dd2582520d30

Fixes #11844

- fix to omit `libcurl.def` when not hiding private symbols.

Regression from 2ebc74c36a19a1700af394c16855ce144d9878e3

- fix `ENABLED_DEBUG=ON` + shared curl tool Windows builds by also
omitting `libcurl.def` in this case, and exporting all symbols
instead. This ensures that a shared curl tool can access all debug
functions which are not normally exported from libcurl DLL.

- delete `INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB"` for "objects"
target.

Follow-up to 2ebc74c36a19a1700af394c16855ce144d9878e3

- delete duplicate `BUILDING_LIBCURL` definitions.

- fix `HIDES_CURL_PRIVATE_SYMBOLS` to not overwrite earlier build settings.

Follow-up to 1199308dbc902c52be67fc805c72dd2582520d30

Closes #11914

show more ...


# fc9bfb14 08-Aug-2023 Viktor Szakats

cmake: allow `SHARE_LIB_OBJECT=ON` on all platforms

2ebc74c36a19a1700af394c16855ce144d9878e3 #11546 introduced sharing
libcurl objects for shared and static targets.

The above a

cmake: allow `SHARE_LIB_OBJECT=ON` on all platforms

2ebc74c36a19a1700af394c16855ce144d9878e3 #11546 introduced sharing
libcurl objects for shared and static targets.

The above automatically enabled for Windows builds, with an option to
disable with `SHARE_LIB_OBJECT=OFF`.

This patch extend this feature to all platforms as a manual option.
You can enable it by setting `SHARE_LIB_OBJECT=ON`. Then shared objects
are built in PIC mode, meaning the static lib will also have PIC code.

[EXPERIMENTAL]

Closes #11627

show more ...


# 2ebc74c3 30-Jul-2023 Viktor Szakats

cmake: add support for single libcurl compilation pass

Before this patch CMake builds used two separate compilation passes to
build the shared and static libcurl respectively. This patch

cmake: add support for single libcurl compilation pass

Before this patch CMake builds used two separate compilation passes to
build the shared and static libcurl respectively. This patch allows to
reduce that to a single pass if the target platform and build settings
allow it.

This reduces CMake build times when building both static and shared
libcurl at the same time, making these dual builds an almost zero-cost
option.

Enable this feature for Windows builds, where the difference between the
two passes was the use of `__declspec(dllexport)` attribute for exported
API functions for the shared builds. This patch replaces this method
with the use of `libcurl.def` at DLL link time.

Also update `Makefile.mk` to use `libcurl.def` to export libcurl API
symbols on Windows. This simplifies (or fixes) this build method (e.g.
in curl-for-win, which generated a `libcurl.def` from `.h` files using
an elaborate set of transformations).

`libcurl.def` has the maintenance cost of keeping the list of public
libcurl API symbols up-to-date. This list seldom changes, so the cost
is low.

Closes #11546

show more ...


# 1199308d 22-Jun-2023 Viktor Szakats

cmake: support building static and shared libcurl in one go

This patch adds the ability to build a static and shared libcurl library
in a single build session. It also adds an option to

cmake: support building static and shared libcurl in one go

This patch adds the ability to build a static and shared libcurl library
in a single build session. It also adds an option to select which one to
use when building the curl executable.

New build options:
- `BUILD_STATIC_LIBS`. Default: `OFF`.
Enabled automatically if `BUILD_SHARED_LIBS` is `OFF`.
- `BUILD_STATIC_CURL`. Default: `OFF`.
Requires `BUILD_STATIC_LIBS` enabled.
Enabled automatically if building static libcurl only.
- `STATIC_LIB_SUFFIX`. Default: empty.
- `IMPORT_LIB_SUFFIX`. Default: `_imp` if implib filename would collide
with static lib name (typically with MSVC) in Windows builds.
Otherwise empty.

Also:

- Stop setting the `CURL_STATICLIB` macro via `curl_config.h`, and pass
it directly to the compiler. This also allows to delete a condition
from `tests/server/CMakeLists.txt`.

- Complete a TODO by following the logic used in autotools (also for
`LIBCURL_NO_SHARED`), and set `-DCURL_STATICLIB` in `Cflags:` of
`libcurl.pc` for _static-only_ curl builds.

- Convert an existing CI test to build both shared and static libcurl.

Closes #11505

show more ...


1234