[CMake] ADD_TEST command path

Sylvain Prat sylvain.prat at laposte.net
Tue May 10 10:11:58 EDT 2005


1. Yes, my executable is next to its dlls, but i load some of the dlls during the execution (plugins) and these dlls are not found in the current directory. My problem is solved anyway, I just wanted to insist on the fact it should be documented somewhere ;)

2. Ok for the visual "feature" i was not aware of. Is there's a workaround for this ?

Many thanks,
Sylvain

---------- Debut du message initial -----------

De     : "Brad King" brad.king at kitware.com
A      : "Sylvain Prat" sylvain.prat at laposte.net
Copies : "cmake" cmake at cmake.org
Date   : Tue, 10 May 2005 09:07:56 -0400
Objet  : Re: [CMake] ADD_TEST command path

>Sylvain Prat wrote:
>> I'm trying to setup a (working hehe) test program with an ADD_TEST command but I do not have yet succeed to have 0 errors with the run_test target. The problem is related to the dynamically linked dll used by the program, for an out-source build with Visual C++. Here are my interrogations and suggestions :
>> 
>> 1. Why is the test program launched from the build_dir instead of the executable_dir ?
>
>The working directory is the build tree directory corresponding to the 
>source tree directory where the ADD_TEST command was invoked.
>
> > This behavior, which IMHO is not really intuitive, causes me a 
>headache since I wanted to load some dynamically linked librairies 
>(parts of the whole project) from the executable/library directory. I 
>solved the problem right now (using argv[0]), but I think it should be 
>documented at least.
>
>On Windows the directory containing the executable should be searched 
>for the needed DLLs automatically.  The working directory is a 
>last-resort place to look.  Is your executable not next to its DLLs?
>
>> 2. Does CTest use the PATH environment variable when launching the executable ? It seems not since my program is not able to load some dlls (not in the executable dir but in the system path) when run from the run_test target, but work when run from the command line ! What's the problem here ?
>
>The PATH environment variable is used, but the behavior you are seeing 
>is actually due to a Visual Studio "feature".  When VS launches 
>processes to build its targets it does so in its own environment.  This 
>environment contains a PATH that includes the VS compiler directories 
>and such.  It also includes the system PATH that was in place WHEN VS 
>WAS INSTALLED.  For some reason it does not update this PATH each time 
>it runs.  This is why it works when you run ctest from the command line 
>but not from the RUN_TESTS target.
>
>-Brad
>

Sylvain PRAT 
Tel : 06 78 71 51 21 

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)





More information about the CMake mailing list