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

Brad King brad.king at kitware.com
Mon Sep 18 08:16:22 EDT 2017


On 09/15/2017 09:22 AM, Edward Diener wrote:
> A gui environment like Visual Studio does provide 
> functionality to just compile one or more source files, and it also 
> provides functionality to just build an executable from one or more 
> source files without actually running that executable.

Yes.  We just need it to be generated separately from the main build
system so that "Build Solution" or our ALL_BUILD.vcxproj don't try
to build the tests.  Some work will be needed on the CMake side to
do this in a built-in way.

Do you happen to know if/how it is possible to take a .vcxproj with
multiple source files (ClCompile entries) and use MSBuild to compile
just one of the sources from the command-line?  The IDE must do it
somehow with the right-click "Compile" option.  Similarly in Xcode?

> I would just like to see a built-in 
> equivalent to testing under CMake which involves only a successful 
> compilation or not, equivalent to Boost Build's 'compile/compile-fail' 
> rule and a built-in equivalent to testing which involves only a 
> successful build or not of a non-build target equivalent to Boost 
> Build's 'link/link-fail' rule. I think both of the latter are valid 
> testing methodologies which do not involve an actual run-time test.

Yes, having a built-in solution would be nice.  Currently these can
only be achieved indirectly by writing tests that configure projects
that are not configured by CMake as part of the main project.

BTW, where is the corresponding discussion of this problem on the
Boost side taking place?

Thanks,
-Brad


More information about the cmake-developers mailing list