Hi,

I've attached my CxxTest module, maybe you find them useful. It is
creating the runned files under CMAKE_BUILD_DIR, so there is no
CMAKE_SOURCE_DIR pollution (of course, this is useful only if you do
out of source builds, but I guess all cmake users do that, right?).

The module is based on what I've found on the CMake wiki page and
assumes the CxxTest is located under
${CMAKE_SOURCE_DIR}/thirdparty/cxxtest.

Cheers,

Ionutz

On Sun, Nov 23, 2008 at 3:31 AM, Tron Thomas <[EMAIL PROTECTED]> wrote:
> I am trying to configure a project with CMake that uses the CxxTest testing
> framework.  CxxTest will generate source files that may be added into
> application that test the software.  A macro has been written that will
> create custom commands for generated the needed source file.
>
> However, when I used CMake to create a Xcode project on Mac OS X, the clean
> process will not delete the files generated by CxxTest.  This is true even
> when using the SET_DIRECTORY_PROPERTIES command with the
> ADDITIONAL_MAKE_CLEAN_FILES.  What can be done so the Xcode will delete
> these files when necessary?
>
> _______________________________________________
> CMake mailing list
> CMake@cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
#############################################################
# cxxtest
#
# ADD_CXXXTEST(RUNNERNAME TESTNAME [OTHER SOURCES]):
# 	RUNNERNAME: name of the runner executable
#	TESTNAME: name of the test source
#############################################################
option( ENABLE_CXXTEST "Check for CxxTest and compile sandbox apps that use CxxTest" ON )
if( ENABLE_CXXTEST )
	find_package(PythonInterp REQUIRED)

	set(CXXTEST_DIR "${CMAKE_SOURCE_DIR}/thirdparty/cxxtest")
	set(CXXTEST_INCLUDE_DIRS "${CXXTEST_DIR}")
	set(CXXTESTGEN "${CXXTEST_DIR}/cxxtestgen.py")

	macro(ADD_CXXTEST RUNNERNAME TESTNAME ARGN)
		message(STATUS "  adding cxxtest: ${EXECUTABLE_OUTPUT_PATH}/${RUNNERNAME}")
		add_custom_command(
			OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/runner_${RUNNERNAME}.cpp
			COMMAND 
				${PYTHON_EXECUTABLE} ${CXXTESTGEN}
					--runner=ErrorPrinter
					-o ${CMAKE_CURRENT_BINARY_DIR}/runner_${RUNNERNAME}.cpp 
					${CMAKE_CURRENT_SOURCE_DIR}/${TESTNAME}
			DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${TESTNAME}
			)
		add_executable(${RUNNERNAME}
				${CMAKE_CURRENT_BINARY_DIR}/runner_${RUNNERNAME}.cpp
				${ARGN}
				)
		add_test(${RUNNERNAME} ${EXECUTABLE_OUTPUT_PATH}/${RUNNERNAME})
	endmacro(ADD_CXXTEST)

	message(STATUS "cxxtest enabled")
	
else( ENABLE_CXXTEST )
	message(STATUS "cxxunit disabled")
endif( ENABLE_CXXTEST )
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to