Commit 1f99e93d authored by Wouter Haffmans's avatar Wouter Haffmans
Browse files

Build system install rules and target exports

Also makes the include directories better, instead of depending on the
exact location in this build tree
parent f3c13e41
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -14,10 +14,44 @@ find_package(Qt5Widgets)

add_definitions(-DQT_USE_QSTRINGBUILDER)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
# Determine installation path for CMake files
if(WIN32 AND NOT CYGWIN)
    set(INSTALL_CMAKE_DIR CMake)
else()
    set(INSTALL_CMAKE_DIR lib/cmake/QJsonIntrospect)
endif()


# Version information
set(QJsonIntrospect_MAJOR_VERSION 1)
set(QJsonIntrospect_MINOR_VERSION 0)
set(QJsonIntrospect_PATCH_VERSION 0)
set(QJsonIntrospect_VERSION
  ${QJsonIntrospect_MAJOR_VERSION}.${QJsonIntrospect_MINOR_VERSION}.${QJsonIntrospect_PATCH_VERSION})

add_subdirectory(grantlee)

add_subdirectory(lib)
add_subdirectory(gui)
add_subdirectory(cli)

include(CMakePackageConfigHelpers)
set(QJsonIntrospect_BINARY_PATH "bin/qjsonintrospect-cli${CMAKE_EXECUTABLE_SUFFIX}")
configure_package_config_file(QJsonIntrospectConfig.cmake.in
  "${PROJECT_BINARY_DIR}/QJsonIntrospectConfig.cmake"
  PATH_VARS QJsonIntrospect_BINARY_PATH
  INSTALL_DESTINATION "${INSTALL_CMAKE_DIR}")
write_basic_package_version_file("${PROJECT_BINARY_DIR}/QJsonIntrospectVersion.cmake" VERSION ${QJsonIntrospect_VERSION} COMPATIBILITY SameMajorVersion)

install(
    FILES
        "${PROJECT_BINARY_DIR}/QJsonIntrospectConfig.cmake"
        "${PROJECT_BINARY_DIR}/QJsonIntrospectVersion.cmake"
    DESTINATION ${INSTALL_CMAKE_DIR}
    COMPONENT dev)

install(EXPORT QJsonIntrospectTargets
  DESTINATION "${INSTALL_CMAKE_DIR}"
  COMPONENT dev
)
+38 −0
Original line number Diff line number Diff line
# - Config file for the LibDbpf package
#
# Once done, this will define:
#   LibDbpf_FOUND - system has LibDbpf
#   LibDbpf_INCLUDE_DIRS - the LibDbpf include directory
#   LibDbpf_LIBRARY - LibDbpf library
#   LibDbpf_PLUGIN_PATH - Plugin installation path
#   LibDbpf_CMAKE_UTILS - Path to the CMake utilities file (LibDbpfUtils.cmake)
#
# Copyright (C) 2014-2015 Wouter Haffmans <wouter@simply-life.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

set(QJsonIntrospect_VERSION "@QJsonIntrospect_VERSION@")

@PACKAGE_INIT@

# Find dependencies
find_package(Qt5Core REQUIRED)

include(${CMAKE_CURRENT_LIST_DIR}/QJsonIntrospectTargets.cmake)

# These are IMPORTED targets created by LibDbpfTargets.cmake
get_target_property(QJsonIntrospect_EXECUTABLE qjsonintrospect-cli LOCATION)
set(QJsonIntrospect_LIBRARY qjsonintrospect)
get_target_property(QJsonIntrospect_INCLUDE_DIRS qjsonintrospect INTERFACE_INCLUDE_DIRECTORIES)
+14 −2
Original line number Diff line number Diff line
include_directories(${CMAKE_CURRENT_BINARY_DIR})
project(qjsonintrospect-cli)
cmake_minimum_required(VERSION 3.0)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(QJsonIntrospect_CLI_SRCS
    introspectorcli.cpp
@@ -7,4 +11,12 @@ set(QJsonIntrospect_CLI_SRCS

add_executable(qjsonintrospect-cli ${QJsonIntrospect_CLI_SRCS})
target_link_libraries(qjsonintrospect-cli
  Qt5::Core Grantlee5::Templates qjsonintrospect)
  qjsonintrospect
  Grantlee5::Templates
)

install(TARGETS qjsonintrospect-cli
    EXPORT QJsonIntrospectTargets
    RUNTIME DESTINATION bin
    COMPONENT app
)
+3 −3
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
#include "cli/introspectorcli.h"
#include "introspectorcli.h"

#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
@@ -26,8 +26,8 @@
#include <QtCore/QCommandLineParser>
#include <QtCore/QCommandLineOption>

#include "lib/introspector.h"
#include <lib/config.h>
#include <introspector.h>
#include <config.h>

using namespace QJsonIntrospect;

+1 −1
Original line number Diff line number Diff line
#include <QtCore/QCoreApplication>
#include <QtCore/QTimer>

#include "cli/introspectorcli.h"
#include "introspectorcli.h"


int main(int argc, char** argv)
Loading