Commit 9951bc69 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by GitHub

Merge pull request #36 from utkarshayachit/use_imported_targets

Cleanup to use imported targets.
parents 706d5cd1 e16e3c0c
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
PROJECT(QtTesting)
......@@ -12,16 +12,13 @@ IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "4" OR
message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '4' or '5'")
ENDIF()
set(qt_imported_targets)
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
FIND_PACKAGE(Qt5Widgets REQUIRED)
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
SET(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Widgets)
SET(qt_imported_targets Qt5::Core Qt5::Widgets)
ELSE()
IF(NOT QT4_FOUND)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE( ${QT_USE_FILE} )
ENDIF()
FIND_PACKAGE(Qt4 REQUIRED COMPONENTS QtGui)
SET(qt_imported_targets Qt4::QtCore Qt4::QtGui)
ENDIF()
IF(NOT DEFINED QT_TESTING_WITH_PYTHON)
......@@ -306,7 +303,7 @@ SOURCE_GROUP("Generated" FILES
)
TARGET_LINK_LIBRARIES(QtTesting
${QT_LIBRARIES}
${qt_imported_targets}
)
IF(QT_TESTING_WITH_PYTHON)
......
include(../CMake/qtTestingMacroGenerateMocs.cmake)
IF(QtTesting_QT_VERSION VERSION_GREATER "4")
FIND_PACKAGE(Qt5Test REQUIRED)
ADD_DEFINITIONS(${Qt5Test_DEFINITIONS})
INCLUDE_DIRECTORIES(${Qt5Test_INCLUDE_DIRS})
SET(TEST_LIBRARIES ${Qt5Test_LIBRARIES})
FIND_PACKAGE(Qt5 REQUIRED QUIET COMPONENTS Test)
SET(TEST_LIBRARIES Qt5::Test)
ELSE()
SET(TEST_LIBRARIES ${QT_QTTEST_LIBRARY})
FIND_PACKAGE(Qt4 REQUIRED QUIET COMPONENTS QtTest)
SET(TEST_LIBRARIES Qt4::QtTest)
ENDIF()
set(KIT ${PROJECT_NAME})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment