secp256k1
secp256k1 copied to clipboard
cmake: Rework `tests` target for Coverage configuartion and multi-config generators
The "experimental" status of the CMake-based build system can be reconsidered once it is adopted in the Bitcoin Core project. Fixing all known bugs is essential before this reconsideration.
Currently, I'm aware of a single issue: when using a multi-config generator, such as "Ninja Multi-Config", the build system still builds the tests
binary for the "Coverage" configuration, which is meaningless:
$ cmake -B build -G "Ninja Multi-Config"
$ cmake --build build --config Coverage
[18/19] Building C object src/CMakeFiles/tests.dir/Coverage/tests.c.o
/home/hebasto/git/secp256k1/secp256k1/src/tests.c:18:13: note: ‘#pragma message: Defining VERIFY for tests being built for coverage analysis support is meaningless.’
18 | #pragma message("Defining VERIFY for tests being built for coverage analysis support is meaningless.")
| ^~~~~~~
[19/19] Linking C executable src/Coverage/tests
This PR fixes the issue.
It is an alternative to https://github.com/bitcoin-core/secp256k1/pull/1251 and https://github.com/bitcoin-core/secp256k1/pull/1291.
The last commit aaditionally addresses that comment.