[vtk-developers] syntax error near unexpected token `('

Chris Harris chris.harris at kitware.com
Wed May 2 15:25:37 EDT 2012


Hi David,

The problem is that Qt4Macros.cmake, does not quote the -D options
that contain '(' before it passes them to moc so they get interpreted
by the shell. I copied the Qt4Macros.cmake and made the following
change:

+++ /usr/local/share/cmake-2.8/Modules/Qt4Macros.cmake  2012-04-25 16:59:00.2441
51165 -0400
@@ -77,9 +78,11 @@
       SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
     ENDIF("${_current}" MATCHES "\\.framework/?$")
   ENDFOREACH(_current ${_inc_DIRS})
   GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
   FOREACH(_current ${_defines})
-    SET(${_moc_flags} ${${_moc_flags}} "-D${_current}")
+    SET(${_moc_flags} ${${_moc_flags}} "-D\"${_current}\"")

   ENDFOREACH(_current ${_defines})

   IF(Q_WS_WIN)

Hope that helps.

Chris

On Wed, May 2, 2012 at 1:21 PM, David Doria <daviddoria at gmail.com> wrote:
> I have a Qt/VTK project that I just tried to build with git master
> VTK. I was getting this error:
>
> [ 33%] Generating moc_MovablePatch.cxx
> /bin/sh: -c: line 0: syntax error near unexpected token `('
> generating /home/doriad/build/TestQt/moc_MovablePatch.cxx (moc)
> make[2]: *** [moc_MovablePatch.cxx] Error 1
> make[1]: *** [CMakeFiles/myProject.dir/all] Error 2
>
> Not sure what it meant, I broke out the MovablePatch.h/cpp code so it
> could be compiled on its own. I removed all VTK dependencies, and it
> built fine. I then simply added (without touching the code, now
> Qt-only)
>
> FIND_PACKAGE(VTK REQUIRED)
> INCLUDE(${VTK_USE_FILE})
>
> to the CMakeLists.txt file, and the error came back! When I point
> CMake to a VTK5.8 build, it builds correctly.
>
> Any suggestions?
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list