← Commit list

fff9905bcf

Viktor Szakats
Viktor Szakats
2026-02-22
SUCCESS Duration: 335s

Subject

cmake: force-disable unity for clang-tidied build targets only

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+0 -1
@@ -273,7 +273,6 @@ if(CURL_CLANG_TIDY)
set(PICKY_COMPILER OFF) # Do a best effort and skip passing non-clang warning options to clang-tidy.
# This lets through warning options enabled via CURL_WERROR=ON, affecting lib and src.
endif()
- set(CMAKE_UNITY_BUILD OFF) # clang-tidy is not looking into #included sources, thus not compatible with unity builds.
set(CURL_DISABLE_TYPECHECK ON) # to improve performance and avoid potential interference.
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY}")
list(APPEND CMAKE_C_CLANG_TIDY "--config-file=${PROJECT_SOURCE_DIR}/.clang-tidy.yml")
docs/INSTALL-CMAKE.md+2 -1
@@ -229,7 +229,8 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
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`.
+ If enabled, it implies `CURL_DISABLE_TYPECHECK=ON` and force-disables unity mode
+ for libcurl and the curl tool.
- `CURL_CLANG_TIDYFLAGS`: Custom options to pass to `clang-tidy`. Default: (empty)
- `CURL_CODE_COVERAGE`: Enable code coverage build options. Default: `OFF`
- `CURL_COMPLETION_FISH`: Install fish completions. Default: `OFF`
lib/CMakeLists.txt+12 -2
@@ -125,6 +125,9 @@ if(SHARE_LIB_OBJECT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
set_target_properties(${LIB_OBJECT} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
+ if(CURL_CLANG_TIDY)
+ set_target_properties(${LIB_OBJECT} PROPERTIES UNITY_BUILD OFF)
+ endif()
if(CURL_CODE_COVERAGE)
set_property(TARGET ${LIB_OBJECT} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS})
set_property(TARGET ${LIB_OBJECT} APPEND PROPERTY COMPILE_OPTIONS ${CURL_COVERAGE_CFLAGS})
@@ -167,8 +170,12 @@ if(BUILD_STATIC_LIBS)
set_target_properties(${LIB_STATIC} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
- if(CURL_CLANG_TIDY AND BUILD_SHARED_LIBS) # disable clang-tidy for static, and limit to the shared library, if both enabled
- set_target_properties(${LIB_STATIC} PROPERTIES C_CLANG_TIDY "")
+ if(CURL_CLANG_TIDY)
+ if(BUILD_SHARED_LIBS) # disable clang-tidy for static, and limit to the shared library, if both enabled
+ set_target_properties(${LIB_STATIC} PROPERTIES C_CLANG_TIDY "")
+ else()
+ set_target_properties(${LIB_STATIC} PROPERTIES UNITY_BUILD OFF)
+ endif()
endif()
if(CURL_CODE_COVERAGE)
set_property(TARGET ${LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS})
@@ -232,6 +239,9 @@ if(BUILD_SHARED_LIBS)
set_target_properties(${LIB_SHARED} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
+ if(CURL_CLANG_TIDY)
+ set_target_properties(${LIB_SHARED} PROPERTIES UNITY_BUILD OFF)
+ endif()
if(CURL_CODE_COVERAGE)
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_COVERAGE_MACROS})
set_property(TARGET ${LIB_SHARED} APPEND PROPERTY COMPILE_OPTIONS ${CURL_COVERAGE_CFLAGS})
src/CMakeLists.txt+3 -0
@@ -121,6 +121,9 @@ set_target_properties(curltool PROPERTIES C_CLANG_TIDY "")
if(CURL_HAS_LTO)
set_target_properties(${EXE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
+if(CURL_CLANG_TIDY)
+ set_target_properties(${EXE_NAME} PROPERTIES UNITY_BUILD OFF)
+endif()
if(ENABLE_UNICODE AND MINGW)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)