diff Resources/CMake/QtConfiguration.cmake @ 365:ef31240a73f6 am-2

no automatic call to moc and uic, CircleMeasureTracker using Orthanc fonts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 31 Oct 2018 18:10:29 +0100
parents 10d188d6e5cc
children 574fc54056af b70e9be013e4
line wrap: on
line diff
--- a/Resources/CMake/QtConfiguration.cmake	Wed Oct 31 11:06:25 2018 +0100
+++ b/Resources/CMake/QtConfiguration.cmake	Wed Oct 31 18:10:29 2018 +0100
@@ -17,10 +17,8 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
-SET(CMAKE_AUTOUIC ON)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC OFF)
+set(CMAKE_AUTOUIC OFF)
 
 # Find the QtWidgets library
 find_package(Qt5Widgets QUIET)
@@ -32,12 +30,32 @@
     Qt5::Widgets
     Qt5::Core
     )
+
+  # Create aliases for the CMake commands
+  macro(ORTHANC_QT_WRAP_UI)
+    QT5_WRAP_UI(${ARGN})
+  endmacro()
+  
+  macro(ORTHANC_QT_WRAP_CPP)
+    QT5_WRAP_CPP(${ARGN})
+  endmacro()
+    
 else()
   message("Qt5 has not been found, trying with Qt4")
   find_package(Qt4 REQUIRED QtGui)
   link_libraries(
     Qt4::QtGui
     )
+
+  # Create aliases for the CMake commands
+  macro(ORTHANC_QT_WRAP_UI)
+    QT4_WRAP_UI(${ARGN})
+  endmacro()
+  
+  macro(ORTHANC_QT_WRAP_CPP)
+    QT4_WRAP_CPP(${ARGN})
+  endmacro()
+  
 endif()
 
 list(APPEND QT_SOURCES
@@ -46,5 +64,14 @@
   ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp
   )
 
-include_directories(${ORTHANC_STONE_ROOT}/Applications/Qt/)
+
+# NB: Including CMAKE_CURRENT_BINARY_DIR is mandatory, as the CMake
+# macros for Qt will put their result in that directory, which cannot
+# be changed.
+# https://stackoverflow.com/a/4016784/881731
 
+include_directories(
+  ${ORTHANC_STONE_ROOT}/Applications/Qt/
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+