3proxy/cmake/plugins.cmake
Vladimir Dubrovin 71d676eb58
Some checks are pending
RPM/DEB build aarch64 / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
RPM/DEB build armhf / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
RPM/DEB build x86-64 / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
Build Win32 3proxy-lite with Watcom / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Build Win32 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Build Win64 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Build Win-arm64 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Update workflows and builds
2026-04-09 17:53:27 +03:00

53 lines
1.5 KiB
CMake

#
# 3proxy plugin definitions
#
# This file defines functions for building plugins
#
# Function to add a plugin with dependencies
function(add_3proxy_plugin PLUGIN_NAME)
set(options "")
set(oneValueArgs "")
set(multiValueArgs SOURCES LIBRARIES INCLUDE_DIRS COMPILE_DEFINITIONS LINK_OPTIONS)
cmake_parse_arguments(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(WIN32)
set(PLUGIN_SUFFIX ".dll")
else()
set(PLUGIN_SUFFIX ".ld.so")
endif()
add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES})
set_target_properties(${PLUGIN_NAME} PROPERTIES
PREFIX ""
SUFFIX ${PLUGIN_SUFFIX}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
# Always link with Threads
target_link_libraries(${PLUGIN_NAME} PRIVATE Threads::Threads)
if(PLUGIN_LIBRARIES)
target_link_libraries(${PLUGIN_NAME} PRIVATE ${PLUGIN_LIBRARIES})
endif()
if(PLUGIN_INCLUDE_DIRS)
target_include_directories(${PLUGIN_NAME} PRIVATE ${PLUGIN_INCLUDE_DIRS})
endif()
if(PLUGIN_COMPILE_DEFINITIONS)
target_compile_definitions(${PLUGIN_NAME} PRIVATE ${PLUGIN_COMPILE_DEFINITIONS})
endif()
if(PLUGIN_LINK_OPTIONS)
set_target_properties(${PLUGIN_NAME} PROPERTIES LINK_OPTIONS "${PLUGIN_LINK_OPTIONS}")
endif()
target_include_directories(${PLUGIN_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src
)
endfunction()