tags:

views:

45

answers:

1

The tests of a project that I try to build fail to build (missing libraries). The tests themselves are not important, but prevents me from building and installing the essential files. So I want to do this as a quick-fix.

How do I do to turn of the build of the tests in a cmake project? Should I edit the CMakeLists.txt file in the root or in the subdirectory tests? How should I edit it?

There are one issuing of the command ENABLE_TESTING(). I tried to comment that one out, but it didn't help. Also tried to rename the subdirectory tests. Did not help either. This was only true for a special case where "implicit" tests were being built.

A: 

Ok, it worked by editing the CMakeLists.txt to turn off all the flags BUILD_TESTING, BUILD_TESTING_STATIC and BUILD_TESTING_SHARED.

This can most easily be accomplished with this sed command:

sed --in-place=.BACKUP 's/\(BUILD_TESTING[A-Z_]*\) ON/\1 OFF/' CMakeLists.txt

(In one cases there were "implicit" tests that had to be taken care of in a more elaborate way.)

dala