[CMake] add_test( WORKING_DIRECTORY ) does not actua

Massaro Alessio Alessio.Massaro at mediobanca.co.uk
Mon Feb 6 12:20:17 EST 2012


Hi there

The following message in cmTest.cxx doesn't seem to be accurate for Visual Studio 9.

 200   cm->DefineProperty
 201     ("WORKING_DIRECTORY", cmProperty::TEST,
 202      "The directory from which the test executable will be called.",
 203      "If this is not set it is called from the directory the test executable "
 204      "is located in.");

The test process is actually run from ${PROJECT_BINARY_DIR}

I create the test project with the following:

	SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
		"${PROJECT_BINARY_DIR}/../targets"
		CACHE PATH
		"Single Directory for all Executables.")
	add_executable(${mod_name} ${src_files} ${inc_files})
	add_test(NAME ${mod_name} COMMAND ${mod_name} --log_file=${mod_name}.xml)

The above --log_file parameter tells the exe (a Boost Test exe) to create ${mod_name}.xml in the current directory.

I would be happy to use add_test(WORKING_DIRECTORY) but I can't figure out how to construct the path.

Has anyone managed to piece these two together in a simple way?

Thanks in advance!


More information about the CMake mailing list