Skip to content

Commit 2f912b5

Browse files
committed
Modernize CMake code
Auto-generate CMake config files, etc. First public target: KDev::IMakeBuilder (library interface)
1 parent 29a6d0b commit 2f912b5

14 files changed

+76
-70
lines changed

CMakeLists.txt

+21-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ include(ECMSetupVersion)
1919
include(ECMAddTests)
2020
include(ECMMarkNonGuiExecutable)
2121
include(ECMGenerateHeaders)
22+
include(ECMPackageConfigHelpers)
2223

24+
include(CTest)
2325
include(GenerateExportHeader)
2426
include(CMakePackageConfigHelpers)
2527
include(FeatureSummary)
@@ -80,7 +82,6 @@ include_directories(${KDevelop_SOURCE_DIR} ${KDevelop_BINARY_DIR} )
8082
# create config.h
8183
configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
8284

83-
add_subdirectory(cmake)
8485
add_subdirectory(pics)
8586
add_subdirectory(app)
8687
add_subdirectory(formatters)
@@ -94,10 +95,27 @@ add_subdirectory(kdeintegration)
9495
add_subdirectory(utils)
9596
add_subdirectory(file_templates)
9697
add_subdirectory(providers)
97-
9898
add_subdirectory(doc)
9999

100-
include(CTest)
100+
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDevelop")
101+
ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDevelopConfig.cmake.in"
102+
"${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake"
103+
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
104+
)
105+
ecm_setup_version(${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH}
106+
VARIABLE_PREFIX KDEVELOP
107+
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h"
108+
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake"
109+
SOVERSION ${KDEVELOP_LIB_SOVERSION}
110+
)
111+
install(FILES
112+
"${CMAKE_CURRENT_BINARY_DIR}/kdevelop_version.h"
113+
DESTINATION "${KDE_INSTALL_INCLUDEDIR}/kdevelop")
114+
install(FILES
115+
"${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfig.cmake"
116+
"${CMAKE_CURRENT_BINARY_DIR}/KDevelopConfigVersion.cmake"
117+
DESTINATION "${CMAKECONFIG_INSTALL_DIR}" )
118+
install(EXPORT KDevelopTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" NAMESPACE KDev:: FILE KDevelopTargets.cmake)
101119

102120
# CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
103121
# in the KDE build system, this is the same as CMAKE_BINARY_DIR.

KDevelopConfig.cmake.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/KDevelopTargets.cmake")

cmake/CMakeLists.txt

-3
This file was deleted.

cmake/modules/CMakeLists.txt

-4
This file was deleted.

cmake/modules/KDevelopConfig.cmake

-34
This file was deleted.

projectbuilders/cmakebuilder/CMakeLists.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
project(cmakebuilder)
21
add_definitions(-DTRANSLATION_DOMAIN=\"kdevcmakebuilder\")
32
include_directories(
4-
${cmakebuilder_SOURCE_DIR}
53
${KDevelop_SOURCE_DIR}/projectmanagers/cmake
64
)
75

@@ -21,11 +19,13 @@ kdevplatform_add_plugin(kdevcmakebuilder JSON kdevcmakebuilder.json SOURCES ${cm
2119
target_link_libraries(
2220
kdevcmakebuilder
2321
kdevcmakecommon
24-
KF5::KIOWidgets
2522

26-
KDev::Interfaces
27-
KDev::OutputView
28-
KDev::Util
29-
KDev::Shell
30-
KDev::Project
23+
KF5::KIOWidgets
24+
25+
KDev::Interfaces
26+
KDev::OutputView
27+
KDev::Util
28+
KDev::Shell
29+
KDev::Project
30+
KDev::IMakeBuilder
3131
)

projectbuilders/cmakebuilder/cmakebuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <interfaces/iplugincontroller.h>
3333
#include <project/interfaces/ibuildsystemmanager.h>
3434
#include <project/builderjob.h>
35-
#include <projectbuilders/makebuilder/imakebuilder.h>
35+
#include <makebuilder/imakebuilder.h>
3636

3737
#include <kpluginfactory.h>
3838
#include <kpluginloader.h>

projectbuilders/makebuilder/CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ target_link_libraries(kdevmakebuilder
2323
KDev::Shell
2424
)
2525

26+
install(FILES imakebuilder.h DESTINATION ${INCLUDE_INSTALL_DIR}/kdevelop/makebuilder COMPONENT Devel)
2627

27-
########### install files ###############
28-
#install(TARGETS kdevmakebuilder DESTINATION ${PLUGIN_INSTALL_DIR}/kdevplatform/${KDEV_PLUGIN_VERSION} )
29-
install(FILES imakebuilder.h DESTINATION ${INCLUDE_INSTALL_DIR}/kdevelop/make COMPONENT Devel)
30-
#configure_file(kdevmakebuilder.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdevmakebuilder.desktop)
31-
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kdevmakebuilder.desktop DESTINATION ${SERVICES_INSTALL_DIR})
32-
# install( FILES kdevmakebuilder.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kdevmakebuilder )
28+
add_library(KDevIMakeBuilder INTERFACE)
29+
add_library(KDev::IMakeBuilder ALIAS KDevIMakeBuilder)
30+
target_include_directories(KDevIMakeBuilder INTERFACE
31+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>"
32+
"$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/kdevelop>"
33+
)
34+
set_target_properties(KDevIMakeBuilder PROPERTIES
35+
EXPORT_NAME IMakeBuilder
36+
)
37+
install(TARGETS KDevIMakeBuilder EXPORT KDevelopTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

projectbuilders/qmakebuilder/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ target_link_libraries(kdevqmakebuilder
1414
KDev::OutputView
1515
KDev::Util
1616
KDev::Project
17+
KDev::IMakeBuilder
1718
kdevqmakecommon
1819
)
1920

projectbuilders/qmakebuilder/debug.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*************************************************************************************
2+
* Copyright (C) 2015 Kevin Funk <[email protected]> *
3+
* *
4+
* This program is free software; you can redistribute it and/or *
5+
* modify it under the terms of the GNU General Public License *
6+
* as published by the Free Software Foundation; either version 2 *
7+
* of the License, or (at your option) any later version. *
8+
* *
9+
* This program is distributed in the hope that it will be useful, *
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12+
* GNU General Public License for more details. *
13+
* *
14+
* You should have received a copy of the GNU General Public License *
15+
* along with this program; if not, write to the Free Software *
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17+
*************************************************************************************/
18+
19+
#ifndef DEBUG_H
20+
#define DEBUG_H
21+
22+
#include <QLoggingCategory>
23+
24+
Q_DECLARE_LOGGING_CATEGORY(KDEV_QMAKE)
25+
26+
#endif // DEBUG_H

projectbuilders/qmakebuilder/qmakebuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <interfaces/icore.h>
3333
#include <interfaces/iplugincontroller.h>
3434
#include <outputview/ioutputview.h>
35-
#include <projectbuilders/makebuilder/imakebuilder.h>
35+
#include <makebuilder/imakebuilder.h>
3636
#include <util/commandexecutor.h>
3737

3838
#include <kpluginfactory.h>

projectbuilders/qmakebuilder/qmakejob.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <outputview/ioutputview.h>
2929
#include <outputview/outputmodel.h>
3030
#include <project/projectmodel.h>
31-
#include <projectbuilders/makebuilder/imakebuilder.h>
31+
#include <makebuilder/imakebuilder.h>
3232
#include <util/commandexecutor.h>
3333
#include <util/path.h>
3434

projectmanagers/custommake/CMakeLists.txt

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
project(custommakemanager)
21
add_definitions(-DTRANSLATION_DOMAIN=\"kdevcustommake\")
3-
include_directories(
4-
${makebuilder_SOURCE_DIR}
5-
)
6-
7-
8-
########### next target ###############
92

103
set(kdevcustommakemanager_PART_SRCS
114
custommakemanager.cpp
@@ -14,7 +7,8 @@ set(kdevcustommakemanager_PART_SRCS
147

158
kdevplatform_add_plugin(kdevcustommakemanager JSON kdevcustommakemanager.json SOURCES ${kdevcustommakemanager_PART_SRCS})
169
target_link_libraries(kdevcustommakemanager
17-
KF5::KIOWidgets KDev::Interfaces KDev::Project KDev::Util KDev::Language
10+
KF5::KIOWidgets
11+
KDev::Interfaces KDev::Project KDev::Util KDev::Language KDev::IMakeBuilder
1812
kdevmakefileresolver
1913
)
2014

projectmanagers/custommake/custommakemanager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <interfaces/iproject.h>
1616
#include <interfaces/iprojectcontroller.h>
1717
#include <interfaces/iplugincontroller.h>
18-
#include "imakebuilder.h"
18+
#include <makebuilder/imakebuilder.h>
1919
#include <kpluginfactory.h>
2020
#include <kaboutdata.h>
2121
#include <kpluginloader.h>

0 commit comments

Comments
 (0)