Probably due to a cmake upgrade.
CI fails: CMake Error (non-target-directive) at src/secp256k1/cmake/TryAppendCFlags.cmake:22 (add_compile_options): Use of non-target directives is not recommended. Consider target_compile_options instead. #36913
issue maflcko opened this issue on November 19, 2026-
maflcko commented at 9:51 AM on November 19, 2026: member
- maflcko added the label CI failed on Nov 19, 2026
-
maflcko commented at 9:57 AM on November 19, 2026: member
-
maflcko commented at 9:59 AM on November 19, 2026: member
Not sure why this wasn't caught by one of the nightly CIs. I guess there simply doesn't exist one that runs agains cmake-nightly?
-
hebasto commented at 10:02 AM on November 19, 2026: member
Not sure why this wasn't caught by one of the nightly CIs. I guess there simply doesn't exist one that runs agains cmake-nightly?
It was. That triggered the PRs here and in the secp256k1 repo.
(not cmake-nightly though, but Homebrew)
-
maflcko commented at 10:04 AM on November 19, 2026: member
(not cmake-nightly though, but Homebrew)
Yeah, I think it would be better to use nightly. If Homebrew is slower to update than GHA, this can lead to missing those issues.
-
fanquake commented at 10:37 AM on November 19, 2026: member
The same problem in our code was fixed in #36889.
If Homebrew is slower to update than GHA,
Looks like
brewwas updated the same day CMake 4.5.0 was released: https://github.com/Homebrew/homebrew-core/commit/c7dcc34209f9547922035a2f40f9e94e94f2ff64. -
hebasto commented at 10:41 AM on November 19, 2026: member
(not cmake-nightly though, but Homebrew)
Yeah, I think it would be better to use nightly. If Homebrew is slower to update than GHA, this can lead to missing those issues.
Sure. Please have a look at https://github.com/hebasto/bitcoin-core-nightly/pull/477.
-
polespinasa commented at 10:48 AM on November 19, 2026: member
I think this is not only windows CI, it also afects macOS CI?
I see the same error line (
non-target-directive) in here https://github.com/bitcoin/bitcoin/actions/runs/44505398133/job/135495567289?pr=34400 - maflcko renamed this:
Windows CI fails: CMake Error (non-target-directive) at src/secp256k1/cmake/TryAppendCFlags.cmake:22 (add_compile_options): Use of non-target directives is not recommended. Consider target_compile_options instead.
CI fails: CMake Error (non-target-directive) at src/secp256k1/cmake/TryAppendCFlags.cmake:22 (add_compile_options): Use of non-target directives is not recommended. Consider target_compile_options instead.
on Nov 19, 2026 - maflcko added the label Windows on Nov 19, 2026
- maflcko added the label macOS on Nov 19, 2026
-
fanquake commented at 10:51 AM on November 19, 2026: member
Not sure why this wasn't caught by one of the nightly CIs
Somewhat related, but in future, it would be good to actually explain in these kinds of PRs, that they are fixing issues that will cause fairly imminent CI failures, and require backporting to all branches.
#36889 didn't mention this at all, and #36890 was opened without the CMake fix, and doesn't mention it. I'd imagine most reviewers might not realise the underlying issues, and their effects, if they just read something like "fixes CMake warnings".
-
maflcko commented at 10:59 AM on November 19, 2026: member
My understanding is that this doesn't need backport. It is just a harmless warning? However, it breaks the CI in the repo here.
Maybe we should re-visit this and exclude the errors there?
ci: Exclude cmake warnings-as-errors on "mutable" tasks Those tasks may update cmake over night, so new warnings can lead to errors and ci failures. It would be better to track those issues in a dedicated nightly CI. diff --git a/.github/ci-windows.py b/.github/ci-windows.py index ba48808..b12fa0f 100755 --- a/.github/ci-windows.py +++ b/.github/ci-windows.py @@ -31,3 +31,3 @@ GENERATE_OPTIONS = { "-DBUILD_UTIL_CHAINSTATE=ON", - "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", + "-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF", ], @@ -37,3 +37,3 @@ GENERATE_OPTIONS = { "-DBUILD_FOR_FUZZING=ON", - "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON", + "-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF", ], diff --git a/ci/test/00_setup_env_mac_native.sh b/ci/test/00_setup_env_mac_native.sh index d2e35b9..57971c4 100755 --- a/ci/test/00_setup_env_mac_native.sh +++ b/ci/test/00_setup_env_mac_native.sh @@ -17,2 +17,3 @@ printf -v BITCOIN_CONFIG "%q " \ --preset=dev-mode \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ -DWITH_USDT=OFF \ diff --git a/ci/test/00_setup_env_mac_native_fuzz.sh b/ci/test/00_setup_env_mac_native_fuzz.sh index b21edb4..789c448 100755 --- a/ci/test/00_setup_env_mac_native_fuzz.sh +++ b/ci/test/00_setup_env_mac_native_fuzz.sh @@ -11,2 +11,3 @@ printf -v BITCOIN_CONFIG "%q " \ -DBUILD_FOR_FUZZING=ON \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-stack_size -Wl,0x80000" \ -
fanquake commented at 11:05 AM on November 19, 2026: member
However, it breaks the CI in the repo here.
Yea, that's why it needs backport (absent other changes), along with the other CMake change already put into the backport PRs. Devs have also already reported this breaking their local builds, so changing the CI in the release branches also isn't a complete fix (absent telling devs to change their workflows).
https://gnusha.org/bitcoin-core-dev/2026-11-17.log:
10:01 < achow101> Updated cmake and started getting these errors in my builds: Use of non-target directives is not recommended. Consider target_compile_definitions instead.
-
maflcko commented at 11:12 AM on November 19, 2026: member
Hmm, I guess there is no correct answer here, only tradeoffs :(
-DCMAKE_COMPILE_WARNING_AS_ERROR=ONwill "alert" that backports are needed, but it may break CI in pull requests for unrelated reasons.-DCMAKE_COMPILE_WARNING_AS_ERROR=OFFwill not "alert" that backports are needed, but it will not cause unrelated failures.
-
hebasto commented at 11:44 AM on November 19, 2026: member
Maybe we should re-visit this and exclude the errors there?
For CMake warnings as errors, it's not
CMAKE_COMPILE_WARNING_AS_ERRORbut rather-Wno-error. - willcl-ark referenced this in commit 1cc1ee9601 on Nov 19, 2026
-
maflcko commented at 1:57 PM on November 19, 2026: member
https://github.com/hebasto/bitcoin-core-nightly/pull/477 was just merged, so hopefully this won't happen again in the future 🙏