[CMake] Running unit test executable

Torsten Martinsen tma at gatehouse.dk
Mon Oct 8 10:31:23 EDT 2007


I am trying to get CMake to run my CppUnit tests automatically after
building from within Visual Studio .NET 2003.

Looking at
http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_generate_an_executable.2C_t
hen_use_the_executable_to_generate_a_file.3F,
I thought this would do the trick (the example is simplified and would
not actually compile, but never mind that):

PROJECT(tcsv)

SET(CPP_SOURCE
   tcsvreader.cpp
   tcsvwriter.cpp
   tcsvreadermeta.cpp
)

ADD_EXECUTABLE(tcsv
   ${CPP_SOURCE})

GET_TARGET_PROPERTY(TEST_EXE tcsv LOCATION)

ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/phony.txt
   COMMAND ${TEST_EXE}
   DEPENDS tcsv)

Given this CMakeLists.txt, I would expect the generated .vcproj file to
have a Post-Build Event that runs tcvs.exe. No such event is generated,
however.

Any pointers?

-Torsten

This e-mail and any files sent with it contain information that may be privileged or confidential and is the property of the GateHouse Group. This information is intended solely for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use the message or any part thereof. If you have received this e-mail in error, please notify the sender immediately, and delete all copies of this message. In accordance with GateHouse Security Policy, e-mails sent or received may be monitored.


More information about the CMake mailing list