From 46719fa8e69d393ac0578124f49cca7d548dbef7 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Sat, 13 Jan 2024 15:13:57 +0100 Subject: [PATCH 1/2] cmake: Skip generate export header if interface in legacy path It backports a behavior from CMake 3.0 to CMake 2.0 --- cmake/Modules/ObsHelpers.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake index 0a7d25241253b4..b4620ab56daf0b 100644 --- a/cmake/Modules/ObsHelpers.cmake +++ b/cmake/Modules/ObsHelpers.cmake @@ -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) From 142be9104a1c6eff9d4965309daf8f17e5c600b9 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Sat, 13 Jan 2024 16:16:19 +0100 Subject: [PATCH 2/2] cmake: Skip PDB install for interface target --- cmake/Modules/ObsHelpers_Windows.cmake | 3 ++- cmake/windows/helpers.cmake | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/ObsHelpers_Windows.cmake b/cmake/Modules/ObsHelpers_Windows.cmake index 71ac4deb305af1..b85751410466e5 100644 --- a/cmake/Modules/ObsHelpers_Windows.cmake +++ b/cmake/Modules/ObsHelpers_Windows.cmake @@ -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 $ CONFIGURATIONS "RelWithDebInfo" "Debug" diff --git a/cmake/windows/helpers.cmake b/cmake/windows/helpers.cmake index 9472930d8b4723..a62576b1df8686 100644 --- a/cmake/windows/helpers.cmake +++ b/cmake/windows/helpers.cmake @@ -274,12 +274,15 @@ function(target_export target) set(exclude_variant EXCLUDE_FROM_ALL) _target_export(${target}) - install( - FILES "$" - 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 "$" + CONFIGURATIONS RelWithDebInfo Debug Release + DESTINATION "${OBS_EXECUTABLE_DESTINATION}" + COMPONENT Development + OPTIONAL) + endif() endfunction() # Helper function to add resources into bundle