> -----Original Message----- > From: Michael Wild [mailto:[email protected]] > Sent: Friday, June 11, 2010 10:06 AM > To: Hickel, Kelly > Cc: [email protected] > Subject: Re: [CMake] Best way to write add_test that depends on shared > objects > > > On 11. Jun, 2010, at 16:58 , Hickel, Kelly wrote: > > > I'm using CMake 2.8.1 and I want to write a simple test for one of > the executable targets, but it failes because the shared libraries > aren't in the directory or on the path. > > > > So, with something like the below, where bar and baz are shared > objects built by CMakeLists.txt files in other directories (building > foo works just fine, BTW), how can I modify the test so that baz.dll > and bar.dll are either in the same directory as foo.exe, or on the path > (that was windows specific, but I want it to work everywhere): > > > > add_executable( foo foo.c ) > > target_link_libraries( foo bar baz ) > > add_test( NAME foo-simple COMMAND foo "--simple" ) > > > > I was going to try setting that PATH environment var for the test, > but haven't been able to come up with a get_target_property line that > gets the correct directory where each dll file will be. > > > > I suppose I could invoke cmake to copy the binaries, but that doesn't > seem ideal (and I still have to figure out where to copy from), I'd > like not to leave extra dll copies lying around.... > > > > Thanks, > > Kelly Hickel > > > > BMC Software > > > Either set CMAKE_RUNTIME_OUTPUT_DIRECTORY or the target property > RUNTIME_OUTPUT_DIRECTORY to e.g. ${CMAKE_BINARY_DIR}/bin. This will > cause all the files that are required during runtime to be created in > the specified directory. For other kinds of files, there are similarly- > named variables and properties. > > HTH > > Michael
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 _______________________________________________ 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
