[cmake-developers] Modifying RPATH feature to run tests uninstalled
Stephen Kelly
steveire at gmail.com
Fri Feb 17 06:50:25 EST 2012
Marcel Loose wrote:
> Hi Stephen,
>
> On Fri, 2012-02-17 at 12:06 +0100, Stephen Kelly wrote:
>
> -- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< --
>
>> 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?
>
> You should use ${_testname} in the set_property() command. Don't you get
> an error message from CMake? Or do you happen to have a variable
> "testname" as well.
>
D'Oh! You're right. I typo'd there. It works with my system Qt if I fix the
typo.
However, it doesn't solve the whole problem for me. Mostly I use a Qt in a
non-standard prefix and I set LD_LIBRARY_PATH to find it (I have many Qts
and a script to change my environment)
I tried changing it to
set_property(TEST ${_testname} PROPERTY ENVIRONMENT
"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/templates/lib")
ie appending to the LD_LIBRARY_PATH, and it didn't find the correct Qt. It
found my system Qt (4.7) instead of my environment Qt (4.8) which has new
methods and so I get symbol lookup errors.
Is that something relevant for others that we should care about? Or is my
setup unusual and irrelevant? Is it a bug that the LD_LIBRARY_PATH from my
environment is not carried over?
Thanks,
Steve.
More information about the cmake-developers
mailing list