[CMake] [CTest] DLLs, scripts, and build types

Gregory Sharp gregsharp.geo at yahoo.com
Sun Mar 1 20:44:59 EST 2009



> From: Werner Smekal <smekal at iap.tuwien.ac.at>
> Subject: Re: [CMake] [CTest] DLLs, scripts, and build types
> To: gregsharp.geo at yahoo.com
> Cc: cmake at cmake.org
> Date: Sunday, March 1, 2009, 2:11 PM
> Hello too,
> 
> We use something like
> 
> if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
>  SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
> endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
> 
> so that all DLLs end up in one directory (since we build
> many of them, otherwise they would be scattered around the
> whole build directory). As you write in (3) I start cmd.exe
> and run a script which sets the PATH. Then I run ctest or
> executables which find the dll without problems. There is
> also a variable like
> 
> EXECUTABLE_OUTPUT_PATH
> 
> so that all executables are built into this directory. This
> may help for (4).

Thank you for the suggestion.  Setting EXECUTABLE_OUTPUT_PATH
would solve the problem for finding the executables.  

Is there a way to set the ITK dll path?  It is something like 
${ITK_LIBRARY_DIRS}/Release or ${ITK_LIBRARY_DIRS}/Debug.
CTest is run with something like "-C Release" or "-C Debug", 
Is there a way to substitute this in?  My CMake test looks like 
this (hard-coded version):

ADD_TEST (${TESTNAME} ${CMAKE_COMMAND} 
     -DITK_LIBRARY_PATH=${ITK_LIBRARY_DIRS}/Release
     -DPLM_TEST_COMMAND=${PLM_TEST_COMMAND}
     -P ${CMAKE_CURRENT_SOURCE_DIR}/RUN_CTEST.cmake
     )

-Greg

> Gregory Sharp wrote:
> > Hello,  I ran into a problem with getting the CTest to
> run when linking with a DLL.
> > 
> > 1) My program links with ITK, and I build this as a
> DLL on windows.
> > 
> > 2) During testing, my program needs to find the ITK
> dll.  I do not
> > wish to add to the global path.
> > 
> > 3) My understanding is that the workaround for (2) is
> to create a script which sets the path.  So I make a CMake
> script.  CTest launches
> > the CMake script, which sets the path, and runs my
> executable.
> > 
> > 4) However, my CMake script needs to know the name of
> the executable.
> > The executable can be in Release, or Debug, or
> whatever.  Now I'm stuck, because I can't figure out
> how CMake can find the right directory.  There is a similar
> issue for finding the ITK dll, which can be in release or
> debug subdirectory.
> > 
> > I appreciate any advice.  Maybe there is a simple way?
> > 
> > Thank you,
> >   
> 
> 
> -- Dr. Werner Smekal
> Institut fuer Allgemeine Physik
> Technische Universitaet Wien
> Wiedner Hauptstr 8-10
> A-1040 Wien
> Austria
> DVR-Nr: 0005886
> 
> email: smekal at iap.tuwien.ac.at
> web:   http://www.iap.tuwien.ac.at/~smekal
> phone: +43-(0)1-58801-13463 (office)
>       +43-(0)1-58801-13469 (laboratory)
> fax:   +43-(0)1-58801-13499


      


More information about the CMake mailing list