From 52706b92e14961628ea38cd66d8dfef0292c9cc3 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Sat, 27 Jan 2024 12:25:58 +0100 Subject: [PATCH] Test no add_subdirectory --- CMakeLists.txt | 2 +- cmake/legacy.cmake | 16 ++++++++++++++- .../obs-websocket-api.cmake | 6 +----- .../obs-websocket-apiConfig.cmake.in | 0 lib/cmake/legacy.cmake | 20 ------------------- 5 files changed, 17 insertions(+), 27 deletions(-) rename lib/CMakeLists.txt => cmake/obs-websocket-api.cmake (87%) rename {lib/cmake => cmake}/obs-websocket-apiConfig.cmake.in (100%) delete mode 100644 lib/cmake/legacy.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e95b47b9..03c5f34c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ legacy_check() set(obs-websocket_VERSION 5.4.0) set(OBS_WEBSOCKET_RPC_VERSION 1) -add_subdirectory(lib) +include(cmake/obs-websocket-api.cmake) option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON) if(NOT ENABLE_WEBSOCKET) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index e1795734..03356611 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -3,7 +3,21 @@ set(OBS_WEBSOCKET_RPC_VERSION 1) option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON) -add_subdirectory(lib) +add_library(obs-websocket-api INTERFACE) +add_library(OBS::websocket-api ALIAS obs-websocket-api) + +target_sources(obs-websocket-api INTERFACE $ + $) + +target_link_libraries(obs-websocket-api INTERFACE OBS::libobs) + +target_include_directories(obs-websocket-api INTERFACE $ + $) + +set_target_properties(obs-websocket-api PROPERTIES FOLDER "plugins/obs-websocket/lib" PUBLIC_HEADER + lib/obs-websocket-api.h) + +export_target(obs-websocket-api) if(NOT ENABLE_WEBSOCKET OR NOT ENABLE_UI) message(STATUS "OBS: DISABLED obs-websocket") diff --git a/lib/CMakeLists.txt b/cmake/obs-websocket-api.cmake similarity index 87% rename from lib/CMakeLists.txt rename to cmake/obs-websocket-api.cmake index 0304dca8..a3a7f127 100644 --- a/lib/CMakeLists.txt +++ b/cmake/obs-websocket-api.cmake @@ -1,7 +1,3 @@ -cmake_minimum_required(VERSION 3.22...3.25) - -legacy_check() - add_library(obs-websocket-api INTERFACE) add_library(OBS::websocket-api ALIAS obs-websocket-api) @@ -17,6 +13,6 @@ set_target_properties( obs-websocket-api PROPERTIES FOLDER plugins/obs-websocket PREFIX "" - PUBLIC_HEADER obs-websocket-api.h) + PUBLIC_HEADER lib/obs-websocket-api.h) target_export(obs-websocket-api) diff --git a/lib/cmake/obs-websocket-apiConfig.cmake.in b/cmake/obs-websocket-apiConfig.cmake.in similarity index 100% rename from lib/cmake/obs-websocket-apiConfig.cmake.in rename to cmake/obs-websocket-apiConfig.cmake.in diff --git a/lib/cmake/legacy.cmake b/lib/cmake/legacy.cmake deleted file mode 100644 index e2ed1a25..00000000 --- a/lib/cmake/legacy.cmake +++ /dev/null @@ -1,20 +0,0 @@ -if(POLICY CMP0090) - cmake_policy(SET CMP0090 NEW) -endif() - -project(obs-websocket-api) - -add_library(obs-websocket-api INTERFACE) -add_library(OBS::websocket-api ALIAS obs-websocket-api) - -target_sources(obs-websocket-api INTERFACE $ - $) - -target_link_libraries(obs-websocket-api INTERFACE OBS::libobs) - -target_include_directories(obs-websocket-api INTERFACE $ - $) - -set_target_properties(obs-websocket-api PROPERTIES FOLDER "plugins/obs-websocket/lib" PUBLIC_HEADER obs-websocket-api.h) - -export_target(obs-websocket-api)