瀏覽代碼

Fix an issue with long relative include paths in moc generated files.

Sascha Zelzer 14 年之前
父節點
當前提交
e9298b5ce1
共有 3 個文件被更改,包括 21 次插入3 次删除
  1. 7 1
      CMake/ctkMacroBuildApp.cmake
  2. 7 1
      CMake/ctkMacroBuildLib.cmake
  3. 7 1
      CMake/ctkMacroBuildPlugin.cmake

+ 7 - 1
CMake/ctkMacroBuildApp.cmake

@@ -93,7 +93,13 @@ MACRO(ctkMacroBuildApp)
   SET(MY_QRC_SRCS)
 
   # Wrap
-  QT4_WRAP_CPP(MY_MOC_CPP ${MY_MOC_SRCS})
+  IF(MY_MOC_SRCS)
+    # this is a workaround for Visual Studio. The relative include paths in the generated
+    # moc files can get very long and can't be resolved by the MSVC compiler.
+    FOREACH(moc_src ${MY_MOC_SRCS})
+      QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src})
+    ENDFOREACH()
+  ENDIF()
   QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS})
   IF(DEFINED MY_RESOURCES)
     QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES})

+ 7 - 1
CMake/ctkMacroBuildLib.cmake

@@ -91,7 +91,13 @@ MACRO(ctkMacroBuildLib)
   SET(MY_QRC_SRCS)
 
   # Wrap
-  QT4_WRAP_CPP(MY_MOC_CPP ${MY_MOC_SRCS})
+  IF(MY_MOC_SRCS)
+    # this is a workaround for Visual Studio. The relative include paths in the generated
+    # moc files can get very long and can't be resolved by the MSVC compiler.
+    FOREACH(moc_src ${MY_MOC_SRCS})
+      QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src})
+    ENDFOREACH()
+  ENDIF()
   QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS})
   IF(DEFINED MY_RESOURCES)
     QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES})

+ 7 - 1
CMake/ctkMacroBuildPlugin.cmake

@@ -158,7 +158,13 @@ MACRO(ctkMacroBuildPlugin)
   SET(MY_QRC_SRCS)
 
   # Wrap
-  QT4_WRAP_CPP(MY_MOC_CPP ${MY_MOC_SRCS})
+  IF(MY_MOC_SRCS)
+    # this is a workaround for Visual Studio. The relative include paths in the generated
+    # moc files can get very long and can't be resolved by the MSVC compiler.
+    FOREACH(moc_src ${MY_MOC_SRCS})
+      QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src})
+    ENDFOREACH()
+  ENDIF()
   QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS})
   IF(DEFINED MY_RESOURCES)
     QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES})