← Commit list

3aa4fbf2d4

Viktor Szakats
Viktor Szakats
2026-01-26
SUCCESS Duration: 310s

Subject

cmake: add `CURL_BUILD_EVERYTHING` option

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

CMakeLists.txt+5 -4
@@ -178,6 +178,7 @@ option(BUILD_STATIC_LIBS "Build static libraries" OFF)
option(BUILD_STATIC_CURL "Build curl executable with static libcurl" OFF)
option(ENABLE_ARES "Enable c-ares support" OFF)
option(CURL_DISABLE_INSTALL "Disable installation targets" OFF)
+option(CURL_BUILD_EVERYTHING "Build optional build targets (examples, tests) by default" OFF)
if(WIN32)
option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
@@ -545,10 +546,7 @@ if(PERL_EXECUTABLE)
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh" "lib/ca-bundle.crt"
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh"
)
- if(CURL_LINT)
- set(_lint_all ALL)
- endif()
- add_custom_target(curl-lint "${_lint_all}"
+ add_custom_target(curl-lint
COMMENT "Running lint checks" VERBATIM USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/checksrc-all.pl"
@@ -557,6 +555,9 @@ if(PERL_EXECUTABLE)
"${PROJECT_SOURCE_DIR}/scripts/checksrc-all.pl" "${PROJECT_SOURCE_DIR}/scripts/checksrc.pl"
"${PROJECT_SOURCE_DIR}/scripts/spacecheck.pl"
)
+ if(CURL_LINT)
+ set_target_properties(curl-lint PROPERTIES EXCLUDE_FROM_ALL FALSE)
+ endif()
endif()
option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON)
docs/INSTALL-CMAKE.md+3 -0
@@ -225,6 +225,9 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `BUILD_STATIC_CURL`: Build curl executable with static libcurl. Default: `OFF` (turns to `ON`, when building static libcurl only)
- `BUILD_STATIC_LIBS`: Build static libraries. Default: `OFF` (turns to `ON` if `BUILD_SHARED_LIBS` is `OFF`)
- `BUILD_TESTING`: Build tests. Default: `ON`
+- `CURL_BUILD_EVERYTHING`: Build optional build targets (examples, tests) by default. Default: `OFF`
+ Set `QUICK` to build examples quickly with the `curl-examples-build` target (for build tests).
+ Set `NOEXAMPLES` to not build examples.
- `CURL_CLANG_TIDY`: Run the build through `clang-tidy`. Default: `OFF`
If enabled, it implies `CMAKE_UNITY_BUILD=OFF` and `CURL_DISABLE_TYPECHECK=ON`.
- `CURL_CLANG_TIDYFLAGS`: Custom options to pass to `clang-tidy`. Default: (empty)
docs/examples/CMakeLists.txt+6 -1
@@ -21,7 +21,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
-
add_custom_target(curl-examples)
# Get check_PROGRAMS, COMPLICATED_MAY_BUILD, COMPLICATED_EXAMPLES variables
@@ -90,3 +89,9 @@ endforeach()
if(_with_deps)
message(STATUS "Enabled examples with dependencies:${_with_deps}")
endif()
+
+if(CURL_BUILD_EVERYTHING STREQUAL "QUICK")
+ set_target_properties(curl-examples-build PROPERTIES EXCLUDE_FROM_ALL FALSE)
+elseif(CURL_BUILD_EVERYTHING AND NOT CURL_BUILD_EVERYTHING STREQUAL "NOEXAMPLES")
+ set_target_properties(curl-examples PROPERTIES EXCLUDE_FROM_ALL FALSE)
+endif()
tests/CMakeLists.txt+3 -0
@@ -33,6 +33,9 @@ add_custom_target(testdeps)
if(BUILD_CURL_EXE)
add_dependencies(testdeps "curlinfo")
endif()
+if(CURL_BUILD_EVERYTHING)
+ set_target_properties(testdeps PROPERTIES EXCLUDE_FROM_ALL FALSE)
+endif()
if(CURL_CLANG_TIDY)
add_custom_target(tests-clang-tidy)