Browse Source

BUG: Fix problem with last patch when trying to take substr of shorter strings
than expected. Fixes #6730.

Clinton Stimpson 17 years ago
parent
commit
7d85462cc3
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Modules/FindQt4.cmake

+ 5 - 1
Modules/FindQt4.cmake

@@ -993,7 +993,11 @@ IF (QT4_QMAKE_FOUND)
   # macro used to create the names of output files preserving relative dirs
   MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile )
     STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
-    STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+    STRING(LENGTH ${infile} _infileLength)
+    SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
+    IF(_infileLength GREATER _binlength)
+      STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+    ENDIF(_infileLength GREATER _binlength)
     IF(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}")
       FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
     ELSE(CMAKE_CURRENT_BINARY_DIR MATCHES "${_checkinfile}")