[cmake-developers] Adding compile and build type tests to CMake/CTest

Edward Diener eldlistmailingz at tropicsoft.com
Thu Sep 14 23:33:22 EDT 2017


I posted these messages to the users list but Bill Hoffman suggested I 
post them to the developers list:

Boost Build has tests for running an application successfully or not, 
for compiling one or more source files successfully or not, and for 
building one or more source files into an exe or not. These tests in 
Boost Build are the run/run-fail, compile/compile-fail, and 
link/link-fail rules.

CMake/CTest has the exact equivalent to the run/run-fail rule in its 
add_test framework, but there is not add_test equivalent to the other 
two sets of rules. It sure would be nice, when Boost transitions to 
using CMake/CTest instead of Boost Build, if CMake/CTest had the 
equivalent of the other two sets of types of test in its add_test framework.

To put it succinctly CMake should adding compile-time testing so that 
when some compilation succeeds the test is successful and if the 
compilation fails the test is not successful, with the proviso that you 
can reverse the result as a compile should fail type of test. Similarly 
a build type testing, without having to run anything should be added 
along the same lines.

In modern C++ it is perfectly feasible, especially with template 
programming, to do compile time testing, invoking a compile-time static 
assert as a compile-time failure. Boost has had this for years and 
modern C++ has it as part of the latest version of the C++ standard. 
CMake needs to update itself to the reality that pure compile-time 
testing is a reality for modern C++ and should update itself 
accordingly. Only having run-time testing is an artifact of the past. 
Hopefully CMake developers will get the message and make the necessary 
update to CMake/CTest.

Is there any consensus that these other two types of tests might be 
valuable for CMake/CTest, or any way to make this happen ?



More information about the cmake-developers mailing list