diff --git a/CMakeLists.txt b/CMakeLists.txt index c1009478f..7f5e29932 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,174 +1,179 @@ cmake_minimum_required(VERSION 2.8.12) # kdevplatform version set(KDEVPLATFORM_VERSION_MAJOR 5) set(KDEVPLATFORM_VERSION_MINOR 1) set(KDEVPLATFORM_VERSION_PATCH 1) # plugin versions listed in the .desktop files set(KDEV_PLUGIN_VERSION 27) # Increase this to reset incompatible item-repositories set(KDEV_ITEMREPOSITORY_VERSION 86) # library version / SO version set(KDEVPLATFORM_LIB_VERSION 10.0.0) set(KDEVPLATFORM_LIB_SOVERSION 10) project(KDevPlatform) # we need some parts of the ECM CMake helpers find_package (ECM 0.0.9 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${KDevPlatform_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMAddTests) include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMMarkAsTest) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) include(ECMPackageConfigHelpers) include(GenerateExportHeader) include(FeatureSummary) include(WriteBasicConfigVersionFile) include(CheckFunctionExists) include(KDEInstallDirs) include(KDECMakeSettings) include(KDevPlatformMacros) set(QT_MIN_VERSION "5.4.0") find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Widgets WebKitWidgets Concurrent Test) +if(BUILD_TESTING) + find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) +endif() find_package(Qt5QuickWidgets ${QT_MIN_VERSION}) set_package_properties(Qt5QuickWidgets PROPERTIES PURPOSE "Qt5 QuickWidgets library (part of Qt >=5.3). Required for the Welcome Page plugin." ) set(KF5_DEP_VERSION "5.18.0") # need KAboutData::fromPluginMetaData in kcoreaddons find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Archive Config GuiAddons WidgetsAddons IconThemes I18n ItemModels ItemViews JobWidgets KCMUtils KIO NewStuff Notifications NotifyConfig Parts Service Sonnet TextEditor ThreadWeaver WindowSystem Declarative XmlGui ) find_package(Grantlee5) set_package_properties(Grantlee5 PROPERTIES PURPOSE "Grantlee templating library, needed for file templates" URL "http://www.grantlee.org/" TYPE RECOMMENDED) set(Boost_ADDITIONAL_VERSIONS 1.39.0 1.39) find_package(Boost 1.35.0) set_package_properties(Boost PROPERTIES PURPOSE "Boost libraries for enabling the classbrowser" URL "http://www.boost.org" TYPE REQUIRED) add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050400 -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS ) # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {} # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html check_cxx_compiler_flag(-Wno-missing-field-initializers HAVE_MFI_FLAG) check_cxx_compiler_flag(-Werror=undefined-bool-conversion HAVE_UBC_FLAG) check_cxx_compiler_flag(-Werror=tautological-undefined-compare HAVE_TUC_FLAG) if (HAVE_MFI_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers") endif() if (HAVE_UBC_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=undefined-bool-conversion") endif() if (HAVE_TUC_FLAG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=tautological-undefined-compare") endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdocumentation") endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-kdevplatform.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevplatform.h ) include_directories(${KDevPlatform_SOURCE_DIR} ${KDevPlatform_BINARY_DIR}) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "") set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) else() set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) endif() add_subdirectory(sublime) add_subdirectory(interfaces) add_subdirectory(project) add_subdirectory(language) add_subdirectory(shell) add_subdirectory(util) add_subdirectory(outputview) add_subdirectory(vcs) add_subdirectory(pics) add_subdirectory(debugger) add_subdirectory(documentation) add_subdirectory(serialization) add_subdirectory(template) -add_subdirectory(tests) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() add_subdirectory(plugins) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevPlatform") ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevPlatformConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ecm_setup_version(${KDEVPLATFORM_VERSION_MAJOR}.${KDEVPLATFORM_VERSION_MINOR}.${KDEVPLATFORM_VERSION_PATCH} VARIABLE_PREFIX KDEVPLATFORM VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevplatform_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevPlatformConfigVersion.cmake" SOVERSION ${KDEVPLATFORM_LIB_SOVERSION}) install( FILES "${KDevPlatform_BINARY_DIR}/kdevplatform_version.h" "${KDevPlatform_BINARY_DIR}/config-kdevplatform.h" DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevplatform" ) install( FILES "${KDevPlatform_BINARY_DIR}/KDevPlatformConfig.cmake" "${KDevPlatform_BINARY_DIR}/KDevPlatformConfigVersion.cmake" cmake/modules/KDevPlatformMacros.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" ) install( EXPORT KDevPlatformTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevPlatformTargets.cmake ) # CTestCustom.cmake has to be in the CTEST_BINARY_DIR. # in the KDE build system, this is the same as CMAKE_BINARY_DIR. configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/plugins/filetemplates/CMakeLists.txt b/plugins/filetemplates/CMakeLists.txt index a79eef2e5..0a0b78ffe 100644 --- a/plugins/filetemplates/CMakeLists.txt +++ b/plugins/filetemplates/CMakeLists.txt @@ -1,92 +1,93 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdevfiletemplates\") set(kdevfiletemplates_PART_SRCS templatepreview.cpp templatepreviewtoolview.cpp filetemplatesplugin.cpp classidentifierpage.cpp classmemberspage.cpp defaultcreateclasshelper.cpp licensepage.cpp outputpage.cpp overridespage.cpp templateclassassistant.cpp templateoptionspage.cpp templateselectionpage.cpp testcasespage.cpp debug.cpp ) ki18n_wrap_ui(kdevfiletemplates_PART_SRCS templatepreviewtoolview.ui ui/licensechooser.ui ui/newclass.ui ui/outputlocation.ui ui/overridevirtuals.ui ui/templateselection.ui ui/testcases.ui ) qt5_add_resources(kdevfiletemplates_PART_SRCS kdevfiletemplates.qrc) kdevplatform_add_plugin(kdevfiletemplates JSON kdevfiletemplates.json SOURCES ${kdevfiletemplates_PART_SRCS}) target_link_libraries(kdevfiletemplates KDev::Interfaces KDev::Language KDev::Project KDev::Util KF5::NewStuff KF5::TextEditor KF5::ItemModels ) ########### install files ############### install(FILES licenses/GPL\ v2 licenses/GPL\ v3 licenses/LGPL\ v2 licenses/LGPL\ v3 licenses/Apache\ v2 licenses/BSD licenses/Boost licenses/MIT\ X11 licenses/Mozilla\ v1.1 "licenses/LGPL v2+ (KDE)" "licenses/GPL v2+ (KDE)" DESTINATION ${KDE_INSTALL_DATADIR}/kdevcodegen/licenses ) ################ set(test_srcs main.cpp templatepreview.cpp classidentifierpage.cpp classmemberspage.cpp defaultcreateclasshelper.cpp licensepage.cpp outputpage.cpp overridespage.cpp templateclassassistant.cpp templateoptionspage.cpp templateselectionpage.cpp testcasespage.cpp debug.cpp ) -add_executable(testfiletemplates ${test_srcs}) -add_dependencies(testfiletemplates kdevfiletemplates) +if(BUILD_TESTING) + add_executable(testfiletemplates ${test_srcs}) + add_dependencies(testfiletemplates kdevfiletemplates) + target_link_libraries(testfiletemplates + KDev::Interfaces + KDev::Language + KDev::Project + KDev::Util + KDev::Tests + KF5::NewStuff + ) -target_link_libraries(testfiletemplates - KDev::Interfaces - KDev::Language - KDev::Project - KDev::Util - KDev::Tests - KF5::NewStuff -) - -add_subdirectory(tests) + add_subdirectory(tests) +endif() diff --git a/plugins/quickopen/tests/CMakeLists.txt b/plugins/quickopen/tests/CMakeLists.txt index a85b6c92f..24d586dc4 100644 --- a/plugins/quickopen/tests/CMakeLists.txt +++ b/plugins/quickopen/tests/CMakeLists.txt @@ -1,12 +1,15 @@ -add_library(quickopentestbase STATIC - quickopentestbase.cpp - ../projectfilequickopen.cpp) +if(BUILD_TESTING) + add_library(quickopentestbase STATIC + quickopentestbase.cpp + ../projectfilequickopen.cpp) + + target_link_libraries(quickopentestbase PUBLIC + Qt5::Test KF5::IconThemes KDev::Tests KDev::Project KDev::Language) +endif() -target_link_libraries(quickopentestbase PUBLIC - Qt5::Test KF5::IconThemes KDev::Tests KDev::Project KDev::Language) ecm_add_test(test_quickopen.cpp LINK_LIBRARIES quickopentestbase) if(NOT COMPILER_OPTIMIZATIONS_DISABLED) ecm_add_test(bench_quickopen.cpp LINK_LIBRARIES quickopentestbase) set_tests_properties(bench_quickopen PROPERTIES TIMEOUT 30) endif() diff --git a/project/CMakeLists.txt b/project/CMakeLists.txt index 2e6fe7dbd..7a69523b8 100644 --- a/project/CMakeLists.txt +++ b/project/CMakeLists.txt @@ -1,71 +1,73 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdevplatform\") set(KDevPlatformProject_LIB_SRCS projectutils.cpp projectmodel.cpp projectchangesmodel.cpp projectconfigskeleton.cpp importprojectjob.cpp builderjob.cpp projectbuildsetmodel.cpp projectitemlineedit.cpp helper.cpp debug.cpp projectproxymodel.cpp abstractfilemanagerplugin.cpp filemanagerlistjob.cpp projectfiltermanager.cpp interfaces/iprojectbuilder.cpp interfaces/iprojectfilemanager.cpp interfaces/ibuildsystemmanager.cpp interfaces/iprojectfilter.cpp interfaces/iprojectfilterprovider.cpp widgets/dependencieswidget.cpp ) ki18n_wrap_ui( KDevPlatformProject_LIB_SRCS widgets/dependencieswidget.ui) kdevplatform_add_library(KDevPlatformProject SOURCES ${KDevPlatformProject_LIB_SRCS}) target_link_libraries(KDevPlatformProject LINK_PUBLIC KDev::Interfaces KDev::Util # util/path.h LINK_PRIVATE KDev::Interfaces KDev::Serialization KDev::Vcs KF5::KIOWidgets Qt5::Concurrent ) -add_subdirectory(tests) +if(BUILD_TESTING) + add_subdirectory(tests) +endif() install(FILES interfaces/iprojectbuilder.h interfaces/iprojectfilemanager.h interfaces/ibuildsystemmanager.h interfaces/iprojectfilter.h interfaces/iprojectfilterprovider.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/project/interfaces COMPONENT Devel ) install(FILES projectutils.h importprojectjob.h projectchangesmodel.h projectconfigskeleton.h projectmodel.h projectconfigpage.h projectitemlineedit.h projectbuildsetmodel.h builderjob.h helper.h abstractfilemanagerplugin.h projectfiltermanager.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/project COMPONENT Devel ) install(FILES widgets/dependencieswidget.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/project/widgets COMPONENT Devel ) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 7df5f3499..4b01796ac 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -1,94 +1,96 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdevplatform\") ########### next target ############### set(KDevPlatformUtil_LIB_SRCS autoorientedsplitter.cpp foregroundlock.cpp formattinghelpers.cpp richtextpushbutton.cpp kdevstringhandler.cpp focusedtreeview.cpp processlinemaker.cpp commandexecutor.cpp environmentselectionwidget.cpp environmentselectionmodel.cpp environmentgrouplist.cpp jobstatus.cpp activetooltip.cpp executecompositejob.cpp shellutils.cpp multilevellistview.cpp objectlist.cpp placeholderitemproxymodel.cpp projecttestjob.cpp widgetcolorizer.cpp path.cpp debug.cpp texteditorhelpers.cpp stack.cpp ) set (KDevPlatformUtil_LIB_UI runoptions.ui ) if(NOT WIN32) add_subdirectory(dbus_socket_transformer) endif() -add_subdirectory(duchainify) +if(BUILD_TESTING) + add_subdirectory(duchainify) # needs KDev::Tests +endif() add_subdirectory(tests) ki18n_wrap_ui(KDevPlatformUtil_LIB_SRCS ${KDevPlatformUtil_LIB_US}) kdevplatform_add_library(KDevPlatformUtil SOURCES ${KDevPlatformUtil_LIB_SRCS}) target_link_libraries(KDevPlatformUtil LINK_PUBLIC KDev::Interfaces KF5::ItemModels LINK_PRIVATE KF5::ConfigWidgets KF5::TextEditor KF5::GuiAddons ) install( FILES kdevplatform_shell_environment.sh DESTINATION bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ) add_executable(kdev_format_source kdevformatsource.cpp kdevformatfile.cpp) ecm_mark_nongui_executable(kdev_format_source) target_link_libraries(kdev_format_source Qt5::Core) install(TARGETS kdev_format_source DESTINATION ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES .zshrc PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SHARE_INSTALL_PREFIX}/kdevplatform/shellutils/) ########### install files ############### install( FILES autoorientedsplitter.h foregroundlock.h formattinghelpers.h richtextpushbutton.h kdevstringhandler.h ksharedobject.h focusedtreeview.h activetooltip.h processlinemaker.h commandexecutor.h environmentselectionwidget.h environmentgrouplist.h jobstatus.h pushvalue.h kdevvarlengtharray.h embeddedfreetree.h executecompositejob.h convenientfreelist.h multilevellistview.h objectlist.h placeholderitemproxymodel.h projecttestjob.h widgetcolorizer.h path.h stack.h ${CMAKE_CURRENT_BINARY_DIR}/utilexport.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/util COMPONENT Devel)