Skip to content

Commit

Permalink
Test no add_subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Jan 27, 2024
1 parent f9b233d commit 52706b9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 15 additions & 1 deletion cmake/legacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/obs-websocket-api.h>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}/obs-websocket-api.h>)

target_link_libraries(obs-websocket-api INTERFACE OBS::libobs)

target_include_directories(obs-websocket-api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${OBS_INCLUDE_DESTINATION}>)

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")
Expand Down
6 changes: 1 addition & 5 deletions lib/CMakeLists.txt → cmake/obs-websocket-api.cmake
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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)
File renamed without changes.
20 changes: 0 additions & 20 deletions lib/cmake/legacy.cmake

This file was deleted.

0 comments on commit 52706b9

Please sign in to comment.