diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3d6334b2cf..08a3e5c474 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,6 +67,11 @@ if(BUILD_STATIC_CURL) set(CURLX_CFILES ${CURLTOOL_LIBCURL_CFILES}) endif() +# Compile this source separately to avoid having `stderr` overridden in this +# file. Necessary for successfully initializing stderr in unity builds. +# (Not necessary for the libcurltool target.) +set_source_files_properties(tool_stderr.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) + add_executable( ${EXE_NAME} ${CURL_CFILES} ${CURLX_CFILES} ${CURL_HFILES}