[CMake] Fwd: setting environment variable through cmake

Philip Lowman philip at yhbt.com
Mon Mar 9 17:26:49 EDT 2009


On Fri, Mar 6, 2009 at 9:35 AM, ankit jain <ankitguddu at gmail.com> wrote:

>
>
> 2009/2/17 Philip Lowman <philip at yhbt.com>
>
>>   On Mon, Feb 16, 2009 at 11:03 PM, ankit jain <ankitguddu at gmail.com>wrote:
>>
>>>   Iam using cmake 2.6
>>>
>>
>> This should work on the latest CMake 2.6.3 RC, provided you use "make
>> test".
>>
>> set_tests_properties(foo PROPERTIES ENVIRONMENT foo=bar)
>>
>>       I have run this but not able to set the environment variable.
>
>          I am using cmake-2.6.3-RC-14-Linux-i386.
>      Actually i have a test t1. i want to set and unset LD_LIBRARY_PATH
> acc. while adding  test t1 so that on running ctest it will use that value
> of LD_LIBRARY_PATH rather than using the older set value.
>
> This iam not able to achieve that.
>
> Guide where iam wrong and what need to be done.
>

I was mistaken about the feature existing in CMake 2.6.3.  Bill corrected me
later in the thread.  You will need to use CMake CVS to take advantage of
the ENVIRONMENT test property.  It is quite easy to build CMake CVS, just
like any other CMake project.  I hope it's acceptable for you.  The only
workaround I can think of is to set LD_LIBRARY_PATH manually before your
special test.  If it were called my_special_test you might run the following
commands, for example:

ctest --exclude-regex my_special_test
export LD_LIBRARY_PATH=/my/new/path
ctest --tests-regex my_special_test

Also, I assume you're familiar with how CMake uses RPATH so you don't
usually need to set LD_LIBRARY_PATH in your build tree...?


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090309/0f0ab0c3/attachment-0001.htm>


More information about the CMake mailing list