22 May
2024
22 May
'24
8:18 a.m.
Дмитрий Архипов wrote:
Some people may think that surely, there should be a less backwards way to run compile-fail tests in CMake. There is! Peter Dimov has implemented it as part of his CMake support: https://github.com/boostorg/cmake/blob/develop/include/BoostTest.cmake#L187-.... The trick is to automate the "run and fail" part. The function launches _another_ instance of CMake that tries to build the target and fails.
In fairness Robert's function does the same thing. The problem with this approach is that it doesn't work in parallel (ctest -j). Hence the RUN_SERIAL TRUE in https://github.com/boostorg/cmake/blob/6dcde32c82f7c1fef67b6e61db862f73e4809...