title: QT : header in .ui files
body: <p>I want to know how to make <code>&lt;header&gt;</code> in <code>files.ui</code> works with cmake for custom widgets.</p>
  
  <p>I've CMakeLists like this :</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
  
  project(qtelec C CXX)
  
  set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt5.6.0/5.6/gcc_64)
  set(SRC_BASE_DIR "../../../qtelec")
  set(COREALPI_BUILD_DIR "../../../../corealpi/build")
  
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  set(CMAKE_AUTOUIC ON)
  set(CMAKE_AUTORCC ON)
  
  find_package(Qt5Widgets REQUIRED)
  
  file(GLOB_RECURSE SRC_FILES 
      ${SRC_BASE_DIR}/src/*.h 
      ${SRC_BASE_DIR}/src/*.cpp
  )
  
  link_directories(${COREALPI_BUILD_DIR}/elec)
  link_directories(${COREALPI_BUILD_DIR}/elec/core)
  
  add_library(qtelec SHARED
      ${SRC_FILES}
  )
  
  add_subdirectory(${SRC_BASE_DIR}/../platform/cmake/qtutils ${CMAKE_BINARY_DIR}/qtutils)  
  include_directories(${SRC_BASE_DIR}/../external/qtpropertybrowser/latest/src)
  include_directories(${SRC_BASE_DIR}/../qtutils/src)
  #include_directories(${SRC_BASE_DIR}/src/widgets)
  include_directories(${COREALPI_BUILD_DIR}/../include/ca)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  
  target_link_libraries(qtelec qtpropertybrowser elec core qtutils Qt5::Widgets)
  </code></pre>
  
  <p><code>cmake ..</code> works but <code>cmake --build .</code> give me the following error :</p>
  
  <pre><code>[ 65%] Building CXX object CMakeFiles/qtelec.dir/home/mea/workspace/repos/qtelec/qtelec/src/forms/conversionform.cpp.o
  In file included from /home/mea/workspace/repos/qtelec/qtelec/src/forms/conversionform.cpp:2:0:
  /home/mea/workspace/repos/qtelec/build/ui_conversionform.h:18:40: fatal error: ../widgets/canecoboxwidget.h: Aucun fichier ou dossier de ce type
  compilation terminated.
  </code></pre>
  
  <p>If I look in my <strong>conversionform.ui</strong> I've something like that (and in other <strong>files.ui</strong> too) :</p>
  
  <pre><code>&lt;customwidgets&gt;
    &lt;customwidget&gt;
     &lt;class&gt;CanecoBoxWidget&lt;/class&gt;
     &lt;extends&gt;QWidget&lt;/extends&gt;
     &lt;header&gt;../widgets/canecoboxwidget.h&lt;/header&gt;
     &lt;container&gt;1&lt;/container&gt;
    &lt;/customwidget&gt;
  &lt;/customwidgets&gt;
  </code></pre>
  
  <p>But the problem is my <strong>ui_generated</strong> files are in my build folder, so when cmake attempt to find path <code>../widgets/</code> he doesn't exist. Here is my folder structure :</p>
  
  <pre><code>├── build
  ├── qtelec
  │   ├── src
  │        └── *.h
  │        └── *.cpp
  │        └── editors
  │              └── *.h
  │              └── *.cpp
  │              └── *.ui
  │        └── forms
  │              └── *.h
  │              └── *.cpp
  │              └── *.ui
  │        └── widgets
  │              └── *.h
  │              └── *.cpp
  │              └── *.ui
  ├── cmake/CMakelists.txt
  </code></pre>
  
  <p>The only solution I found is to include directory with <code>include_directories(${SRC_BASE_DIR}/src/widgets)</code>.</p>
  
  <p>But I think there is other way in CMake or QT to make it work without additional include ?</p>
  
  <p>In .pro file, there si no need to include this folder.</p>
  
  <p>Can you help me to find a solution please ?</p>
  
  <p>If you want more information, I can give it.</p>
  
  <p>Thanks for help.</p>