# cmake_minimum_required(VERSION 3.0) if (POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() project(SIMPLEPLUGIN) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) find_path(WORKSPACE_CMAKE_ROOT Workspace_CMake_Root.txt HINTS ${CMAKE_SOURCE_DIR} ENV WORKSPACE_CMAKE_ROOT DOC "Directory containing the Workspace_CMake_Root.txt file") if (NOT WORKSPACE_CMAKE_ROOT) message(FATAL_ERROR "Please set WORKSPACE_CMAKE_ROOT to the directory containing the file Workspace_CMake_Root.txt") endif() include( ${WORKSPACE_CMAKE_ROOT}/CMakeLists.txt NO_POLICY_SCOPE ) endif() include_directories(${SIMPLEPLUGIN_SOURCE_DIR}) if (NOT ${SIMPLEPLUGIN_SOURCE_DIR} STREQUAL ${SIMPLEPLUGIN_BINARY_DIR}) include_directories(${SIMPLEPLUGIN_BINARY_DIR}) endif() set(SIMPLEPLUGIN_VERSION 0.1.0) string(REGEX MATCH "^[0-9]+" SIMPLEPLUGIN_SOVERSION ${SIMPLEPLUGIN_VERSION}) # Add other Qt modules as required by your plugin - eg. QtNetwork, QtOpenGL, QtSql find_package(Qt5Core) find_package(Qt5Widgets) set(QT_LIBRARIES Qt5::Core;Qt5::Widgets) set(CMAKE_AUTOMOC ON) set(HEADERS ${SIMPLEPLUGIN_SOURCE_DIR}/simpleplugin_api.h ${SIMPLEPLUGIN_SOURCE_DIR}/simpleplugin.h ) set(INSTALL_HEADERS ${SIMPLEPLUGIN_SOURCE_DIR}/simpleplugin_api.h ${SIMPLEPLUGIN_SOURCE_DIR}/simpleplugin.h ) set(MOC_HEADERS ) set(SOURCES ${SIMPLEPLUGIN_SOURCE_DIR}/simpleplugin.cpp ) set(UI_SOURCES ) add_definitions(-DSIMPLEPLUGIN_VERSION=${SIMPLEPLUGIN_VERSION}) # The next line is used by the simple application generator wizard # add_subdirectory(${SIMPLEPLUGIN_SOURCE_DIR}/Application) # The below line can be used to import sub-directories include( ${SIMPLEPLUGIN_SOURCE_DIR}/Collection/CMakeLists.txt ) # qtx macros are defined in the ${WORKSPACE_CMAKE_ROOT}/CMakeLists.txt included at the top of this file # to support both Qt4 and Qt5 builds. qtx_wrap_ui(UIC_SOURCES ${UI_SOURCES}) qtx_add_resources(RES_SOURCES ${RESOURCES}) add_library(simpleplugin ${SOURCES} ${HEADERS} ${MOC_SOURCES} ${UIC_SOURCES} ${RES_SOURCES}) target_link_libraries(simpleplugin workspace ${QT_LIBRARIES}) set(SIMPLEPLUGIN_INTERFACE_INCLUDE_DIRECTORIES "include/SimplePlugin") target_include_directories(simpleplugin INTERFACE "${CSIRO_INSTALL_AREA}/${SIMPLEPLUGIN_INTERFACE_INCLUDE_DIRECTORIES}") set_target_properties(simpleplugin PROPERTIES DEFINE_SYMBOL SIMPLEPLUGIN_EXPORT VERSION ${SIMPLEPLUGIN_VERSION} SOVERSION ${SIMPLEPLUGIN_SOVERSION} ) setTargetOutputDirectory(simpleplugin ${CSIRO_INSTALL_AREA}/lib/Plugins) configure_file(pkg-simpleplugin.cmake ${CSIRO_INSTALL_AREA}/cmake/Exports/pkg-simpleplugin.cmake @ONLY) # If your plugin is dependent on any other dynamic libraries you can add the root path # of that library (the path above the lib, bin and include) to the following EXTRA_INSTALL_AREAS variable set_install_area_file(simpleplugin "${CSIRO_INSTALL_AREA}" ${EXTRA_INSTALL_AREAS}) # Copy our install headers into the install directory so that others can build against our plugin. foreach(inFile ${INSTALL_HEADERS}) string(REGEX REPLACE "(${SIMPLEPLUGIN_SOURCE_DIR}/)(.*)" "${CSIRO_INSTALL_AREA}/${SIMPLEPLUGIN_INTERFACE_INCLUDE_DIRECTORIES}/\\2" outFile "${inFile}") configure_file(${inFile} ${outFile} COPYONLY) endforeach(inFile) add_subdirectory(Designer)