Skip to content

cmake: add BUILD_EXAMPLES option to build examples - #13491

Closed
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:cmake-examples
Closed

cmake: add BUILD_EXAMPLES option to build examples#13491
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:cmake-examples

Conversation

@vszakats

@vszakats vszakats commented Apr 27, 2024

Copy link
Copy Markdown
Member

You can enable it with -DBUILD_EXAMPLES=ON.

To match autotools' make examples feature.
Windows (static) builds not tested.

Also enable examples in a pair of CI jobs.

Apply related updates to the macOS CI workflow:

  • drop unused CXX envs.
  • drop no longer needed -Wno-error=undef -Wno-error=conversion flags.
  • pass -Wno-deprecated-declarations to GCC too (for BUILD_EXAMPLES).
  • document why -Wno-deprecated-declarations is necessary.

Closes #13491

You can enable it with `-DBUILD_EXAMPLES=ON`.

To match autotools' `make examples` feature.

Closes #xxxxx
@github-actions github-actions Bot added the CI Continuous Integration label Apr 27, 2024
@vszakats vszakats changed the title cmake: add ability to build examples cmake: add BUILD_EXAMPLES option to build examples Apr 28, 2024
@vszakats vszakats closed this in dfdd978 Apr 28, 2024
@vszakats
vszakats deleted the cmake-examples branch April 28, 2024 22:27
vszakats added a commit that referenced this pull request Jul 8, 2024
With macOS there is a long-term struggle with deprecation warnings.
In curl they occur with LDAP, SecureTransport and in docs/examples.

There are three ways to fix them:
- by CFLAGS `-Wno-deprecated-declarations` as a workaround.
- by CFLAGS `-mmacosx-version-min` set to a version where the the
 feature was not deprecated.
- by CMake option `-DCMAKE_OSX_DEPLOYMENT_TARGET=`.

In GHA CMake jobs, all three were used, and `-mmacosx-version-min` was
set in a bogus way. Delete that bogus option, and delete the lone,
redundant CMake option too.

In a future commit I might replace the suppression option to properly
setting the target OS.

Follow-up to dfdd978 #13491
Cherry-picked from #14097
vszakats added a commit to vszakats/curl that referenced this pull request Aug 4, 2024
vszakats added a commit that referenced this pull request Aug 4, 2024
vszakats added a commit that referenced this pull request Sep 20, 2024
- Move `docs/examples` builds under a separate target.

- Make `BUILD_EXAMPLES` default to `ON`. It means to generate the rules
  for `docs/examples` by default, but not build them. To build them,
  an explicit `make curl-examples` (or ninja, etc) command is necessary.
  This syncs behaviour with autotools, and also how both cmake and
  autotools are building tests.

- GHA: update cmake jobs to use the new way of building examples.

- GHA: move examples build step at the end of the job, after building
  and running tests. This allows to have build and test run results
  faster, and leave the seldom-changing examples build to the end.
  Building examples is the slowest build step with no practical way to
  make them fast.

- appveyor: enable building examples in two old-MSVC jobs.

- examples: fix examples to build cleanly with old MSVC versions.

- GHA/non-native: move example build log under a GHA foldable section.

- GHA/windows: move building examples into separate step for Linux cross
  jobs.

Follow-up to dfdd978 #13491
Closes #14906
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
- Move `docs/examples` builds under a separate target.

- Make `BUILD_EXAMPLES` default to `ON`. It means to generate the rules
  for `docs/examples` by default, but not build them. To build them,
  an explicit `make curl-examples` (or ninja, etc) command is necessary.
  This syncs behaviour with autotools, and also how both cmake and
  autotools are building tests.

- GHA: update cmake jobs to use the new way of building examples.

- GHA: move examples build step at the end of the job, after building
  and running tests. This allows to have build and test run results
  faster, and leave the seldom-changing examples build to the end.
  Building examples is the slowest build step with no practical way to
  make them fast.

- appveyor: enable building examples in two old-MSVC jobs.

- examples: fix examples to build cleanly with old MSVC versions.

- GHA/non-native: move example build log under a GHA foldable section.

- GHA/windows: move building examples into separate step for Linux cross
  jobs.

Follow-up to dfdd978 curl#13491
Closes curl#14906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration cmake documentation

Development

Successfully merging this pull request may close these issues.

1 participant