In Qt Creator, when I create a new Unit Test project it will not build successfully if the full path to the project contains a space.
I've tracked the bug down to the makefile produced by qmake. The makefile contains a line near the top like:
DEFINES = -DUNICODE -DWIN32 -DSRCDIR=\"C:/Users/Smith/Qt Projects/Unit_Tests/\" -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR=\"C:/Users/Smith/Qt Projects/Debug_Unit_Tests\"
The quotes in the values for SRCDIR
and QT_TESTCASE_BUILDDIR
are escaped with backslashes. If I delete the backslashes from Makefile.Debug
, then the project will build successfully.
Obviously, I don't want to have manually delete the backslashes every time. I'd also like to avoid a custom build step that removes the backslashes. Because qmake has so many options, I was hoping there was something I could just put in the .pro
file that will fix this.
I tried something like DEFINES -= QT_TESTCASE_BUILDDIR
. That doesn't work however because QT_TESTCASE_BUILDDIR
is not yet defined. testlib
apparently adds its own definitions later.
I am using:
- Visual Studio 2010 SP 1
- Qt 5.0.2
- Qt Creator 2.7.0
- Windows 7
What's the simplest way to get rid of the backslashes?
Edit: This also happens OSX.