Don't use undefined variables
authorLuís Pereira <luis.artur.pereira@gmail.com>
Thu, 29 May 2014 17:19:25 +0000 (10:19 -0700)
committerLuís Pereira <luis.artur.pereira@gmail.com>
Thu, 29 May 2014 17:19:25 +0000 (10:19 -0700)
When using Qt5, QT_QTCORE_LIBRARY, QT_QTGUI_LIBRARY, QT_QTDBUS_LIBRARY
QT_QTCORE_INCLUDE_DIR, QT_QTGUI_INCLUDE_DIR and QT_QTDBUS_INCLUDE_DIR
are undefined.
We should not use them.

Signed-off-by: Luís Pereira <luis.artur.pereira@gmail.com>
CMakeLists.txt

index c162631..be54c58 100644 (file)
@@ -183,11 +183,16 @@ find_package(X11 REQUIRED QUIET)
 
 include_directories (
     ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
-    ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}
     ${X11_INCLUDE_DIR}
     ${QTXDG_INCLUDE_DIRS}
 )
 
+if (NOT USE_QT5)
+    include_directories (
+        ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}
+    )
+endif()
+
 # Standard directories for installation
 include(GNUInstallDirs)
 
@@ -306,16 +311,19 @@ add_library(${LXQT_LIBRARY_NAME}
            
 )
 
-
-target_link_libraries(${LXQT_LIBRARY_NAME}
-    ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
-    ${QT_QTDBUS_LIBRARY}
-    ${X11_X11_LIB}
-    ${QTXDG_LIBRARIES}
-)
-
-if(USE_QT5)
+if (USE_QT5)
        qt5_use_modules(${LXQT_LIBRARY_NAME} Widgets DBus X11Extras)
+    target_link_libraries(${LXQT_LIBRARY_NAME}
+        ${X11_X11_LIB}
+        ${QTXDG_LIBRARIES}
+    )
+else()
+    target_link_libraries(${LXQT_LIBRARY_NAME}
+        ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
+        ${QT_QTDBUS_LIBRARY}
+        ${X11_X11_LIB}
+        ${QTXDG_LIBRARIES}
+    )
 endif()
 
 set_target_properties(${LXQT_LIBRARY_NAME} PROPERTIES