80 lines
2.1 KiB
CMake
Raw Normal View History

2020-12-08 21:00:43 +01:00
# Copyright 2006 The QElectroTech Team
# This file is part of QElectroTech.
#
# QElectroTech is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# QElectroTech is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.5)
2020-12-10 18:56:30 +01:00
message("..___________________________________________________________________")
2020-12-08 21:00:43 +01:00
project(qt_unittests LANGUAGES CXX)
2020-12-09 15:28:43 +01:00
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
2020-12-09 15:28:43 +01:00
SET(CMAKE_CXX_STANDARD 17)
2020-12-09 15:28:43 +01:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(".. PROJECT_NAME :" ${PROJECT_NAME})
message(".. PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
2020-12-10 18:56:30 +01:00
if(NOT DEFINED QET_DIR)
2020-12-08 21:00:43 +01:00
set(QET_DIR "../..")
2020-12-10 18:56:30 +01:00
message(".. QET_DIR is not set, assuming QET is ../..")
endif()
message(".. QET_DIR :" ${QET_DIR})
2020-12-10 18:56:30 +01:00
if(NOT DEFINED QET_COMPONENTS)
message(".. QET_COMPONENTS is not set !!! I set them up !!!")
include(../../cmake/qet_compilation_vars.cmake)
2020-12-08 21:00:43 +01:00
endif()
2020-12-10 18:56:30 +01:00
if(NOT DEFINED QT_VERSION_MAJOR)
find_package(
QT
NAMES
Qt6
Qt5
COMPONENTS
${QET_COMPONENTS}
Test
REQUIRED
)
endif()
message(".. QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
2020-12-08 21:00:43 +01:00
2020-12-09 15:28:43 +01:00
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS
${QET_COMPONENTS}
2020-12-10 18:56:30 +01:00
Test
2020-12-09 15:28:43 +01:00
REQUIRED)
2020-12-08 21:00:43 +01:00
include(../../cmake/fetch_kdeaddons.cmake)
include(../../cmake/fetch_singleapplication.cmake)
include(../../cmake/fetch_pugixml.cmake)
2020-12-10 18:56:30 +01:00
2020-12-08 21:00:43 +01:00
enable_testing()
add_executable(${PROJECT_NAME} tst_mytest.cpp)
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
target_link_libraries(
${PROJECT_NAME}
PRIVATE
2020-12-10 18:56:30 +01:00
Qt::Test
${KF5_PRIVATE_LIBRARIES}
${QET_PRIVATE_LIBRARIES})
2020-12-08 21:00:43 +01:00