diff --git a/CMakeLists.txt b/CMakeLists.txt index dc57d1c7e..9b4369e11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,285 +1,284 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) find_package(ECM 1.8.0 REQUIRED NOMODULE) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(SetKexiCMakePolicies NO_POLICY_SCOPE) include(SetKexiVersionInfo) project(Kexi VERSION ${PROJECT_VERSION}) include(KexiAddTests) -include(KexiAddExamples) kexi_add_tests(OFF) -kexi_add_examples(OFF) # ECM include(ECMAddAppIcon) include(ECMAddTests) include(ECMGenerateHeaders) include(ECMInstallIcons) include(ECMMarkAsTest) include(ECMMarkNonGuiExecutable) include(ECMPoQmTools) include(ECMSetupVersion) include(KDEInstallDirs) include(KDECMakeSettings NO_POLICY_SCOPE) include(KDECompilerSettings NO_POLICY_SCOPE) # Own include(KexiMacros) include(KexiAddIconsRccFile) include(KexiGenerateDependencyGraph) ensure_out_of_source_build("Please refer to the build instruction https://community.kde.org/Kexi/Building") get_git_revision_and_branch() detect_release_build() ####################### ######################## ## Productset setting ## ######################## ####################### # For predefined productsets see the definitions in KexiProducts.cmake and # in the files in the folder cmake/productsets. # Finding out the products & features to build is done in 5 steps: # 1. have the user define the products/features wanted, by giving a productset # 2. estimate all additional required products/features # 3. estimate which of the products/features can be build by external deps # 4. find which products/features have been temporarily disabled due to problems # 5. estimate which of the products/features can be build by internal deps # get the special macros include(CalligraProductSetMacros) set(PRODUCTSET_DEFAULT "DESKTOP") if(NOT PRODUCTSET OR PRODUCTSET STREQUAL "ALL") # Force the default set also when it is "ALL" because we can't build both desktop and mobile set(PRODUCTSET ${PRODUCTSET_DEFAULT} CACHE STRING "Set of products/features to build" FORCE) endif() # get the definitions of products, features and product sets include(KexiProducts.cmake) if (RELEASE_BUILD) set(KEXI_SHOULD_BUILD_STAGING FALSE) else () set(KEXI_SHOULD_BUILD_STAGING TRUE) endif () # finally choose products/features to build calligra_set_productset(${PRODUCTSET}) ########################## ########################### ## Look for Qt, KF5 ## ########################### ########################## set(REQUIRED_KF5_VERSION 5.16.0) set(REQUIRED_KF5_COMPONENTS Archive Codecs Config ConfigWidgets CoreAddons GuiAddons I18n IconThemes ItemViews WidgetsAddons TextWidgets XmlGui ) if(SHOULD_BUILD_KEXI_DESKTOP_APP) list(APPEND REQUIRED_KF5_COMPONENTS Completion KIO TextEditor TextWidgets ) endif() find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED COMPONENTS ${REQUIRED_KF5_COMPONENTS}) find_package(KF5 ${REQUIRED_KF5_VERSION} COMPONENTS Crash) macro_bool_to_01(KF5Crash_FOUND HAVE_KCRASH) set_package_properties(KF5Crash PROPERTIES TYPE OPTIONAL PURPOSE "Used to provide crash reporting on Linux") set(REQUIRED_QT_VERSION 5.4.0) find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets Xml Network PrintSupport Test) find_package(Qt5 ${REQUIRED_QT_VERSION} COMPONENTS UiTools WebKit WebKitWidgets) # use sane compile flags add_definitions( -DQT_NO_CAST_TO_ASCII -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER ) -# only with COMPILING_TESTS definition will all the FOO_TEST_EXPORT macros do something -# TODO: check if this can be moved to only those places which make use of it, -# to reduce global compiler definitions that would trigger a recompile of -# everything on a change (like adding/removing tests to/from the build) -macro_bool_to_01(BUILD_TESTING COMPILING_TESTS) - # overcome some platform incompatibilities if(WIN32) find_package(KDEWin REQUIRED) endif() # set custom Kexi plugin installdir set(KEXI_PLUGIN_INSTALL_DIR ${PLUGIN_INSTALL_DIR}/${KEXI_BASE_PATH}) +simple_option(BUILD_EXAMPLES "Build and install examples" ON) + +macro_bool_to_01(BUILD_EXAMPLES COMPILING_EXAMPLES) + +# set custom Kexi examples installdir +set(KEXI_EXAMPLES_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/examples/${KEXI_BASE_PATH}) + # TEMPORARY: for initial Qt5/KF5 build porting phase deprecation warnings are only annoying noise # remove once code porting phase starts, perhaps first locally in product subdirs #if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC) # add_definitions(-Wno-deprecated -Wno-deprecated-declarations) #endif () ########################### ############################ ## Required dependencies ## ############################ ########################### set(KEXI_LIBS_MIN_VERSION 3.0.94) ## ## Test for KDb ## simple_option(KEXI_DEBUG_GUI "Debugging GUI for Kexi (requires KDB_DEBUG_GUI to be set too)" OFF) if(KEXI_DEBUG_GUI) set(KDB_REQUIRED_COMPONENTS DEBUG_GUI) endif() find_package(KDb ${KEXI_LIBS_MIN_VERSION} REQUIRED COMPONENTS ${KDB_REQUIRED_COMPONENTS}) set_package_properties(KDb PROPERTIES TYPE REQUIRED PURPOSE "Required by Kexi for data handling") ## ## Test for KReport ## find_package(KReport ${KEXI_LIBS_MIN_VERSION}) set_package_properties(KReport PROPERTIES TYPE REQUIRED PURPOSE "Required by Kexi for report handling") if (KReport_FOUND) if(NOT KREPORT_SCRIPTING) message(FATAL_ERROR "Kexi requires KReport package with scripting support enabled (KREPORT_SCRIPTING)") endif() endif() ## ## Test for KPropertyWidgets ## if(SHOULD_BUILD_KEXI_DESKTOP_APP) find_package(KPropertyWidgets ${KEXI_LIBS_MIN_VERSION} REQUIRED COMPONENTS KF) set_package_properties(KPropertyWidgets PROPERTIES TYPE REQUIRED PURPOSE "Required by Kexi for handling properties") else() # only KPropertyCore find_package(KPropertyCore ${KEXI_LIBS_MIN_VERSION} REQUIRED COMPONENTS KF) set_package_properties(KPropertyCore PROPERTIES TYPE REQUIRED PURPOSE "Required by Kexi for handling properties") endif() include(CheckIfQtGuiCanBeExecuted) if(SHOULD_BUILD_KEXI_DESKTOP_APP) include(CheckGlobalBreezeIcons) endif() ########################### ############################ ## Optional dependencies ## ############################ ########################### ## ## Test for marble ## set(MARBLE_MIN_VERSION "0.19.2") find_package(KexiMarble ${MARBLE_MIN_VERSION}) set_package_properties(KexiMarble PROPERTIES DESCRIPTION "KDE World Globe Widget library" URL "https://marble.kde.org" TYPE RECOMMENDED PURPOSE "Required by Kexi form map widget" ) if(NOT MARBLE_FOUND) set(MARBLE_INCLUDE_DIR "") else() set(HAVE_MARBLE TRUE) endif() set_package_properties(GLIB2 PROPERTIES TYPE RECOMMENDED PURPOSE "${_REQUIRED_BY_MDB}") ## ## Test for Qt WebKitWidgets ## #TODO switch to Qt WebEngine macro_bool_to_01(Qt5WebKitWidgets_FOUND HAVE_QTWEBKITWIDGETS) set_package_properties(Qt5WebKit PROPERTIES DESCRIPTION "Webkit for Qt, the HTML engine." URL "http://qt.io" TYPE RECOMMENDED PURPOSE "Required by Kexi web form widget" ) set_package_properties(Qt5WebKitWidgets PROPERTIES DESCRIPTION "QWidgets module for Webkit, the HTML engine." URL "http://qt.io" TYPE RECOMMENDED PURPOSE "Required by Kexi web form widget" ) ################## ################### ## Helper macros ## ################### ################## include(MacroKexiAddBenchmark) include(MacroKexiAddTest) ############################################# #### Temporarily broken products #### ############################################# # If a product does not build due to some temporary brokeness disable it here, # by calling calligra_disable_product with the product id and the reason, # e.g.: # calligra_disable_product(APP_KEXI "isn't buildable at the moment") ############################################# #### Calculate buildable products #### ############################################# calligra_drop_unbuildable_products() ############################################# #### Setup product-depending vars #### ############################################# ################### #################### ## Subdirectories ## #################### ################### add_subdirectory(src) if(SHOULD_BUILD_DOC) find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS DocTools) add_subdirectory(doc) endif() # non-app directories are moved here because they can depend on SHOULD_BUILD_{appname} variables set above add_subdirectory(cmake) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ki18n_install(po) endif() calligra_product_deps_report("product_deps") calligra_log_should_build() feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/cmake/modules/KexiAddExamples.cmake b/cmake/modules/KexiAddExamples.cmake deleted file mode 100644 index a90e635e8..000000000 --- a/cmake/modules/KexiAddExamples.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Additional CMake macros -# -# Copyright (C) 2015-2017 Jarosław Staniek -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -if(__kexi_add_examples) - return() -endif() -set(__kexi_add_examples YES) - -include(KexiAddSimpleOption) - -# Adds BUILD_EXAMPLES option to enable examples. If enabled, build in examples/ subdirectory -# is enabled. If optional argument ARG1 is ON, building examples will be ON by default. -# Otherwise building examples will be OFF. ARG1 is OFF by default. -macro(kexi_add_examples) - set(_SET ${ARGV0}) - if (NOT "${_SET}" STREQUAL ON) - set(_SET OFF) - endif() - simple_option(BUILD_EXAMPLES "Build example applications" ${_SET}) - if (BUILD_EXAMPLES AND EXISTS ${CMAKE_SOURCE_DIR}/examples) - add_subdirectory(examples) - endif() -endmacro() diff --git a/cmake/modules/KexiAddTests.cmake b/cmake/modules/KexiAddTests.cmake index 5210020ad..e8b8d9311 100644 --- a/cmake/modules/KexiAddTests.cmake +++ b/cmake/modules/KexiAddTests.cmake @@ -1,37 +1,44 @@ # Additional CMake macros # # Copyright (C) 2015-2017 Jarosław Staniek # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # # Note: the file must be included before KDEInstallDirs or add_tests() won't fully work if(__kexi_add_tests) return() endif() set(__kexi_add_tests YES) include(KexiAddSimpleOption) +include(MacroBoolTo01) # Adds BUILD_TESTING option to enable all kinds of tests. If enabled, build in autotests/ # and tests/ subdirectory is enabled. If optional argument ARG1 is ON, building tests will # be ON by default. Otherwise building tests will be OFF. ARG1 is OFF by default. # If tests are OFF, BUILD_COVERAGE is set to OFF. # If tests are on BUILD_TESTING macro is defined. macro(kexi_add_tests) if(KDE_INSTALL_TARGETS_DEFAULT_ARGS) message(FATAL_ERROR "Include before KDEInstallDirs!") endif() if (NOT "${ARG1}" STREQUAL "ON") set(_SET OFF) endif() simple_option(BUILD_TESTING "Build tests" ${_SET}) # override default from CTest.cmake if(BUILD_TESTING) add_definitions(-DBUILD_TESTING) include(CTest) else() set(BUILD_COVERAGE OFF) simple_option(BUILD_COVERAGE "Build test coverage (disabled because BUILD_TESTING is OFF)" OFF) endif() + + # only with COMPILING_TESTS definition will all the FOO_TEST_EXPORT macros do something + # TODO: check if this can be moved to only those places which make use of it, + # to reduce global compiler definitions that would trigger a recompile of + # everything on a change (like adding/removing tests to/from the build) + macro_bool_to_01(BUILD_TESTING COMPILING_TESTS) endmacro() diff --git a/cmake/modules/KexiMacros.cmake b/cmake/modules/KexiMacros.cmake index 0116d7684..ae7966385 100644 --- a/cmake/modules/KexiMacros.cmake +++ b/cmake/modules/KexiMacros.cmake @@ -1,229 +1,242 @@ # Additional CMake macros # # Copyright (C) 2015-2018 Jarosław Staniek # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if(__kexi_macros) return() endif() set(__kexi_macros YES) #unused: include(KDbCreateSharedDataClasses) # from KDb include(CheckFunctionExists) include(GenerateExportHeader) include(GetGitRevisionDescription) include(MacroBoolTo01) include(KexiAddSimpleOption) string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(COMPARE EQUAL "${CMAKE_CXX_COMPILER_ID}" "Clang" CMAKE_COMPILER_IS_CLANG) # Keep apps in the same bin dir so resources that are kept relative to this dir can be found # without installing. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") macro(ensure_out_of_source_build _extra_message) string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _isBuildInSource) if(isBuildInSource) message(FATAL_ERROR "Compiling ${PROJECT_NAME} inside the source directory is not possible. " "${_extra_message}") endif() unset(_isBuildInSource) endmacro() # Sets RELEASE_BUILD to TRUE for release builds macro(detect_release_build) if(NOT DEFINED RELEASE_BUILD) # estimate mode by CMAKE_BUILD_TYPE content if not set on cmdline string(TOLOWER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE_TOLOWER) set(_RELEASE_BUILD_TYPES "release" "relwithdebinfo" "minsizerel") list(FIND _RELEASE_BUILD_TYPES "${CMAKE_BUILD_TYPE_TOLOWER}" INDEX) if (INDEX EQUAL -1) set(RELEASE_BUILD FALSE) else() set(RELEASE_BUILD TRUE) endif() unset(_RELEASE_BUILD_TYPES) unset(_CMAKE_BUILD_TYPE_TOLOWER) endif() endmacro() if(WIN32) set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS} ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} ) set(DATA_INSTALL_DIR "$ENV{APPDATA}") STRING(REGEX REPLACE "\\\\" "/" DATA_INSTALL_DIR ${DATA_INSTALL_DIR}) # Install own icons to CMAKE_INSTALL_FULL_ICONDIR (relative to bin/data/ on Windows) on Windows. # We're consistent because icons from breeze-icons.git are installed there as well. set(ICONS_INSTALL_DIR "${CMAKE_INSTALL_FULL_ICONDIR}/${KEXI_BASE_PATH}") else() # On other OSes install own icons in app's data dir set(ICONS_INSTALL_DIR "${DATA_INSTALL_DIR}/${KEXI_BASE_PATH}/icons") endif() # Fetches git revision and branch from the source dir of the current build if possible. # Sets ${PROJECT_NAME_UPPER}_GIT_SHA1_STRING and ${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING variables. # If git information is not available but ${CMAKE_SOURCE_DIR}/GIT_VERSION file exists, # it is parsed. This file can be created by scripts while preparing tarballs and is # supposed to contain two lines: hash and branch. macro(get_git_revision_and_branch) set(${PROJECT_NAME_UPPER}_GIT_SHA1_STRING "") set(${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING "") get_git_head_revision(GIT_REFSPEC ${PROJECT_NAME_UPPER}_GIT_SHA1_STRING) get_git_branch(${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING) if(NOT ${PROJECT_NAME_UPPER}_GIT_SHA1_STRING OR NOT ${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING) if(EXISTS "${CMAKE_SOURCE_DIR}/GIT_VERSION") file(READ "${CMAKE_SOURCE_DIR}/GIT_VERSION" _ver) string(REGEX REPLACE "\n" ";" _ver "${_ver}") list(GET _ver 0 ${PROJECT_NAME_UPPER}_GIT_SHA1_STRING) list(GET _ver 1 ${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING) endif() endif() if(${PROJECT_NAME_UPPER}_GIT_SHA1_STRING OR ${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING) string(SUBSTRING ${${PROJECT_NAME_UPPER}_GIT_SHA1_STRING} 0 7 ${PROJECT_NAME_UPPER}_GIT_SHA1_STRING) else() set(${PROJECT_NAME_UPPER}_GIT_SHA1_STRING "") set(${PROJECT_NAME_UPPER}_GIT_BRANCH_STRING "") endif() endmacro() # Adds ${PROJECT_NAME_UPPER}_UNFINISHED option. If it is ON, unfinished features # (useful for testing but may confuse end-user) are compiled-in. # This option is OFF by default. macro(add_unfinished_features_option) simple_option(${PROJECT_NAME_UPPER}_UNFINISHED "Include unfinished features (useful for testing but may confuse end-user)" OFF) endmacro() # Adds commands that generate ${_filename}${KEXI_DISTRIBUTION_VERSION}.pc file # out of ${_filename}.pc.cmake file and installs the .pc file to ${LIB_INSTALL_DIR}/pkgconfig. # These commands are not executed for WIN32. # ${CMAKE_SOURCE_DIR}/${_filename}.pc.cmake should exist. macro(add_pc_file _filename) if (NOT WIN32) set(_name ${_filename}${KEXI_DISTRIBUTION_VERSION}) configure_file(${CMAKE_SOURCE_DIR}/${_filename}.pc.cmake ${CMAKE_BINARY_DIR}/${_name}.pc @ONLY) install(FILES ${CMAKE_BINARY_DIR}/${_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) endif() endmacro() # Sets detailed version information for library co-installability. # - adds PROJECT_STABLE_VERSION_MAJOR to the lib name # - sets VERSION to PROJECT_STABLE_VERSION_MAJOR.PROJECT_STABLE_VERSION_MINOR.PROJECT_STABLE_VERSION_RELEASE # - sets SOVERSION to KEXI_DISTRIBUTION_VERSION # - sets OUTPUT_NAME to ${_target}${KEXI_DISTRIBUTION_VERSION} # - sets ${_target_upper}_BASE_NAME variable to the final lib name # - sets ${_target_upper}_BASE_NAME_LOWER variable to the final lib name, lowercase # - sets ${_target_upper}_INCLUDE_INSTALL_DIR to include dir for library headers # - (where _target_upper is uppercase ${_target} macro(set_coinstallable_lib_version _target) set(_name ${_target}${KEXI_DISTRIBUTION_VERSION}) set(_version "${PROJECT_STABLE_VERSION_MAJOR}.${PROJECT_STABLE_VERSION_MINOR}.${PROJECT_STABLE_VERSION_RELEASE}") set(_soversion ${KEXI_DISTRIBUTION_VERSION}) set_target_properties(${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} EXPORT_NAME ${_target} OUTPUT_NAME ${_name} ) string(TOUPPER ${_target} _target_upper) string(TOUPPER ${_target_upper}_BASE_NAME _var) set(${_var} ${_name}) string(TOLOWER ${_name} ${_var}_LOWER) set(${_target_upper}_INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/${_name}) unset(_soversion) unset(_version) unset(_target_upper) unset(_var) endmacro() # Combines add_library() with set_coinstallable_lib_version() macro(kexi_add_library) set(args ${ARGV}) list(GET args 0 _target) add_library(${args}) set_coinstallable_lib_version(${_target}) unset(_target) endmacro() # Sets detailed version information for executable co-installability. # - sets OUTPUT_NAME to ${_target}-${KEXI_DISTRIBUTION_VERSION} macro(set_coinstallable_executable_version _target) set_target_properties(${_target} PROPERTIES OUTPUT_NAME ${_target}-${KEXI_DISTRIBUTION_VERSION} ) endmacro() # Combines add_executable() with set_coinstallable_executable_version() macro(kexi_add_executable) set(args ${ARGV}) list(GET args 0 _target) add_executable(${args}) set_coinstallable_executable_version(${_target}) unset(_target) endmacro() # Adds custom target that updates given file in the current working dir using specified # command and adds its source files to the project files. # The target is not executed by default, if dependencies to/from other targets are needed # they can be set separately using add_dependencies(). # Execution of the command shows status "Updating ". # Options: # TARGET - name of the new custom target # FILE - - name of the file that is updated using the command # COMMAND [args...] - command to be executed # SOURCES [files...] - source files that are used by the command function(add_update_file_target) set(options) set(oneValueArgs TARGET FILE) set(multiValueArgs COMMAND SOURCES) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_custom_target(${ARG_TARGET} COMMAND ${ARG_COMMAND} SOURCES ${ARG_SOURCES} DEPENDS ${ARG_SOURCES} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Updating ${ARG_FILE}" VERBATIM ) endfunction() if(UNIX) # TODO: implement for WIN32 set(_chmod_name chmod) find_program(kexi_chmod_program ${_chmod_name} DOC "chmod program") if(kexi_chmod_program) message(STATUS "Found program for changing file permissions: ${kexi_chmod_program}") else() message(WARNING "Could not find \"${_chmod_name}\" program for changing file permissions") endif() endif() # Sets file or directory read-only for all (non-root) users. -# The _path should exist. +# The _path should exist. If it is not absolute, ${CMAKE_CURRENT_SOURCE_DIR} path is prepended. # TODO: implement for WIN32 macro(kexi_set_file_read_only _path) if(NOT kexi_chmod_program) return() endif() - if(NOT EXISTS ${_path}) - message(FATAL_ERROR "File or directory \"${_path}\" does not exist") + if(IS_ABSOLUTE ${_path}) + set(_fullpath ${_path}) + else() + set(_fullpath ${CMAKE_CURRENT_SOURCE_DIR}/${_path}) + endif() + if(NOT EXISTS ${_fullpath}) + message(FATAL_ERROR "File or directory \"${_fullpath}\" does not exist") return() endif() - set(_command "${kexi_chmod_program}" a-w "${_path}") + set(_command "${kexi_chmod_program}" a-w "${_fullpath}") execute_process( COMMAND ${_command} RESULT_VARIABLE _result OUTPUT_VARIABLE _output ERROR_VARIABLE _output ) if(NOT _result EQUAL 0) message(FATAL_ERROR "Command failed (${_result}): ${_command}\n\nOutput:\n${_output}") endif() endmacro() + +# Adds example KEXI project (.kexi file) +# - sets it read-only +# - installs to SHARE/examples/VERSION/ +macro(kexi_add_example_project _path) + kexi_set_file_read_only(${_path}) + install(FILES ${_path} DESTINATION ${KEXI_EXAMPLES_INSTALL_DIR}) +endmacro() diff --git a/src/config-kexi.h.cmake b/src/config-kexi.h.cmake index e8e81bd9e..9367860bb 100644 --- a/src/config-kexi.h.cmake +++ b/src/config-kexi.h.cmake @@ -1,136 +1,140 @@ /* This file is part of the KDE project Copyright (C) 2006-2016 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXI_CONFIG_H #define KEXI_CONFIG_H /* config-kexi.h. Generated by cmake from config-kexi.h.cmake */ /*! @file config-kexi.h Global Kexi configuration (build time) */ #include //! @def KEXI_DESKTOP //! @brief If defined, a desktop version of Kexi is compiled #cmakedefine KEXI_DESKTOP //! @def KEXI_MOBILE //! @brief If defined, a mobile version of Kexi is compiled #cmakedefine KEXI_MOBILE /* define if you have libreadline available */ /* TODO: detect #define HAVE_READLINE 1 */ //! @def HAVE_UNAME //! @brief If defined, uname(2) is available #cmakedefine HAVE_UNAME 1 /*! For KexiUtils::encoding() */ #cmakedefine01 HAVE_LANGINFO_H //! @def HAVE_KCRASH //! @brief if defined, KCrash is available #cmakedefine HAVE_KCRASH //! @def HAVE_MARBLE //! @brief if defined, Marble widget library is available #cmakedefine HAVE_MARBLE //! @def HAVE_QTWEBKITWIDGETS //! @brief if defined, QtWebKit widgets library is available #cmakedefine HAVE_QTWEBKITWIDGETS //! @def COMPILING_TESTS //! @brief if defined, tests are enabled #cmakedefine COMPILING_TESTS +//! @def COMPILING_EXAMPLES +//! @brief if defined, examples are enabled and installed +#cmakedefine COMPILING_EXAMPLES + //! @def KEXI_DEBUG_GUI //! @brief If defined, a debugging GUI for Kexi is enabled #cmakedefine KEXI_DEBUG_GUI #if defined KEXI_DEBUG_GUI && !defined KDB_DEBUG_GUI # error KEXI_DEBUG_GUI requires a KDB_DEBUG_GUI cmake option to be set too in KDb. #endif //! @def KEXI_MIGRATEMANAGER_DEBUG //! @brief Defined if debugging for the migrate driver manager is enabled #cmakedefine KEXI_MIGRATEMANAGER_DEBUG /* -- Experimental -- */ //! @def KEXI_SCRIPTS_SUPPORT //! @brief If defined, scripting GUI plugin is enabled in Kexi #cmakedefine KEXI_SCRIPTS_SUPPORT //! @def KEXI_MACROS_SUPPORT //! @brief If defined, macro GUI plugin is enabled in Kexi #cmakedefine KEXI_MACROS_SUPPORT //! @def KEXI_SHOW_UNFINISHED //! @brief If defined unfinished features are enabled and presented in Kexi. //! This is useful for testing but may confuse end-users. #cmakedefine KEXI_SHOW_UNFINISHED //! @def KEXI_SHOW_UNIMPLEMENTED //! @brief If defined show menu entries and dialogs just to give impression about development plans for Kexi //! Only recommended for test/development versions. #cmakedefine KEXI_SHOW_UNIMPLEMENTED //! @def KEXI_PROJECT_TEMPLATES //! @brief If defined, support for project templates is enabled in Kexi #cmakedefine KEXI_PROJECT_TEMPLATES //! @def KEXI_AUTORISE_TABBED_TOOLBAR //! @brief If defined, tabs in the main tabbed toolbar autorise in Kexi #cmakedefine KEXI_AUTORISE_TABBED_TOOLBAR //! @def KEXI_USE_KFILEWIDGET //! @brief If defined, KFileWidget-based inline file browser is used in Kexi. Otherwise a simple //! replacement file widget with native file dialogs is used. ON by default on UNIX, OFF by default //! on Windows and macOS. //! @note Non-plasma Linux desktops still default to the simple replacement at runtime. #cmakedefine KEXI_USE_KFILEWIDGET //! @def KEXI_FORM_CURSOR_PROPERTY_SUPPORT //! @brief If defined, "cursor" property is displayed in the form designer #cmakedefine KEXI_FORM_CURSOR_PROPERTY_SUPPORT //! @def KEXI_SHOW_CONTEXT_HELP //! @brief If defined, context help is displayed in Kexi main window #cmakedefine KEXI_SHOW_CONTEXT_HELP //! @def KEXI_QUICK_PRINTING_SUPPORT //! @brief If defined, print/print preview/print setup for tables/queries is enabled in the project navigator #cmakedefine KEXI_QUICK_PRINTING_SUPPORT //! @def KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT //! @brief If defined, "auto field" form widget is available in the form designer #cmakedefine KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT //! @def KEXI_LIST_FORM_WIDGET_SUPPORT //! @brief If defined, "list" form widget is available in the form designer #cmakedefine KEXI_LIST_FORM_WIDGET_SUPPORT //! @def KEXI_PIXMAP_COLLECTIONS_SUPPORT //! @brief If defined, support for pixmap collections is enabled #cmakedefine KEXI_PIXMAP_COLLECTIONS_SUPPORT #endif diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index fae637725..8d0362446 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -1 +1 @@ -kexi_set_file_read_only("${CMAKE_CURRENT_SOURCE_DIR}/Simple_Database.kexi") +kexi_add_example_project(Simple_Database.kexi)