title: Undefined reference error on QQuickWindow from cmake
body: <p>I am in the middle of integrating catkin project with qt-quick project.
  I made a rugged CMakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required (VERSION 2.8)
  project (qml_ros_camera)
  
  set(CMAKE_AUTOMOC ON)
  
  find_package(Qt5Core REQUIRED)
  
  set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
  
  # set up a mapping so that the Release configuration for the Qt imported target is
  # used in the COVERAGE CMake configuration.
  set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")
  
  get_target_property(QtCore_location Qt5::Core LOCATION)
  
  find_package(Qt5 COMPONENTS Quick Core Network)
  find_package(Qt5Widgets REQUIRED)
  find_package(Qt5Declarative)
  
  catkin_package()
  
  include_directories(include ${OpenCV_INCLUDE_DIRS})
  
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  set(HEADER_FILES ~/image_transport_ws/src/qml_ros_camera/src/videoplayer.h)
  set(SOURCE_FILES ~/image_transport_ws/src/qml_ros_camera/src/main.cpp
      ~/image_transport_ws/src/qml_ros_camera/src/videoplayer.cpp
      )
  
  set(qml_ros_camera_RESOURCES qml.qrc)
  qt5_add_resources(qml_ros_camera_RESOURCES_RCC ${qml_ros_camera_RESOURCES})
  
  add_executable(qml_ros_camera
      ${SOURCE_FILES}
      ${qml_ros_camera_RESOURCES_RCC})
  
  target_link_libraries(qml_ros_camera ${Qt5Widgets_LIBRARIES}
      ${Qt5Core}
      ${Qt5Declarative_LIBRARIES}
      ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
  
  include_directories(
      ~/image_transport_ws/src/qml_ros_camera/src/
      /opt/Qt/5.5/gcc_64/include/QtQuick
      /opt/Qt/5.5/gcc_64/include/QtCore
      ${Qt5Declarative_INCLUDE_DIRS}
      ${Qt5Widgets_INCLUDE_DIRS})
  
  include_directories(${Qt5Widgets_INCLUDE_DIRS})
  
  add_definitions(${Qt5Widgets_DEFINITIONS})
  
  ADD_DEFINITIONS(${QT_DEFINITIONS})
  qt5_use_modules(qml_ros_camera Widgets Qml)
  </code></pre>
  
  <p>The compile error I have:</p>
  
  <pre><code>CMakeFiles/qml_ros_camera.dir/src/main.cpp.o: 
  In function `QQuickWindow* qobject_cast&lt;QQuickWindow*&gt;(QObject*)': main.cpp:
  (.text._Z12qobject_castIP12QQuickWindowET_P7QObject
  [_Z12qobject_castIP12QQuickWindowET_P7QObject]+0x16)
  : undefined reference to `QQuickWindow::staticMetaObject'
  </code></pre>
  
  <p>I'm using Qt-creator and C++. The problem is associated with my poor understanding on how CMakeLists.txt works. How may I fix this terrible compile error?</p>