diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe7f73..e530625 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,9 @@ else() cmake_minimum_required(VERSION 2.8.2) endif() -PROJECT(QtSOAP) +cmake_policy(SET CMP0048 NEW) +project(QtSOAP VERSION 2.7.1) + include(CTestUseLaunchers OPTIONAL) @@ -47,6 +49,53 @@ else() include(${QT_USE_FILE}) endif() +#----------------------------------------------------------------------------- +# Installation (https://github.com/forexample/package-example) +include(GNUInstallDirs) +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +install(DIRECTORY doc/html/ DESTINATION ${CMAKE_INSTALL_DOCDIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/UseQtSOAP.cmake DESTINATION ${config_install_dir}) + +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") +set(version_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake") +set(project_config "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake") +set(targets_export_name "${PROJECT_NAME}Targets") +set(namespace "${PROJECT_NAME}::") + +# Include module with function 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Configure 'ConfigVersion.cmake' +# Use: +# * PROJECT_VERSION +write_basic_package_version_file( + "${version_config}" COMPATIBILITY SameMajorVersion +) + +# Configure 'Config.cmake' +# Use variables: +# * targets_export_name +# * PROJECT_NAME +configure_package_config_file( + "QtSOAPConfig.cmake.in" + "${project_config}" + INSTALL_DESTINATION "${config_install_dir}" + NO_CHECK_REQUIRED_COMPONENTS_MACRO +) + + + +install( + FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}" +) + +install( + EXPORT "${targets_export_name}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}" +) + #----------------------------------------------------------------------------- # Subdirectories # diff --git a/QtSOAPConfig.cmake.in b/QtSOAPConfig.cmake.in index 20118aa..fc4eaba 100644 --- a/QtSOAPConfig.cmake.in +++ b/QtSOAPConfig.cmake.in @@ -21,39 +21,6 @@ # # QtSOAPConfig.cmake - QtSOAP CMake configuration file for external projects. # +@PACKAGE_INIT@ -SET(QtSOAP_LIBRARIES @PROJECT_NAME@) - -# The QtSOAP include file directories. -SET(QtSOAP_INCLUDE_DIRS "@QtSOAP_INCLUDE_DIRS_CONFIG@") - -# The QtSOAP library directories. Note that if -# QtSOAP_CONFIGURATION_TYPES is set (see below) then these directories -# will be the parent directories under which there will be a directory -# of runtime binaries for each configuration type. -SET(QtSOAP_LIBRARY_DIRS "@QtSOAP_LIBRARY_DIRS_CONFIG@") - -# The QtSOAP runtime library directories. Note that if -# QtSOAP_CONFIGURATION_TYPES is set (see below) then these directories -# will be the parent directories under which there will be a directory -# of runtime libraries for each configuration type. -SET(QtSOAP_RUNTIME_LIBRARY_DIRS "@QtSOAP_RUNTIME_LIBRARY_DIRS_CONFIG@") - -# The location of the UseQtSOAP.cmake file. -SET(QtSOAP_USE_FILE "@QtSOAP_USE_FILE@") - - -# A QtSOAP install tree always provides one build configuration. -# A QtSOAP build tree may provide either one or multiple build -# configurations depending on the CMake generator used. -# Since QtSOAP can be used either from a build tree or an install -# tree it is useful for outside projects to know the configurations available. -# If this QtSOAPConfig.cmake is in a QtSOAP install -# tree QtSOAP_CONFIGURATION_TYPES will be empty and -# QtSOAP_BUILD_TYPE will be set to the value of -# CMAKE_BUILD_TYPE used to build QtSOAP. If QtSOAPConfig.cmake -# is in a QtSOAP build tree then QtSOAP_CONFIGURATION_TYPES -# and QtSOAP_BUILD_TYPE will have values matching CMAKE_CONFIGURATION_TYPES -# and CMAKE_BUILD_TYPE for that build tree (only one will ever be set). -SET(QtSOAP_CONFIGURATION_TYPES @QtSOAP_CONFIGURATION_TYPES_CONFIG@) -SET(QtSOAP_BUILD_TYPE @QtSOAP_BUILD_TYPE_CONFIG@) +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0641667..7aeee1b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,23 @@ SET(KIT_MOC_SRCS qtsoap.h ) +set(KIT_HEADERS + qtsoap.h + QtSoapTypeFactory + QtSoapTypeConstructorBase + QtSoapTypeConstructor + QtSoapType + QtSoapStructIterator + QtSoapStruct + QtSoapSimpleType + QtSoapQName + QtSoapNamespaces + QtSoapMessage + QtSoapHttpTransport + QtSoapArrayIterator + QtSoapArray + ) + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} @@ -36,6 +53,12 @@ TARGET_LINK_LIBRARIES( ${libname} ${${PROJECT_NAME}_LINK_LIBRARIES} ) +target_include_directories( + ${libname} + PUBLIC + $ + $ + ) #----------------------------------------------------------------------------- # @@ -45,3 +68,13 @@ TARGET_LINK_LIBRARIES( IF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" ) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fPIC") ENDIF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" ) + +install( + TARGETS ${PROJECT_NAME} + EXPORT ${targets_export_name} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +install(FILES ${KIT_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})