Skip to content

Commit 7617483

Browse files
kraehlitjcfr
authored andcommitted
COMP: Support building against QtSOAP install tree
1 parent 6a08938 commit 7617483

File tree

3 files changed

+61
-39
lines changed

3 files changed

+61
-39
lines changed

CMakeLists.txt

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ else()
1515
cmake_minimum_required(VERSION 2.8.2)
1616
endif()
1717

18-
PROJECT(QtSOAP)
18+
cmake_policy(SET CMP0048 NEW)
19+
project(QtSOAP VERSION 2.7.1)
20+
1921

2022
include(CTestUseLaunchers OPTIONAL)
2123

@@ -47,6 +49,53 @@ else()
4749
include(${QT_USE_FILE})
4850
endif()
4951

52+
#-----------------------------------------------------------------------------
53+
# Installation (https://github.com/forexample/package-example)
54+
include(GNUInstallDirs)
55+
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
56+
install(DIRECTORY doc/html/ DESTINATION ${CMAKE_INSTALL_DOCDIR})
57+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/UseQtSOAP.cmake DESTINATION ${config_install_dir})
58+
59+
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
60+
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
61+
set(project_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
62+
set(targets_export_name "${PROJECT_NAME}Targets")
63+
set(namespace "${PROJECT_NAME}::")
64+
65+
# Include module with function 'write_basic_package_version_file'
66+
include(CMakePackageConfigHelpers)
67+
68+
# Configure '<PROJECT-NAME>ConfigVersion.cmake'
69+
# Use:
70+
# * PROJECT_VERSION
71+
write_basic_package_version_file(
72+
"${version_config}" COMPATIBILITY SameMajorVersion
73+
)
74+
75+
# Configure '<PROJECT-NAME>Config.cmake'
76+
# Use variables:
77+
# * targets_export_name
78+
# * PROJECT_NAME
79+
configure_package_config_file(
80+
"QtSOAPConfig.cmake.in"
81+
"${project_config}"
82+
INSTALL_DESTINATION "${config_install_dir}"
83+
NO_CHECK_REQUIRED_COMPONENTS_MACRO
84+
)
85+
86+
87+
88+
install(
89+
FILES "${project_config}" "${version_config}"
90+
DESTINATION "${config_install_dir}"
91+
)
92+
93+
install(
94+
EXPORT "${targets_export_name}"
95+
NAMESPACE "${namespace}"
96+
DESTINATION "${config_install_dir}"
97+
)
98+
5099
#-----------------------------------------------------------------------------
51100
# Subdirectories
52101
#

QtSOAPConfig.cmake.in

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,6 @@
2121
#
2222
# QtSOAPConfig.cmake - QtSOAP CMake configuration file for external projects.
2323
#
24+
@PACKAGE_INIT@
2425

25-
SET(QtSOAP_LIBRARIES @PROJECT_NAME@)
26-
27-
# The QtSOAP include file directories.
28-
SET(QtSOAP_INCLUDE_DIRS "@QtSOAP_INCLUDE_DIRS_CONFIG@")
29-
30-
# The QtSOAP library directories. Note that if
31-
# QtSOAP_CONFIGURATION_TYPES is set (see below) then these directories
32-
# will be the parent directories under which there will be a directory
33-
# of runtime binaries for each configuration type.
34-
SET(QtSOAP_LIBRARY_DIRS "@QtSOAP_LIBRARY_DIRS_CONFIG@")
35-
36-
# The QtSOAP runtime library directories. Note that if
37-
# QtSOAP_CONFIGURATION_TYPES is set (see below) then these directories
38-
# will be the parent directories under which there will be a directory
39-
# of runtime libraries for each configuration type.
40-
SET(QtSOAP_RUNTIME_LIBRARY_DIRS "@QtSOAP_RUNTIME_LIBRARY_DIRS_CONFIG@")
41-
42-
# The location of the UseQtSOAP.cmake file.
43-
SET(QtSOAP_USE_FILE "@QtSOAP_USE_FILE@")
44-
45-
46-
# A QtSOAP install tree always provides one build configuration.
47-
# A QtSOAP build tree may provide either one or multiple build
48-
# configurations depending on the CMake generator used.
49-
# Since QtSOAP can be used either from a build tree or an install
50-
# tree it is useful for outside projects to know the configurations available.
51-
# If this QtSOAPConfig.cmake is in a QtSOAP install
52-
# tree QtSOAP_CONFIGURATION_TYPES will be empty and
53-
# QtSOAP_BUILD_TYPE will be set to the value of
54-
# CMAKE_BUILD_TYPE used to build QtSOAP. If QtSOAPConfig.cmake
55-
# is in a QtSOAP build tree then QtSOAP_CONFIGURATION_TYPES
56-
# and QtSOAP_BUILD_TYPE will have values matching CMAKE_CONFIGURATION_TYPES
57-
# and CMAKE_BUILD_TYPE for that build tree (only one will ever be set).
58-
SET(QtSOAP_CONFIGURATION_TYPES @QtSOAP_CONFIGURATION_TYPES_CONFIG@)
59-
SET(QtSOAP_BUILD_TYPE @QtSOAP_BUILD_TYPE_CONFIG@)
26+
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

src/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(KIT_HEADERS
2525
QtSoapArrayIterator
2626
QtSoapArray
2727
)
28-
28+
2929
INCLUDE_DIRECTORIES(
3030
${CMAKE_CURRENT_SOURCE_DIR}
3131
${CMAKE_CURRENT_BINARY_DIR}
@@ -53,6 +53,12 @@ TARGET_LINK_LIBRARIES(
5353
${libname}
5454
${${PROJECT_NAME}_LINK_LIBRARIES}
5555
)
56+
target_include_directories(
57+
${libname}
58+
PUBLIC
59+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
60+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
61+
)
5662

5763
#-----------------------------------------------------------------------------
5864
#
@@ -69,6 +75,6 @@ install(
6975
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
7076
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
7177
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
72-
)
78+
)
7379

74-
install(FILES ${KIT_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
80+
install(FILES ${KIT_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})

0 commit comments

Comments
 (0)