[CMake] enable_testing() disables add_executable(test ...)

Eric Noulard eric.noulard at gmail.com
Sun Mar 8 16:23:15 EDT 2009


2009/3/8 Bill Hoffman <bill.hoffman at kitware.com>:
> Silvio Frischknecht wrote:
>>
>> If I enable_testing() executables or libraries called test don't build
>> anymore.
>>
>> here's a simple example:
>>
>> CMakeLists.txt:
>>
>> cmake_minimum_required(VERSION 2.6)
>> project(FooBar)
>> enable_testing()
>> add_executable(test test.c)
>> add_test(baz test)
>>
>> If this is not going to be changed please at least write it into the doc.
>> I mean it's not so far fetched to call your test exectable test.
>
> This is because we create a target called "test" that runs the tests....
>
> Please create a bug for this, it should at least warn about the issue...

And be warned that calling your executable "test" is usually a bad idea
because on unix you usually have a test(1) command, such
that you may not rely on search path to call your "test" command
unless you know yours will be found before /usr/bin/test .

That's said I agree CMake should warn you.

-- 
Erk


More information about the CMake mailing list