[CMake] add_test : expand environment variable at running time

Olivier Pierard olivier.pierard at cenaero.be
Tue Sep 14 11:58:34 EDT 2010


Thanks for your hint Tyler. 

Correct answer seems to be '\$ENV{TMPDIR}' in add_test in CMakeLists.txt
so that '$ENV{TMPDIR}' is written in the CTestTestFile.cmake. 

So, command written there is not executed directly in the shell but
re-interpreted first by CTest...

I hope this is the end of a long search...

Olivier
> On Mon, Sep 13, 2010 at 06:01:52PM +0200, Olivier Pierard wrote:
>   
>> - add_test( mpirun -machinefile $TMPDIR myexec ) => will never expand
>> TMPDIR  - I don't understand why because in CTestTestfile.cmake, I have
>> add_test( test_name "mpirun" "-machinefile" "$TMPDIR" "myexec"); if I
>> submit this as a bash command, environment variable is well expanded; 
>> Does ctest prevent expanding variables at running time ?
>>
>> - add_test( mpirun -machinefile ${TMPDIR} myexec ) => expands at
>> configuration time with cmake (empty because not defined in cmake - logical)
>>
>> - add_test( mpirun -machinefile $ENV{TMPDIR} myexec ) => expands at
>> configuration time with cmake but TMPDIR is not yet defined on the
>> master node (logical)
>>     
>
> How about add_test (... \$TMPDIR ... )
> ?
>
> tyler
>
>
>   


-- 
Dr Olivier Pierard

Research Scientist
CENAERO, Virtual Manufacturing Group

Bâtiment EOLE, 1er étage
Rue des Frères Wright, 29
B-6041 Gosselies
BELGIUM 

Tel: +32.(0)71.919374
Fax: +32.(0)71.919331

http://www.cenaero.be/

+-+-+- Disclaimer +-+-+-

http://www.cenaero.be/disclaimer



More information about the CMake mailing list