Skip to content

Commit

Permalink
cmake: Skip generate export header if interface in legacy path
Browse files Browse the repository at this point in the history
It backports a behavior from CMake 3.0 to CMake 2.0
  • Loading branch information
tytan652 committed Jan 27, 2024
1 parent b8155cd commit 46719fa
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit 46719fa

Please sign in to comment.