plugin-standalone: refactor cmake part to ease multiple sources
This commit is contained in:
parent
e304d7bba7
commit
57e020a826
1 changed files with 15 additions and 20 deletions
|
@ -17,6 +17,9 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE} ${PACKAGE_VERSION}")
|
||||||
set(SOVERSION "1")
|
set(SOVERSION "1")
|
||||||
set(VERSION "0.1")
|
set(VERSION "0.1")
|
||||||
|
|
||||||
|
set(PLUGIN_NAME "protocol_example_standalone")
|
||||||
|
# space-separated list of sources
|
||||||
|
set(PLUGIN_SRCS protocol_example_standalone.c)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
|
@ -50,29 +53,21 @@ endif()
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
||||||
|
|
||||||
macro(create_plugin PLUGIN_NAME MAIN_SRC)
|
source_group("Headers Private" FILES ${PLUGIN_HDR})
|
||||||
set(PLUGIN_SRCS ${MAIN_SRC})
|
source_group("Sources" FILES ${PLUGIN_SRCS})
|
||||||
|
add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SRCS} ${PLUGIN_HDR})
|
||||||
source_group("Headers Private" FILES ${PLUGIN_HDR})
|
|
||||||
source_group("Sources" FILES ${PLUGIN_SRCS})
|
|
||||||
add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SRCS} ${PLUGIN_HDR})
|
|
||||||
|
|
||||||
target_link_libraries(${PLUGIN_NAME} -lwebsockets)
|
|
||||||
|
|
||||||
# Set test app specific defines.
|
|
||||||
set_property(TARGET ${PLUGIN_NAME}
|
|
||||||
PROPERTY COMPILE_DEFINITIONS
|
|
||||||
INSTALL_DATADIR="${CMAKE_INSTALL_PREFIX}/plugins"
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND PLUGINS_LIST ${PLUGIN_NAME})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
|
target_link_libraries(${PLUGIN_NAME} -lwebsockets)
|
||||||
|
|
||||||
create_plugin(protocol_example_standalone
|
# Set test app specific defines.
|
||||||
"protocol_example_standalone.c")
|
set_property(TARGET ${PLUGIN_NAME}
|
||||||
|
PROPERTY COMPILE_DEFINITIONS
|
||||||
|
INSTALL_DATADIR="${CMAKE_INSTALL_PREFIX}/plugins"
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND PLUGINS_LIST ${PLUGIN_NAME})
|
||||||
|
|
||||||
install(TARGETS ${PLUGINS_LIST}
|
install(TARGETS ${PLUGINS_LIST}
|
||||||
PERMISSIONS OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_READ GROUP_READ WORLD_READ
|
PERMISSIONS OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_READ GROUP_READ WORLD_READ
|
||||||
DESTINATION share/libwebsockets-test-server/plugins
|
DESTINATION share/libwebsockets-test-server/plugins
|
||||||
COMPONENT plugins)
|
COMPONENT plugins)
|
||||||
|
|
Loading…
Add table
Reference in a new issue