Marcel Loose wrote: > Hi, > > On Fri, 2012-02-17 at 08:51 +0100, Alexander Neundorf wrote: > > -- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< -- > >> > So the suggestion is >> > >> > a) Change CMAKE_SKIP_RPATH to only skip RPATH when installing, but > not when >> > building (I don't know if that's easy in CMake), or alternatively > provide >> > another CMAKE_ variable to do that. >> > >> > b) Implement something like: >> > set_property(TARGET foo APPEND PROPERTY TEST_ENVIRONMENT "foo=bar") >> > >> > >> > Possibly both a) and b). >> > >> > Thoughts/comments? >> >> b) is IMO definitely a missing feature. >> (but even with that, we (KDE) would have to keep a macro, because we > can't >> expect that all developers know how to set this properly for all > platforms. >> ...or, since it is a target property, this could be also intialized > from a >> CMAKE_TEST_ENVIRONMENT cmake variable). > > Maybe I'm missing the point but there is a property ENVIRONMENT for > tests: > http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_test:ENVIRONMENT
That indeed looks like what was discussed in one of the links I posted. However I tried it out and it didn't work for me (with CMAKE_SKIP_RPATH): stephen@hal:~/dev/build/qt/grantlee$ LD_LIBRARY_PATH=$PWD/templates/lib ./templates/tests/testsafestring_exec ********* Start testing of TestSafeString ********* Config: Using QTest library 4.7.4, Qt 4.7.4 PASS : TestSafeString::initTestCase() PASS : TestSafeString::testCombining() PASS : TestSafeString::testAppending() PASS : TestSafeString::testChopping() PASS : TestSafeString::testReplacing() PASS : TestSafeString::cleanupTestCase() Totals: 6 passed, 0 failed, 0 skipped ********* Finished testing of TestSafeString ********* Qt( ) KDE ( ) stephen@hal:~/dev/build/qt/grantlee$ ctest -V . UpdateCTestConfiguration from :/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl Parse Config file:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl UpdateCTestConfiguration from :/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl Parse Config file:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl Test project /home/stephen/dev/build/qt/grantlee Constructing a list of tests Done constructing a list of tests Checking test dependency graph... Checking test dependency graph end test 1 Start 1: testsafestring 1: Test command: /home/stephen/dev/build/qt/grantlee/templates/tests/testsafestring_exec 1: Test timeout computed to be: 1500 1: /home/stephen/dev/build/qt/grantlee/templates/tests/testsafestring_exec: error while loading shared libraries: libgrantlee_core.so.0: cannot open shared object file: No such file or directory 1/11 Test #1: testsafestring ...................***Failed 0.00 sec Qt( ) KDE ( ) stephen@hal:~/dev/src/grantlee{master}$ git diff diff --git a/templates/tests/CMakeLists.txt b/templates/tests/CMakeLists.txt index d2e37d2..ad471c7 100644 --- a/templates/tests/CMakeLists.txt +++ b/templates/tests/CMakeLists.txt @@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS) ${_testresource_rcc_src} ) add_test(${_testname} ${_testname}_exec ) + set_property(TEST ${testname} PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib") Do you see anything wrong there? Thanks, Steve. -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers