in middle of ProjectConfig installation
This commit is contained in:
@@ -7,7 +7,11 @@ PROJECT(QtPropertyBrowser)
|
||||
SET (PROJECT_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake)
|
||||
SET (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_CMAKE_DIR}")
|
||||
|
||||
# Add custom Compile Settings and flags
|
||||
INCLUDE(CompileSettings)
|
||||
|
||||
# Add custom Install Settings
|
||||
INCLUDE(InstallSettings)
|
||||
|
||||
##################### Look for required libraries ######################
|
||||
|
||||
@@ -17,25 +21,23 @@ IF (NOT QT_FOUND)
|
||||
MESSAGE(FATAL "We Need some QT")
|
||||
ENDIF()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Subdirectories
|
||||
#
|
||||
######################### Add Primary Targets ##########################
|
||||
ADD_SUBDIRECTORY(src)
|
||||
|
||||
########################## Add the Examples ############################
|
||||
OPTION (BUILD_EXAMPLES "Build Examples" ON)
|
||||
IF(BUILD_EXAMPLES)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ENDIF()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generate QtPropertyBrowserConfig file
|
||||
#
|
||||
CONFIGURE_FILE(UseQtPropertyBrowser.cmake.in
|
||||
${QtPropertyBrowser_BINARY_DIR}/UseQtPropertyBrowser.cmake COPYONLY)
|
||||
|
||||
INCLUDE(GenerateQtPropertyBrowserConfig.cmake)
|
||||
######################### Installation Stuff ###########################
|
||||
INCLUDE(InstallProjectConfig)
|
||||
|
||||
###################### Add uninstall target ############################
|
||||
ADD_CUSTOM_TARGET(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_CMAKE_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
##################### Show Configuration Summary ######################
|
||||
MESSAGE(STATUS "===============================================================")
|
||||
MESSAGE(STATUS "================ Configuration Summary ======================")
|
||||
MESSAGE(STATUS "Project Name: ${PROJECT_NAME}")
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Library: CTK
|
||||
#
|
||||
# Copyright (c) Kitware Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.commontk.org/LICENSE
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Settings shared between the build tree and install tree.
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Settings specific to the build tree.
|
||||
|
||||
# The "use" file.
|
||||
SET(QtPropertyBrowser_USE_FILE ${QtPropertyBrowser_BINARY_DIR}/UseQtPropertyBrowser.cmake)
|
||||
|
||||
# Determine the include directories needed.
|
||||
SET(QtPropertyBrowser_INCLUDE_DIRS_CONFIG
|
||||
${QtPropertyBrowser_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Library directory.
|
||||
SET(QtPropertyBrowser_LIBRARY_DIRS_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
|
||||
# Runtime library directory.
|
||||
SET(QtPropertyBrowser_RUNTIME_LIBRARY_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
# Build configuration information.
|
||||
SET(QtPropertyBrowser_CONFIGURATION_TYPES_CONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
SET(QtPropertyBrowser_BUILD_TYPE_CONFIG ${CMAKE_BUILD_TYPE})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure QtPropertyBrowserConfig.cmake for the build tree.
|
||||
CONFIGURE_FILE(${QtPropertyBrowser_SOURCE_DIR}/QtPropertyBrowserConfig.cmake.in
|
||||
${QtPropertyBrowser_BINARY_DIR}/QtPropertyBrowserConfig.cmake @ONLY IMMEDIATE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Settings specific to the install tree.
|
||||
|
||||
# TODO
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure QtPropertyBrowserConfig.cmake for the install tree.
|
||||
|
||||
# TODO
|
||||
@@ -1,60 +0,0 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Library: CTK
|
||||
#
|
||||
# Copyright (c) Kitware Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.commontk.org/LICENSE
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# QtPropertyBrowserConfig.cmake - QtPropertyBrowser CMake configuration file for external projects.
|
||||
#
|
||||
# This file is configured by QtPropertyBrowser and used by the
|
||||
# UseQtPropertyBrowser.cmake module to load QtPropertyBrowser's settings
|
||||
# for an external project.
|
||||
|
||||
# The QtPropertyBrowser include file directories.
|
||||
SET(QtPropertyBrowser_INCLUDE_DIRS "@QtPropertyBrowser_INCLUDE_DIRS_CONFIG@")
|
||||
|
||||
# The QtPropertyBrowser library directories. Note that if
|
||||
# QtPropertyBrowser_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(QtPropertyBrowser_LIBRARY_DIRS "@QtPropertyBrowser_LIBRARY_DIRS_CONFIG@")
|
||||
|
||||
# The QtPropertyBrowser runtime library directories. Note that if
|
||||
# QtPropertyBrowser_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(QtPropertyBrowser_RUNTIME_LIBRARY_DIRS "@QtPropertyBrowser_RUNTIME_LIBRARY_DIRS_CONFIG@")
|
||||
|
||||
# The location of the UseQtPropertyBrowser.cmake file.
|
||||
SET(QtPropertyBrowser_USE_FILE "@QtPropertyBrowser_USE_FILE@")
|
||||
|
||||
|
||||
# A QtPropertyBrowser install tree always provides one build configuration.
|
||||
# A QtPropertyBrowser build tree may provide either one or multiple build
|
||||
# configurations depending on the CMake generator used.
|
||||
# Since QtPropertyBrowser 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 QtPropertyBrowserConfig.cmake is in a QtPropertyBrowser install
|
||||
# tree QtPropertyBrowser_CONFIGURATION_TYPES will be empty and
|
||||
# QtPropertyBrowser_BUILD_TYPE will be set to the value of
|
||||
# CMAKE_BUILD_TYPE used to build QtPropertyBrowser. If QtPropertyBrowserConfig.cmake
|
||||
# is in a QtPropertyBrowser build tree then QtPropertyBrowser_CONFIGURATION_TYPES
|
||||
# and QtPropertyBrowser_BUILD_TYPE will have values matching CMAKE_CONFIGURATION_TYPES
|
||||
# and CMAKE_BUILD_TYPE for that build tree (only one will ever be set).
|
||||
SET(QtPropertyBrowser_CONFIGURATION_TYPES @QtPropertyBrowser_CONFIGURATION_TYPES_CONFIG@)
|
||||
SET(QtPropertyBrowser_BUILD_TYPE @QtPropertyBrowser_BUILD_TYPE_CONFIG@)
|
||||
@@ -1,36 +0,0 @@
|
||||
###########################################################################
|
||||
#
|
||||
# Library: CTK
|
||||
#
|
||||
# Copyright (c) Kitware Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.commontk.org/LICENSE
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# This module is provided as QtPropertyBrowser_USE_FILE by QtPropertyBrowserConfig.cmake.
|
||||
# It can be INCLUDED in a project to load the needed compiler and linker
|
||||
# settings to use QtPropertyBrowser.
|
||||
#
|
||||
|
||||
IF(NOT QtPropertyBrowser_USE_FILE_INCLUDED)
|
||||
SET(QtPropertyBrowser_USE_FILE_INCLUDED 1)
|
||||
|
||||
# Add include directories needed to use QtPropertyBrowser.
|
||||
INCLUDE_DIRECTORIES(${QtPropertyBrowser_INCLUDE_DIRS})
|
||||
|
||||
# Add link directories needed to use QtPropertyBrowser.
|
||||
LINK_DIRECTORIES(${QtPropertyBrowser_LIBRARY_DIRS})
|
||||
|
||||
ENDIF()
|
||||
68
cmake/CompileSettings.cmake
Normal file
68
cmake/CompileSettings.cmake
Normal file
@@ -0,0 +1,68 @@
|
||||
######################### COMPILE SETTINGS ################################
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
MESSAGE(STATUS "===============================================================")
|
||||
MESSAGE(STATUS "============ Configuring CompileSettings =====================")
|
||||
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native -funroll-loops -ffast-math")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -march=native -funroll-loops")
|
||||
|
||||
OPTION (USE_PEDANTIC_FLAGS "Use Pedantic Flags in GCC" ON)
|
||||
IF(USE_PEDANTIC_FLAGS)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long -Wno-variadic-macros")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wno-long-long -Wno-variadic-macros")
|
||||
ENDIF()
|
||||
|
||||
OPTION (USE_DEBUG_SYMBOLS "Use Debug Symbols" OFF)
|
||||
IF(USE_DEBUG_SYMBOLS)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g")
|
||||
ENDIF()
|
||||
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
IF(NOT MSVC)
|
||||
OPTION (USE_CPP_11 "Use C++11 Compiler" ON)
|
||||
IF(USE_CPP_11)
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
ELSE()
|
||||
SET(USE_CPP_11 OFF)
|
||||
MESSAGE(STATUS "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
SET(CMAKE_BUILD_TYPE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
ELSEIF(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
SET(CMAKE_BUILD_TYPE_FLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
|
||||
SET(CMAKE_BUILD_TYPE_FLAGS ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
ENDIF()
|
||||
|
||||
OPTION (USE_OpenMP "Use OpenMP" ON)
|
||||
IF(USE_OpenMP)
|
||||
FIND_PACKAGE(OpenMP)
|
||||
IF(OPENMP_FOUND)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "===============================================================")
|
||||
19
cmake/InstallProjectConfig.cmake
Normal file
19
cmake/InstallProjectConfig.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
###################### InstallProjectConfig ###########################
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
INSTALL_DESTINATION ${INSTALL_CMAKE_DIR}
|
||||
PATH_VARS INSTALL_INCLUDE_DIR
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(EXPORT ${PROJECT_NAME}Targets
|
||||
DESTINATION ${INSTALL_CMAKE_DIR}
|
||||
)
|
||||
31
cmake/InstallSettings.cmake
Normal file
31
cmake/InstallSettings.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
###################### Installation Settings ###########################
|
||||
|
||||
# Set a local folder for default installation when CMAKE_INSTALL_PREFIX is NOT specified
|
||||
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
IF(WIN32)
|
||||
SET(DEFAULT_INSTALL_PATH "$ENV{HOMEDRIVE}/${PROJECT_NAME}" )
|
||||
ELSE()
|
||||
SET(DEFAULT_INSTALL_PATH "$ENV{HOME}/local")
|
||||
ENDIF()
|
||||
SET(CMAKE_INSTALL_PREFIX "${DEFAULT_INSTALL_PATH}" CACHE PATH "${PROJECT_NAME} install prefix" FORCE)
|
||||
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
|
||||
# Offer the user the choice of overriding the installation directories
|
||||
SET(INSTALL_LIB_DIR lib CACHE PATH "Install dir for libraries")
|
||||
SET(INSTALL_BIN_DIR bin CACHE PATH "Install dir for executables")
|
||||
SET(INSTALL_INCLUDE_DIR include/${PROJECT_NAME} CACHE PATH "Install dir for headers")
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
SET(DEF_INSTALL_CMAKE_DIR CMake)
|
||||
ELSE()
|
||||
SET(DEF_INSTALL_CMAKE_DIR lib/CMake/${PROJECT_NAME})
|
||||
ENDIF()
|
||||
SET(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Install dir for CMake files")
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
FOREACH(p LIB BIN INCLUDE CMAKE)
|
||||
SET(var INSTALL_${p}_DIR)
|
||||
IF(NOT IS_ABSOLUTE "${${var}}")
|
||||
SET(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
13
cmake/QtPropertyBrowserConfig.cmake.in
Normal file
13
cmake/QtPropertyBrowserConfig.cmake.in
Normal file
@@ -0,0 +1,13 @@
|
||||
# Config file for the QtPropertyBrowser package
|
||||
# It defines the following variables
|
||||
# QtPropertyBrowser_FOUND - standard CMake Package found indicator
|
||||
# QtPropertyBrowser_INCLUDE_DIRS - include directories for QtPropertyBrowser
|
||||
# QtPropertyBrowser_DEFINITIONS - Definitions needed to build with QtPropertyBrowser
|
||||
# QtPropertyBrowser_LIBRARIES - Libraries needed to build with QtPropertyBrowser
|
||||
|
||||
|
||||
set (QtPropertyBrowser_FOUND true)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
set_and_check (QtPropertyBrowser_INCLUDE_DIRS "@PACKAGE_INSTALL_INCLUDE_DIR@")
|
||||
|
||||
38
cmake/cmake_uninstall.cmake
Normal file
38
cmake/cmake_uninstall.cmake
Normal file
@@ -0,0 +1,38 @@
|
||||
################ CMake Uninstall Template #######################
|
||||
# CMake Template file for uninstallation of files
|
||||
# mentioned in 'install_manifest.txt'
|
||||
#
|
||||
# Used by uinstall target
|
||||
#################################################################
|
||||
|
||||
MESSAGE(STATUS "======================================================")
|
||||
MESSAGE(STATUS "================ Uninstalling ======================")
|
||||
|
||||
SET(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
|
||||
|
||||
IF(NOT EXISTS ${MANIFEST})
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'")
|
||||
ENDIF()
|
||||
|
||||
FILE(STRINGS ${MANIFEST} files)
|
||||
FOREACH(file ${files})
|
||||
IF(EXISTS ${file})
|
||||
MESSAGE(STATUS "Removing file: '${file}'")
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${file}
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Failed to remove file: '${file}'.")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(STATUS "File '${file}' does not exist.")
|
||||
ENDIF()
|
||||
ENDFOREACH(file)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,116 +1,75 @@
|
||||
# Tell CMake to run moc when necessary:
|
||||
#set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# As moc files are generated in the binary dir, tell CMake
|
||||
# to always look for includes there:
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
SET(KIT_SRCS
|
||||
set(_SRCS
|
||||
qtbuttonpropertybrowser.cpp
|
||||
qtbuttonpropertybrowser.h
|
||||
qteditorfactory.cpp
|
||||
qteditorfactory.h
|
||||
qtgroupboxpropertybrowser.cpp
|
||||
qtgroupboxpropertybrowser.h
|
||||
qtpropertybrowser.cpp
|
||||
qtpropertybrowser.h
|
||||
qtpropertybrowserutils.cpp
|
||||
qtpropertybrowserutils_p.h
|
||||
qtpropertymanager.cpp
|
||||
qtpropertymanager.h
|
||||
qttreepropertybrowser.cpp
|
||||
qttreepropertybrowser.h
|
||||
qtvariantproperty.cpp
|
||||
qtvariantproperty.h
|
||||
)
|
||||
|
||||
SET(KIT_MOC_SRCS
|
||||
qtpropertybrowserutils_p.h
|
||||
file(GLOB _IMPL_HDRS *.h)
|
||||
file(GLOB _PUBLIC_HDRS Qt*)
|
||||
|
||||
set(_UI_FORMS
|
||||
)
|
||||
|
||||
SET(KIT_UI_FORMS
|
||||
)
|
||||
|
||||
SET(KIT_resources
|
||||
set(_RESOURCES
|
||||
qtpropertybrowser.qrc
|
||||
)
|
||||
|
||||
if(QT5_FOUND)
|
||||
QT5_WRAP_UI(KIT_UI_CPP ${KIT_UI_FORMS})
|
||||
QT5_WRAP_CPP(KIT_MOC_CPP ${KIT_MOC_SRCS})
|
||||
QT5_ADD_RESOURCES(KIT_QRC_SRCS ${KIT_resources})
|
||||
ELSE()
|
||||
QT4_WRAP_UI(KIT_UI_CPP ${KIT_UI_FORMS})
|
||||
QT4_WRAP_CPP(KIT_MOC_CPP ${KIT_MOC_SRCS})
|
||||
QT4_ADD_RESOURCES(KIT_QRC_SRCS ${KIT_resources})
|
||||
ENDIF()
|
||||
QT5_WRAP_UI(_UI_SRCS ${_UI_FORMS})
|
||||
QT5_ADD_RESOURCES(_QRC_SRCS ${_RESOURCES})
|
||||
else()
|
||||
QT4_WRAP_UI(_UI_SRCS ${_UI_FORMS})
|
||||
QT4_ADD_RESOURCES(_QRC_SRCS ${_RESOURCES})
|
||||
endif()
|
||||
|
||||
ADD_LIBRARY(${PROJECT_NAME} STATIC
|
||||
${KIT_SRCS}
|
||||
${KIT_UI_CPP}
|
||||
${KIT_MOC_CPP}
|
||||
${KIT_QRC_SRCS}
|
||||
|
||||
set(TARGET_NAME ${PROJECT_NAME})
|
||||
|
||||
add_library(${TARGET_NAME} STATIC
|
||||
${_SRCS}
|
||||
${_UI_SRCS}
|
||||
${_QRC_SRCS}
|
||||
${_IMPL_HDRS}
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${QT_INCLUDE_DIRS})
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE ${QT_COMPILE_DEFS})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${QT_INCLUDE_DIRS})
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE ${QT_COMPILE_DEFS})
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
SET(${PROJECT_NAME}_LINK_LIBRARIES ${QT_TARGETS})
|
||||
TARGET_LINK_LIBRARIES(
|
||||
${PROJECT_NAME}
|
||||
${${PROJECT_NAME}_LINK_LIBRARIES}
|
||||
set(${TARGET_NAME}_LINK_LIBRARIES ${QT_TARGETS})
|
||||
target_link_libraries(
|
||||
${TARGET_NAME}
|
||||
${${TARGET_NAME}_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} ${QT_TARGETS})
|
||||
add_dependencies(${TARGET_NAME} ${QT_TARGETS})
|
||||
|
||||
# List of header that should go though moc
|
||||
SET(KIT_HEADERS_MOC_SRCS
|
||||
qtbuttonpropertybrowser.h
|
||||
qteditorfactory.h
|
||||
qtgroupboxpropertybrowser.h
|
||||
qtpropertybrowser.h
|
||||
qtpropertybrowserutils_p.h
|
||||
qtpropertymanager.h
|
||||
qttreepropertybrowser.h
|
||||
qtvariantproperty.h
|
||||
######################### Installation Stuff ###########################
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(${TARGET_NAME})
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||
PUBLIC_HEADER "${_PUBLIC_HDRS};${_IMPL_HDRS}"
|
||||
)
|
||||
|
||||
SET(KIT_MOC_CPP)
|
||||
FOREACH(file ${KIT_HEADERS_MOC_SRCS})
|
||||
get_filename_component(filename_we ${file} NAME_WE)
|
||||
SET(output_file moc_${filename_we}.cpp)
|
||||
|
||||
IF(QT5_FOUND)
|
||||
QT5_GENERATE_MOC(${file} ${output_file})
|
||||
ELSE()
|
||||
QT4_GENERATE_MOC(${file} ${output_file})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND KIT_MOC_CPP ${output_file})
|
||||
ENDFOREACH()
|
||||
|
||||
# List of cpp files that should go though moc
|
||||
SET(KIT_CPP_MOC_SRCS
|
||||
qteditorfactory.cpp
|
||||
qtpropertymanager.cpp
|
||||
qttreepropertybrowser.cpp
|
||||
install(TARGETS ${TARGET_NAME}
|
||||
EXPORT ${TARGET_NAME}Targets
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
|
||||
COMPONENT dev
|
||||
)
|
||||
|
||||
FOREACH(file ${KIT_CPP_MOC_SRCS})
|
||||
get_filename_component(filename_we ${file} NAME_WE)
|
||||
SET(output_file ${filename_we}.moc)
|
||||
|
||||
if(QT5_FOUND)
|
||||
QT5_GENERATE_MOC(${file} ${output_file})
|
||||
ELSE()
|
||||
QT4_GENERATE_MOC(${file} ${output_file})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND KIT_MOC_CPP ${output_file})
|
||||
ENDFOREACH()
|
||||
|
||||
add_custom_target(${PROJECT_NAME}GenerateMoc
|
||||
DEPENDS ${KIT_MOC_CPP}
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}GenerateMoc)
|
||||
|
||||
Reference in New Issue
Block a user