[CMake] How can I mimic a second CMAKE_RUNTIME_OUTPUT_DIRECTORY for the tests?

Patrick Spendrin ps_ml at gmx.de
Tue Jul 10 05:01:36 EDT 2012


Am 10.07.2012 03:35, schrieb Ateljevich, Eli:
> My source and tests are stored separately in a quasi-parallel arrangement:
> 
> /proj
> 
>   /build
> 
>     /bin       # CMAKE_RUNTIME_OUTPUT_DIRECTORY
> 
>    /mod1      # Build directory
> 
>    /mod2
> 
>     /test
> 
>         /mod1
> 
>         /mod2
> 
>     /src          # source
> 
>          /mod1
> 
>          /mod2
> 
>     /test         # source for tests
> 
>          /mod1
> 
>          /mod2
> 
>  
> 
> When I build the tests, I would like the tests to either go in
> /proj/build/testbin or stay where the object files are, same as they
> would if CMAKE_RUNTIME_OUTPUT_DIRECTORY had never been set. Is there any
> simple way to do this for the /test part of the directory tree, or do I
> have to set the RUNTIME_OUTOUT_DIRECTORY property all over the place?
> 
>  
> 
> There are enough test and non-test executables that this is painful
> either way.

Using a special add_my_test macro and automating setting this property
is probably the easiest way.

regards,
Patrick


More information about the CMake mailing list