forked from KDAB/KDSoap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
130 lines (107 loc) · 4.11 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
project(KDSoap CXX)
cmake_minimum_required(VERSION 2.8.7)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/ ${CMAKE_MODULE_PATH}")
option(${PROJECT_NAME}_STATIC "Build statically" OFF)
option(${PROJECT_NAME}_TESTS "Build the tests" OFF)
set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# setup default install locations
include(InstallLocation)
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
find_package(Qt5Network REQUIRED)
set(QT_LIBRARIES Qt5::Core)
set(QT_USE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Qt5Portability.cmake")
if(Qt5_POSITION_INDEPENDENT_CODE)
if(CMAKE_VERSION VERSION_LESS 2.8.9)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
elseif(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
if (Qt5Core_VERSION VERSION_LESS 5.1)
set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
endif()
else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
endif()
else()
find_package(Qt4 4.7 QUIET REQUIRED QtCore QtMain QtGui)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_AUTOMOC TRUE)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY)
add_definitions(-DUSE_EXCEPTIONS -DQT_FATAL_ASSERT)
if(${PROJECT_NAME}_STATIC)
set(${PROJECT_NAME}_LIBRARY_MODE "STATIC")
else()
set(${PROJECT_NAME}_LIBRARY_MODE "SHARED")
endif()
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(${PROJECT_NAME}_IS_ROOT_PROJECT TRUE)
if(CMAKE_BUILD_TYPE MATCHES "Release")
add_definitions(-DNDEBUG)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "" FORCE)
endif()
if(UNIX AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}")
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX "C:\\KDAB\\${PROJECT_NAME}-$$VERSION")
endif()
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
install(FILES LICENSE.GPL.txt LICENSE.US.txt LICENSE.txt README.txt kdsoap.pri kdwsdl2cpp.pri DESTINATION .)
if (CMAKE_VERSION VERSION_LESS 2.8.8)
include("${CMAKE_SOURCE_DIR}/cmake/CMakePackageConfigHelpers.cmake")
else()
include(CMakePackageConfigHelpers)
endif()
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/KDSoap/KDSoapConfigVersion.cmake"
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KDSoapConfig-buildtree.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KDSoap/KDSoapConfig.cmake"
@ONLY
)
file(COPY
"${CMAKE_CURRENT_SOURCE_DIR}/KDSoapMacros.cmake"
DESTINATION
"${CMAKE_CURRENT_BINARY_DIR}/KDSoap/"
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KDSoapConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install/KDSoapConfig.cmake"
INSTALL_DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/KDSoap"
PATH_VARS INSTALL_INCLUDE_DIR
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/install/KDSoapConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KDSoap/KDSoapConfigVersion.cmake"
KDSoapMacros.cmake
DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/KDSoap"
)
install(EXPORT KDSoapTargets NAMESPACE KDSoap::
DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/KDSoap"
)
endif()
add_subdirectory(src)
add_subdirectory(kdwsdl2cpp)
if(${PROJECT_NAME}_IS_ROOT_PROJECT)
export(TARGETS kdsoap kdsoap-server kdwsdl2cpp NAMESPACE KDSoap::
FILE "${CMAKE_CURRENT_BINARY_DIR}/KDSoap/KDSoapTargets.cmake"
)
add_subdirectory(features)
if(${PROJECT_NAME}_TESTS)
enable_testing()
add_subdirectory(testtools)
add_subdirectory(unittests)
endif()
add_subdirectory(examples)
endif()