[CMake] builds using mingw with sources on different drive

J Decker d3ck0r at gmail.com
Tue Mar 29 02:28:29 EDT 2011


I was trying to build a project on a seperate drive from the sources.
This works very well for lots of my projects, and so a cmake based
project should work as well.  There is a limitation in cmake using
'command' with working directory....

BASE_BUILD_COMMAND is make_gamedata_arch.bat

add_custom_target(gamedata ALL
	COMMAND ${BASE_BUILD_COMMAND}
		${BASE_BUILD_DIR}
		${SEVENZIP_BIN}
	WORKING_DIRECTORY
		"${CMAKE_CURRENT_SOURCE_DIR}/base"
	)

This ends up building a command line that looks like

(On c:)

cd L:\games\spring\cont\base & make_gamedata_arch.bat .......

since the current drive is the C drive, this doesn't change the drive,
it only changes the drive on L:, so you'd have to either
cd L:\games\spring\cont\base & L: & make_gamedata_arch.bat .......
or
cd /D L:\games\spring\cont\base & make_gamedata_arch.bat .......


More information about the CMake mailing list