diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index f069dd8..cbe0a9e 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -12,3 +12,13 @@ if(BUILD_SHARED_LIBS) else() target_link_libraries(example uhttpd_s ${LIBEV_LIBRARY}) endif() + +if(HAVE_DLOPEN) + add_library(test_plugin MODULE test_plugin.c) + set_target_properties(test_plugin PROPERTIES OUTPUT_NAME test_plugin PREFIX "") + + install( + TARGETS test_plugin + LIBRARY DESTINATION lib/uhttpd + ) +endif() \ No newline at end of file diff --git a/example/example.c b/example/example.c index 7345688..cd3273e 100644 --- a/example/example.c +++ b/example/example.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) srv->on_request = on_request; - srv->load_plugin(srv, "/usr/local/lib/uhttpd/test.so"); + srv->load_plugin(srv, "/usr/local/lib/uhttpd/test_plugin.so"); uh_log_info("Listen on: *:%d\n", port); diff --git a/src/plugins/test.c b/example/test_plugin.c similarity index 100% rename from src/plugins/test.c rename to example/test_plugin.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f00fc8f..5cdc62f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,10 +138,6 @@ endif() # configure a header file to pass some of the CMake settings to the source code configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) -if(HAVE_DLOPEN) - add_subdirectory(plugins) -endif() - install( FILES uhttpd.h diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt deleted file mode 100644 index bec12c5..0000000 --- a/src/plugins/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -option(BUILD_TEST_PLUGIN "Build test plugin" ON) - -set(PLUGINS "") - -if(BUILD_TEST_PLUGIN) - set(PLUGINS ${PLUGINS} test_plugin) - add_library(test_plugin MODULE test.c) - set_target_properties(test_plugin PROPERTIES OUTPUT_NAME test PREFIX "") -endif() - -install( - TARGETS ${PLUGINS} - LIBRARY DESTINATION lib/uhttpd -)