[CMake] add_test() and DEBUG_POSTFIX

Martin Baute solar at rootdirectory.de
Mon Mar 25 09:15:53 EDT 2013


I did not get any feedback on this, so please excuse me asking again:

Is it by design that adding a DEBUG_POSTFIX to executables makes CMake
miss those very same executables when running "make test"?

It is a bit awkward having to chose between either:

A) having no postfix with executables, i.e. debug executables 
overwriting
release executables on installation

or

B) not having "make test" work properly when building anything else but
the default / release build type.

Regards,
-- 
Martin Baute
solar at rootdirectory.de


Am 20.03.2013 12:51, schrieb Martin Baute:
> In my CMakeLists.txt, I defined tests to be run when I call "make 
> test":
>
>     add_executable( test_tu test/test_tu.cpp )
>     set( ALL_TARGETS ${ALL_TARGETS} test_tu )
>     add_test( test_tu test_tu )
>
> I also configured to have a postfix "-debug" when building in that 
> config,
> so I could install release and debug versions side-by-side:
>
>     set_property( TARGET ${ALL_TARGETS} PROPERTY DEBUG_POSTFIX 
> "-debug" )
>
> However, when I build with CMAKE_BUILD_TYPE=Debug and call "make 
> test",
> the Makefile will try to call "test_tu" - not "test_tu-debug". 
> Apparently,
> the DEBUG_POSTFIX property is not considered by add_test().
>
> Is this by design, a bug, or a faulty config on my part?
>
> Regards,


More information about the CMake mailing list