diff options
Diffstat (limited to 'src/plugins/CMakeLists.sub')
-rw-r--r-- | src/plugins/CMakeLists.sub | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/plugins/CMakeLists.sub b/src/plugins/CMakeLists.sub new file mode 100644 index 0000000..8040b54 --- /dev/null +++ b/src/plugins/CMakeLists.sub @@ -0,0 +1,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}) + |