CMakeLists.txt 4.14 KB
Newer Older
Gilles Caulier's avatar
Gilles Caulier committed
1
#
Gilles Caulier's avatar
Gilles Caulier committed
2
# Copyright (c) 2010-2015, Gilles Caulier, <caulier dot gilles at gmail dot com>
Gilles Caulier's avatar
Gilles Caulier committed
3
#
Gilles Caulier's avatar
Gilles Caulier committed
4
5
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
Gilles Caulier's avatar
Gilles Caulier committed
6

7
set(CMAKE_MIN_VERSION   "3.0.0")
Gilles Caulier's avatar
polish    
Gilles Caulier committed
8
set(ECM_MIN_VERSION     "1.1.0")
9
set(REQUIRED_QT_VERSION "5.12.0")
10
set(EXIV2_MIN_VERSION   "0.25")
11

Gilles Caulier's avatar
polish    
Gilles Caulier committed
12
cmake_minimum_required(VERSION ${CMAKE_MIN_VERSION})
13

14
project(libkexiv2 VERSION "5.0.0")
15
16
17
18

message(STATUS "----------------------------------------------------------------------------------")
message(STATUS "Starting CMake configuration for: ${PROJECT_NAME}")

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# =======================================================
# Information to update before to release this library.

# Library version history:
# API      ABI
# 0.1.0 => 0.1.0
# 0.1.1 => 0.2.0
# 0.1.2 => 1.0.1
# 0.1.3 => 1.0.1
# 0.1.4 => 2.0.2
# 0.1.5 => 2.1.1
# 0.1.6 => 3.0.0
# 0.1.7 => 4.0.1
# 0.1.8 => 5.0.0
# 0.2.0 => 6.0.0     (released with KDE 4.1.0)
# 0.3.0 => 7.0.0     (released with KDE 4.1.2)
# 0.4.0 => 7.1.0
# 0.5.0 => 7.2.0     (Released with KDE 4.2.0)
# 0.6.0 => 7.3.0     (Released with KDE 4.3.0)
# 1.0.0 => 8.0.0     (Released with KDE 4.4.0)
# 1.1.0 => 8.1.0     (Released with KDE 4.5.0)
# 1.2.0 => 9.0.0     (Released with KDE 4.6.0) - Including XMP sidecar support
# 2.0.0 => 10.0.0    (Released with KDE 4.7.0)
# 2.1.0 => 10.0.1    (Released with KDE 4.7.1) - Add AltLangStrEdit visible lines API
# 2.1.1 => 10.0.2    (Released with KDE 4.7.4) - Add AltLangStrEdit::setCurrentLanguageCode()
# 2.2.0 => 11.0.0    (Released with KDE 4.8.1) - Remove deprecated methods
# 2.3.0 => 11.1.0    (Released with KDE 4.8.2) - Add new static methods about XMP sidecar file management.
# 2.3.1 => 11.2.0                              - Add new method to set specific XMP tag string
Gilles Caulier's avatar
Qt5 ++    
Gilles Caulier committed
47
# 2.4.0 => 11.3.0                              - Add new method to access on text edit widget from AltLangStrEdit
Gilles Caulier's avatar
polish    
Gilles Caulier committed
48
# 5.0.0 => 15.0.0    (Released with KDE 5.x)
49
50

# Library ABI version used by linker.
Friedrich W. H. Kossebau's avatar
Friedrich W. H. Kossebau committed
51
# For details : https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
52
53
54
55
56
set(KEXIV2_LIB_SO_CUR_VERSION "15")
set(KEXIV2_LIB_SO_REV_VERSION "0")
set(KEXIV2_LIB_SO_AGE_VERSION "0")

set(LIBKEXIV2_SO_VERSION  "${KEXIV2_LIB_SO_CUR_VERSION}.${KEXIV2_LIB_SO_REV_VERSION}.${KEXIV2_LIB_SO_AGE_VERSION}")
57

Gilles Caulier's avatar
polish    
Gilles Caulier committed
58
59
60
61
62
63
64
############## ECM setup ######################

find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${libkexiv2_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})

include(KDEInstallDirs)
include(KDECMakeSettings)
65
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
66
67
68
69

include(ECMGenerateHeaders)
include(ECMSetupVersion)
include(ECMMarkNonGuiExecutable)
Gilles Caulier's avatar
polish    
Gilles Caulier committed
70
include(GenerateExportHeader)
71
include(CMakePackageConfigHelpers)
Gilles Caulier's avatar
polish    
Gilles Caulier committed
72
73
include(FeatureSummary)

74
75
76
77
78
79
80
ecm_setup_version(${libkexiv2_VERSION}
                  VARIABLE_PREFIX      KEXIV2
                  VERSION_HEADER       "src/libkexiv2_version.h"
                  PACKAGE_VERSION_FILE "KF5KExiv2ConfigVersion.cmake"
                  SOVERSION            ${LIBKEXIV2_SO_VERSION}
)

Gilles Caulier's avatar
Gilles Caulier committed
81
82
############## Find Packages ###################

Gilles Caulier's avatar
polish    
Gilles Caulier committed
83
84
85
86
87
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS
             Core
             Gui
)

88
find_package(LibExiv2 ${EXIV2_MIN_VERSION} REQUIRED)
89

Gilles Caulier's avatar
Gilles Caulier committed
90
############## Targets #########################
91

Laurent Montel's avatar
Laurent Montel committed
92
add_subdirectory(src)
93
94
95
96

if (BUILD_TESTING)
    add_subdirectory(tests)
endif()
97
98

############## CMake Config Files ##############
Gilles Caulier's avatar
Gilles Caulier committed
99

100
message("${CMAKECONFIG_INSTALL_DIR}")
Teemu Rytilahti's avatar
Teemu Rytilahti committed
101
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5KExiv2")
102

103
configure_package_config_file(
Gilles Caulier's avatar
Gilles Caulier committed
104
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/KF5KExiv2Config.cmake.in"
105
106
107
108
109
    "${CMAKE_CURRENT_BINARY_DIR}/KF5KExiv2Config.cmake"
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
Gilles Caulier's avatar
Gilles Caulier committed
110
111
112
113
        "${CMAKE_CURRENT_BINARY_DIR}/KF5KExiv2Config.cmake"
        "${CMAKE_CURRENT_BINARY_DIR}/KF5KExiv2ConfigVersion.cmake"
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT   Devel
114
115
)

Gilles Caulier's avatar
Gilles Caulier committed
116
117
118
install(EXPORT      KF5KExiv2Targets
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        FILE        KF5KExiv2Targets.cmake
Gilles Caulier's avatar
Gilles Caulier committed
119
        NAMESPACE   KF5::
120
121
122
)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)