[CMake] A patch against FindQt4.cmake from CMake 2.6.4 to fix macro QT4_MAKE_OUTPUT_FILE in different drives on Windows
Guilherme Balena Versiani
guibv at comunip.com.br
Thu Jul 16 17:40:30 EDT 2009
Dear CMake maintainers,
I use Qt on Windows and discovered a BUG in FindQt4.cmake from CMake
2.6.4, when you use the macro QT4_WRAP_CPP for an input file coming from
another drive different from the current build drive. The problem occurs
from the fact that QT4_MAKE_OUTPUT_FILE macro was supporting to generate
"output" files only for paths in the same Windows drive.
The problem is seen in the following error message:
CMake Error at C:/Program
Files/cmake/share/cmake-2.6/Modules/FindQt4.cmake:967 (FILE):
file problem creating directory:
D:/<source_path>/C:/Qt/4.5.0/qtsingleapplication/src
Call Stack (most recent call first):
C:/Program Files/cmake/share/cmake-2.6/Modules/FindQt4.cmake:1041
(QT4_MAKE_OUTPUT_FILE)
D:/<source_path>/CMakeLists.txt:XXX (QT4_WRAP_CPP)
The patch below can be applied against CMake 2.6.4 to the file
share/cmake-2.6/Modules/FindQt4.cmake:
--- FindQt4.cmake.orig Thu Jul 16 21:23:20 2009
+++ FindQt4.cmake Thu Jul 16 21:23:03 2009
@@ -960,6 +960,9 @@
ELSE(_infileLength GREATER _binlength)
FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
ENDIF(_infileLength GREATER _binlength)
+ IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
+ STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+ ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:")
SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
STRING(REPLACE ".." "__" _outfile ${_outfile})
GET_FILENAME_COMPONENT(outpath ${_outfile} PATH)
Best regards,
Guilherme Balena Versiani.
More information about the CMake
mailing list