# Copyright (C) 2018 by Intevation GmbH <info@intevation.de>
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.

cmake_minimum_required(VERSION 3.5.0)
project(gpg4win-tools)
set(PRETTY_NAME cryp.do)

### Generic Setup

set(KF_VERSION "5.240.0")
set(GPGME_REQUIRED_VERSION "1.13.1")
set(QT_REQUIRED_VERSION "6.4.0")
set(LIBKLEO_VERSION "5.17.44")

#Old qtmain linking behavior to be compatible with cmake versions < 2.8.11

if(POLICY CMP0020)
  cmake_policy(SET CMP0020 OLD)
endif()

find_package(Qt6 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets)

find_package(Gpgmepp ${GPGME_REQUIRED_VERSION} CONFIG REQUIRED)
find_package(QGpgmeQt6 ${GPGME_REQUIRED_VERSION} CONFIG REQUIRED)
find_package(KPim6Libkleo ${LIBKLEO_VERSION} CONFIG REQUIRED)
find_package(KF6WidgetsAddons ${KF_VERSION} CONFIG REQUIRED)
find_package(KF6IconThemes ${KF_VERSION} CONFIG REQUIRED)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)


if(WIN32)
   add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista
   add_definitions(-DWINVER=0x0600)
   add_definitions(-DUNICODE -D_UNICODE)
   add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions
endif(WIN32)


set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Cmake does not correctly identify gcc windres when cross compiling
# making this line neccessary to set the correct flags for it.
# See: http://public.kitware.com/Bug/view.php?id=11773
SET(CMAKE_RC_COMPILE_OBJECT
      "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -Ocoff <SOURCE> <OBJECT>")

#add_subdirectory(img)
### Include the actual source directories
add_subdirectory(src)
