[CMake] Determine active config in a ctest-invoked script?
David Wolfe
dwolfe at gforcetech.com
Thu Dec 27 13:37:46 EST 2007
I have a python script I'm using with ADD_TEST as follows:
ADD_TEST( cone ${PYTHON_EXECUTABLE} convertAndCompare.py cone.osg )
My problem is: this python script invokes an EXE built by CMake, and I
haven't figured out a way to tell it whether it should invoke the
Release or Debug version of the executable.
My first stab at this was:
GET_TARGET_PROPERTY(GRAB_SCREEN_EXE grabScreen LOCATION)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/convertAndCompare.py.in
${CMAKE_CURRENT_BINARY_DIR}/convertAndCompare.py
@ONLY)
In convertAndCompare.py.in, I have:
grabScreenPath = '@GRAB_SCREEN_EXE@'.replace('$(OutDir)', 'Release')
I did this after discovering that the above GET_TARGET_PROPERTY call is
setting GRAB_SCREEN_EXE to something like:
C:\projects\Build\ofw\bin\$(OutDir)\grabScreen.exe
Hard-coding it to always replace '$(OutDir)' with 'Release' sorta works,
but I'd like it to run the Debug version if I build 'RUN_TESTS' from
Visual Studio with the 'Debug' configuration active.
Is there some way I can get ctest to communicate to my script what
configuration it's running? That way, I could conditionally replace
'$(OutDir)' with the right thing instead of hard-coding it to
'Release'.
Any help much appreciated! :-)
- Dave W.
More information about the CMake
mailing list