[CMake] Best way to write add_test that depends on shared objects

Ryan Pavlik rpavlik at iastate.edu
Fri Jun 11 12:28:51 EDT 2010


> Thanks Michael, but for various reasons, I really don't want all the targets ending up in the same bin directory.  If that's the only way to solve it, then I guess I'll do commands to copy the binaries for a test to a test only directory.
>
> I've tried looking at the target property RUNTIME_OUTPUT_DIRECTORY for the bar and baz targets, but it always somes back as -NOTFOUND, even in the CMakeLists.txts for those targets.  Presumably because I didn't set it in the first place, it just has no value?
>
> -Kelly
>
>    

The alternative is to generate scripts that set the path: since you're 
apparently on Windows, the standard RPATH support on Linux won't help 
you.  You'll want to configure_file scripts that effectively do this:

set PATH=@PATH_TO_SHARED_LIBRARY@;%PATH%
@YOUREXE@

In fact, if you wanted it to be super general, you could do this:
set PATH=@PATH_TO_SHARED_LIBRARY@;%PATH%
%*

in "launcher.cmd" for example, then call
launcher.cmd yourexe

Hope this helps!

Ryan

-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com



More information about the CMake mailing list