Debian Codegraph @

DatabaseExplorer/CMakeLists.txt

raw
1
2
3
4 # set the plugin name here
5 set( PLUGIN_NAME "DatabaseExplorer")
6
7 # Our project is called 'plugin' this is how it will be called in
8 # visual studio, and in our makefiles.
9 project( ${PLUGIN_NAME} )
10
11 # It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
12
13
14 # wxWidgets include (this will do all the magic to configure everything)
15 include( "${wxWidgets_USE_FILE}" )
16
17 if (UNIX AND NOT APPLE)
18 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
19 set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
20 endif()
21
22 if ( APPLE )
23 add_definitions(-fPIC)
24 endif()
25
26
27 if ( WITH_MYSQL )
28 find_library(LIBMYSQLCLIENT NAMES libmysqlclient.so)
29 if ( ${LIBMYSQLCLIENT} STREQUAL "LIBMYSQLCLIENT-NOTFOUND")
30 message( FATAL_ERROR "-- Could not locate libmysqlclient.so" )
31 else ( ${LIBMYSQLCLIENT} STREQUAL "LIBMYSQLCLIENT-NOTFOUND" )
32 message( "-- LIBMYSQLCLIENT is set to ${LIBMYSQLCLIENT}" )
33 endif ( ${LIBMYSQLCLIENT} STREQUAL "LIBMYSQLCLIENT-NOTFOUND" )
34 add_definitions( -DDBL_USE_MYSQL=1 )
35 endif ( WITH_MYSQL )
36
37 ## On UNIX we require GTK
38 if (UNIX AND NOT APPLE)
39
40 if (GTK_VERSION EQUAL 3)
41 set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) # Cache the current value
42 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
43 find_package(GTK3)
44 set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH}) # Reset, else the official path isn't used again :/
45 if (GTK3_FOUND)
46 include_directories(${GTK3_INCLUDE_DIRS})
47 else (GTK3_FOUND)
48 message(FATAL_ERROR "Could not locate GTK.")
49 endif (GTK3_FOUND)
50 else()
51 find_package(GTK2)
52 if (GTK2_FOUND)
53 include_directories(${GTK2_INCLUDE_DIRS})
54 else (GTK2_FOUND)
55 message(FATAL_ERROR "Could not locate GTK.")
56 endif (GTK2_FOUND)
57 endif()
58
59 endif (UNIX AND NOT APPLE)
60
61 if ( USE_PCH AND NOT MINGW )
62 add_definitions(-include "${CL_PCH_FILE}")
63 add_definitions(-Winvalid-pch)
64 endif()
65
66 # Include paths
67 include_directories("${CL_SRC_ROOT}/Plugin"
68 "${CL_SRC_ROOT}/sdk/wxsqlite3/include"
69 "${CL_SRC_ROOT}/CodeLite" "${CL_SRC_ROOT}/PCH"
70 "${CL_SRC_ROOT}/Interfaces"
71 "${CL_SRC_ROOT}/sdk/wxshapeframework/include"
72 "${CL_SRC_ROOT}/sdk/databaselayer/include" )
73
74 add_definitions(-DWXUSINGDLL_WXSQLITE3)
75 add_definitions(-DWXUSINGDLL_CL)
76 add_definitions(-DWXUSINGDLL_SDK)
77 add_definitions(-DDBL_USE_SQLITE)
78
79 FILE(GLOB SRCS "*.cpp")
80
81 # Define the output
82 add_library(${PLUGIN_NAME} SHARED ${SRCS})
83
84 target_precompile_headers(${PLUGIN_NAME} REUSE_FROM PCH)
85
86 # Remove the "lib" prefix from the plugin name
87 set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "")
88
89 if (GTK3_FOUND)
90 set(GTK_LIBS ${GTK3_LIBRARIES})
91 else()
92 set(GTK_LIBS ${GTK2_LIBRARIES})
93 endif()
94
95 target_link_libraries(${PLUGIN_NAME}
96 ${LINKER_OPTIONS}
97 ${wxWidgets_LIBRARIES}
98 ${GTK_LIBS}
99 libcodelite
100 plugin
101 wxshapeframework
102 databaselayersqlite
103 )
104 CL_INSTALL_PLUGIN(${PLUGIN_NAME})