~dianping-scope-team/dianping-scope/trunk

« back to all changes in this revision

Viewing changes to src/CMakeLists.txt

  • Committer: Zhang Enwei
  • Date: 2016-09-05 06:57:33 UTC
  • Revision ID: enwei.zhang@canonical.com-20160905065733-b82jm9k4w8pbi897
Initial release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
find_package(Qt5Network REQUIRED)
 
2
find_package(Qt5Core REQUIRED)
 
3
find_package(Qt5Xml REQUIRED)
 
4
 
 
5
include_directories(${Qt5Core_INCLUDE_DIRS})
 
6
include_directories(${Qt5Network_INCLUDE_DIRS})
 
7
include_directories(${Qt5Xml_INCLUDE_DIRS})
 
8
 
 
9
# Put the ini file in the build directory next to the scope
 
10
# .so file so test tools can find both easily.
 
11
configure_file(
 
12
  "${CMAKE_SOURCE_DIR}/data/${PACKAGE_NAME}.${SCOPE_NAME}_${SCOPE_NAME}.ini"
 
13
  "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}.${SCOPE_NAME}_${SCOPE_NAME}.ini"
 
14
  @ONLY
 
15
)
 
16
 
 
17
configure_file(
 
18
  "${CMAKE_SOURCE_DIR}/data/logo.png"
 
19
  "${CMAKE_CURRENT_BINARY_DIR}/logo.png"
 
20
  @ONLY
 
21
  COPYONLY
 
22
)
 
23
 
 
24
# The sources to build the scope
 
25
set(SCOPE_SOURCES
 
26
  api/client.cpp
 
27
  scope/preview.cpp
 
28
  scope/query.cpp
 
29
  scope/scope.cpp
 
30
)
 
31
 
 
32
# Find all the headers
 
33
file(GLOB_RECURSE
 
34
  SCOPE_HEADERS
 
35
  "${CMAKE_SOURCE_DIR}/include/*.h" 
 
36
)
 
37
 
 
38
# Build an object library for the scope code
 
39
add_library(
 
40
  scope-static OBJECT
 
41
  ${SCOPE_SOURCES}
 
42
  ${SCOPE_HEADERS}
 
43
)
 
44
 
 
45
# Ensure we export all the symbols
 
46
set_target_properties(
 
47
  scope-static
 
48
  PROPERTIES
 
49
    LINK_FLAGS "-Wl,--export-all-symbols"
 
50
)
 
51
 
 
52
# Build a shared library containing our scope code.
 
53
# This will be the actual plugin that is loaded.
 
54
add_library(
 
55
  scope SHARED
 
56
  $<TARGET_OBJECTS:scope-static>
 
57
)
 
58
 
 
59
# Link against the object library and our external library dependencies
 
60
target_link_libraries(
 
61
  scope
 
62
  ${SCOPE_LDFLAGS}
 
63
  ${Boost_LIBRARIES}
 
64
)
 
65
 
 
66
qt5_use_modules(scope Core Xml Network)
 
67
 
 
68
# Set the correct library output name to conform to the securiry policy 
 
69
set_target_properties(
 
70
  scope
 
71
  PROPERTIES
 
72
    OUTPUT_NAME "${PACKAGE_NAME}.${SCOPE_NAME}_${SCOPE_NAME}"
 
73
)
 
74
 
 
75
# Install the scope shared library
 
76
install(
 
77
  TARGETS scope
 
78
  LIBRARY DESTINATION ${SCOPE_INSTALL_DIR}/${TOOLCHAIN_PREFIX}
 
79
)
 
80