-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.txt
79 lines (65 loc) · 2.23 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
cmake_minimum_required(VERSION 3.6)
project(libmaia VERSION 1.0.0 LANGUAGES CXX)
if (NOT QT_VERSION_MAJOR)
set(QT_VERSION_MAJOR 5 CACHE STRING "Which Qt major version to look for")
endif()
option(BUILD_EXAMPLE "Build example" OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt${QT_VERSION_MAJOR}Network CONFIG REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Xml CONFIG REQUIRED)
set(maia_headers
maia/maiaFault.h
maia/maiaObject.h
maia/maiaXmlRpcClient.h
maia/maiaXmlRpcServerConnection.h
maia/maiaXmlRpcServer.h
)
set(maia_sources
maia/maiaFault.cpp
maia/maiaObject.cpp
maia/maiaXmlRpcClient.cpp
maia/maiaXmlRpcServerConnection.cpp
maia/maiaXmlRpcServer.cpp
)
add_library(maia ${maia_sources} ${maia_headers})
target_include_directories(maia PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
target_link_libraries(maia Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Xml)
if (${BUILD_EXAMPLE})
add_subdirectory(examples)
endif()
# Install stuff
set(include_install_dir "include")
set(lib_install_dir "lib")
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(config_export_name "${PROJECT_NAME}Config")
set(targets_export_name "${PROJECT_NAME}Targets")
set(project_config "${CMAKE_CURRENT_BINARY_DIR}/${config_export_name}.cmake")
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/${config_export_name}Version.cmake")
set(namespace "${PROJECT_NAME}::")
include (CMakePackageConfigHelpers)
configure_package_config_file(
"config.cmake.in"
${project_config}
INSTALL_DESTINATION ${config_install_dir}
)
write_basic_package_version_file(
${version_config}
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion
)
add_library(${namespace}maia ALIAS maia)
install(TARGETS maia
EXPORT ${targets_export_name}
INCLUDES DESTINATION "${include_install_dir}"
LIBRARY DESTINATION ${lib_install_dir}
ARCHIVE DESTINATION ${lib_install_dir}
PUBLIC_HEADER DESTINATION ${include_install_dir}
)
install(EXPORT ${targets_export_name}
NAMESPACE ${namespace}
DESTINATION ${config_install_dir})
install(FILES ${project_config} ${version_config}
DESTINATION ${config_install_dir})
install(FILES ${maia_headers} DESTINATION include/maia)