Commit e16e3c0c authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Cleanup to use imported targets.

Also updates CMake minimum version to 2.8.12.
parent 706d5cd1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
PROJECT(QtTesting) PROJECT(QtTesting)
...@@ -12,16 +12,13 @@ IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "4" OR ...@@ -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'") message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '4' or '5'")
ENDIF() ENDIF()
set(qt_imported_targets)
IF(QtTesting_QT_VERSION VERSION_GREATER "4") IF(QtTesting_QT_VERSION VERSION_GREATER "4")
FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Widgets)
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS}) SET(qt_imported_targets Qt5::Core Qt5::Widgets)
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
SET(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
ELSE() ELSE()
IF(NOT QT4_FOUND) FIND_PACKAGE(Qt4 REQUIRED COMPONENTS QtGui)
FIND_PACKAGE(Qt4 REQUIRED) SET(qt_imported_targets Qt4::QtCore Qt4::QtGui)
INCLUDE( ${QT_USE_FILE} )
ENDIF()
ENDIF() ENDIF()
IF(NOT DEFINED QT_TESTING_WITH_PYTHON) IF(NOT DEFINED QT_TESTING_WITH_PYTHON)
...@@ -306,7 +303,7 @@ SOURCE_GROUP("Generated" FILES ...@@ -306,7 +303,7 @@ SOURCE_GROUP("Generated" FILES
) )
TARGET_LINK_LIBRARIES(QtTesting TARGET_LINK_LIBRARIES(QtTesting
${QT_LIBRARIES} ${qt_imported_targets}
) )
IF(QT_TESTING_WITH_PYTHON) IF(QT_TESTING_WITH_PYTHON)
......
include(../CMake/qtTestingMacroGenerateMocs.cmake) include(../CMake/qtTestingMacroGenerateMocs.cmake)
IF(QtTesting_QT_VERSION VERSION_GREATER "4") IF(QtTesting_QT_VERSION VERSION_GREATER "4")
FIND_PACKAGE(Qt5Test REQUIRED) FIND_PACKAGE(Qt5 REQUIRED QUIET COMPONENTS Test)
ADD_DEFINITIONS(${Qt5Test_DEFINITIONS}) SET(TEST_LIBRARIES Qt5::Test)
INCLUDE_DIRECTORIES(${Qt5Test_INCLUDE_DIRS})
SET(TEST_LIBRARIES ${Qt5Test_LIBRARIES})
ELSE() ELSE()
SET(TEST_LIBRARIES ${QT_QTTEST_LIBRARY}) FIND_PACKAGE(Qt4 REQUIRED QUIET COMPONENTS QtTest)
SET(TEST_LIBRARIES Qt4::QtTest)
ENDIF() ENDIF()
set(KIT ${PROJECT_NAME}) 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