cmake: use targets for plugins installation

using file(GLOB) could install plugins from the wrong location, use
targets instead to get the correct output path

Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
This commit is contained in:
Nicolas PARLANT 2026-07-09 20:42:09 +02:00
parent de5acb2abd
commit 6429ec9255
No known key found for this signature in database
GPG Key ID: B336A0566553B5D5
2 changed files with 10 additions and 15 deletions

View File

@ -620,14 +620,6 @@ foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
endif() endif()
endforeach() endforeach()
# Plugin output directory
set(PLUGIN_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32)
set(PLUGIN_SUFFIX ".dll")
else()
set(PLUGIN_SUFFIX ".ld.so")
endif()
# Include plugin definitions # Include plugin definitions
include(cmake/plugins.cmake) include(cmake/plugins.cmake)
@ -661,16 +653,17 @@ foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
endforeach() endforeach()
# Install plugins # Install plugins
file(GLOB PLUGINFILES "${PLUGIN_OUTPUT_DIR}/*${PLUGIN_SUFFIX}") get_property(PLUGINTARGETS GLOBAL PROPERTY 3PROXY_PLUGIN_TARGETS)
if(WIN32) if(WIN32)
install(FILES install(TARGETS
${PLUGINFILES} ${PLUGINTARGETS}
DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
else() else()
install(FILES install(TARGETS
${PLUGINFILES} ${PLUGINTARGETS}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy
) )
endif() endif()

View File

@ -20,6 +20,8 @@ function(add_3proxy_plugin PLUGIN_NAME)
add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES}) add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES})
set_property(GLOBAL APPEND PROPERTY 3PROXY_PLUGIN_TARGETS ${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES set_target_properties(${PLUGIN_NAME} PROPERTIES
PREFIX "" PREFIX ""
SUFFIX ${PLUGIN_SUFFIX} SUFFIX ${PLUGIN_SUFFIX}