summaryrefslogtreecommitdiff
path: root/src/plugins/CMakeLists.sub
blob: 8040b54365bf6defc30110889df7f00367c806bc (plain)
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


#############################################
#
# Step 1. Set Variable and Build Dependency
#

# set lib name
SET(LIBNAME "lib${PROJECT_NAME}")
#SET(LIBDIR "${PREFIX}/lib")

#############################################
#
# Step 2. Set Compile Environment
#

# set extra cflags from build dependency
STRING(REPLACE ";" " " EXTRA_CFLAGS "${PLUGIN_CFLAGS}")

# add include directories to the build.
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../../../include)

# find all source files in a directory.
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SRCS)

#############################################
#
# Step 3. Set Link Environment
#

# add a library to the project using the specified source files.
ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})

# link a target to given libraries from pkg-config.
TARGET_LINK_LIBRARIES(${LIBNAME} ${PLUGIN_LDFLAGS})

# sets additional compiler flags used to build sources within the target.
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")

# override the default target name prefix (such as "lib")
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")

# specify the build version
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${VERSION})

# specify the api version
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${VERSION_MAJOR})

#############################################
#
# Step 4. Install packages
#

# install library files
INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIBDIR})