forked from olipfei/cbvcs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
108 lines (90 loc) · 3.67 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#Generated by CBProjectExporter : https://github.com/josephch/CBProjectExporter
cmake_minimum_required(VERSION 3.24.0)
project("unix_libgit2")
set(TARGET_OUTPUTNAME "cbvcs")
# Include CMakePrintHelpers module:
include(CMakePrintHelpers)
# -------------------------------------------------------------------------------------------------
# Compiler flags:
find_package(PkgConfig REQUIRED)
pkg_check_modules(CODEBLOCKS REQUIRED codeblocks)
include_directories("${CODEBLOCKS_INCLUDE_DIRS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CODEBLOCKS_CFLAGS_OTHER}")
find_package(wxWidgets REQUIRED)
include(${wxWidgets_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
pkg_check_modules(LIBGIT2 REQUIRED libgit2)
include_directories("${LIBGIT2_INCLUDE_DIRS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBGIT2_CFLAGS_OTHER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
# Compiler Definitions:
add_definitions(-DUSE_LIBGIT2)
# -------------------------------------------------------------------------------------------------
# Source files to compile:
FILE(GLOB SOURCE_FILES
"CommitMsgDialog.cpp"
"IVersionControlSystem.cpp"
"VcsFileItem.cpp"
"VcsFileOp.cpp"
"VcsProject.cpp"
"VcsTreeItem.cpp"
"cbvcs.cpp"
"git_libgit2.cpp"
"git_libgit2_ops.cpp"
"shellutilimpl.cpp"
"vcsfactory.cpp"
"vcsprojecttracker.cpp"
"vcstrackermap.cpp"
"CommitMsgDialog.h"
"IVersionControlSystem.h"
"VcsFileItem.h"
"VcsFileOp.h"
"VcsProject.h"
"VcsTreeItem.h"
"cbvcs.h"
"copyprotector.h"
"git_libgit2.h"
"git_libgit2_ops.h"
"shellutilimpl.h"
"vcsfactory.h"
"vcsprojecttracker.h"
"vcstrackermap.h"
)
# Target type: ttDynamicLib - DLL
add_library(${TARGET_OUTPUTNAME} SHARED ${SOURCE_FILES})
# Set the target output directory:
set_target_properties(${TARGET_OUTPUTNAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/")
set_target_properties(${TARGET_OUTPUTNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/")
unset(SOURCE_FILES)
# -------------------------------------------------------------------------------------------------
# Linker options:
set(LINKER_OPTIONS_LIST)
list(APPEND LINKER_OPTIONS_LIST "${CODEBLOCKS_LINK_LIBRARIES}")
list(APPEND LINKER_OPTIONS_LIST "${wxWidgets_LIBRARIES}")
list(APPEND LINKER_OPTIONS_LIST "${LIBGIT2_LINK_LIBRARIES}")
target_link_libraries(${TARGET_OUTPUTNAME} PRIVATE ${LINKER_OPTIONS_LIST})
unset(LINKER_OPTIONS_LIST)
# Target after commands:
# zip -j9 cbvcs.zip manifest.xml
add_custom_command(
TARGET ${TARGET_OUTPUTNAME}
POST_BUILD COMMAND zip -j9 cbvcs.zip manifest.xml
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# cp -f libcbvcs.so cbvcs.so
add_custom_command(
TARGET ${TARGET_OUTPUTNAME}
POST_BUILD COMMAND cp -f libcbvcs.so cbvcs.so
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
# zip -j9 cbvcs.cbplugin cbvcs.so cbvcs.zip
add_custom_command(
TARGET ${TARGET_OUTPUTNAME}
POST_BUILD COMMAND zip -j9 cbvcs.cbplugin cbvcs.so cbvcs.zip
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
unset(TARGET_OUTPUTNAME)
# -------------------------------------------------------------------------------------------------