Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable exporting CMake interface target #10100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmake/Modules/ObsHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,13 @@ function(export_target target)
COMPONENT obs_libraries
${_EXCLUDE})

include(GenerateExportHeader)
generate_export_header(${target} EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h)
get_target_property(target_type ${target} TYPE)
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
include(GenerateExportHeader)
generate_export_header(${target} EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h)

target_sources(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h)
target_sources(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h)
endif()

set(TARGETS_EXPORT_NAME "${target}Targets")
include(CMakePackageConfigHelpers)
Expand Down
3 changes: 2 additions & 1 deletion cmake/Modules/ObsHelpers_Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ function(export_target target)
COMPONENT obs_libraries
EXCLUDE_FROM_ALL)

if(MSVC)
get_target_property(target_type ${target} TYPE)
if(MSVC AND NOT target_type STREQUAL INTERFACE_LIBRARY)
install(
FILES $<TARGET_PDB_FILE:${target}>
CONFIGURATIONS "RelWithDebInfo" "Debug"
Expand Down
15 changes: 9 additions & 6 deletions cmake/windows/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ function(target_export target)
set(exclude_variant EXCLUDE_FROM_ALL)
_target_export(${target})

install(
FILES "$<TARGET_PDB_FILE:${target}>"
CONFIGURATIONS RelWithDebInfo Debug Release
DESTINATION "${OBS_EXECUTABLE_DESTINATION}"
COMPONENT Development
OPTIONAL)
get_target_property(target_type ${target} TYPE)
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
install(
FILES "$<TARGET_PDB_FILE:${target}>"
CONFIGURATIONS RelWithDebInfo Debug Release
DESTINATION "${OBS_EXECUTABLE_DESTINATION}"
COMPONENT Development
OPTIONAL)
endif()
tytan652 marked this conversation as resolved.
Show resolved Hide resolved
endfunction()

# Helper function to add resources into bundle
Expand Down
Loading