[CMake] Target to build only unit tests?

David Cole david.cole at kitware.com
Wed Dec 21 11:54:19 EST 2011


On Wed, Dec 21, 2011 at 11:52 AM, David Cole <david.cole at kitware.com> wrote:
> On Wed, Dec 21, 2011 at 11:29 AM, Robert Dailey <rcdailey at gmail.com> wrote:
>> Is there a target generated by CMake to build ONLY unit tests? I'm using
>> Visual Studio 2008.
>>
>
> No, there is not.
>
>
>> If not, is there a way I can make one?
>
> Yes, of course. You can do anything you want with a combination of
> add_custom_command and add_custom_target.
>

The easiest thing is simply:

  add_custom_target(unit_tests
    DEPENDS unit_test_target_1 unit_test_target_2)

Then when you build the do-nothing "unit_tests" target, all of its
DEPENDS targets will be built first.


>
> David
>
>
>>
>> ---------
>> Robert Dailey
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list