From: Matthias Maier Date: Thu, 2 Mar 2023 14:54:40 +0000 (-0600) Subject: CMake: Workaround: do not use object targets on Windows X-Git-Tag: v9.5.0-rc1~446^2~15 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8798c75ed3328ae7eb5d52a75bc199bc5675b98b;p=dealii.git CMake: Workaround: do not use object targets on Windows This works around a CMake issue where we cannot export targets that have a private dependency on object targets because they are erroneously required to be exported... --- diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index e2b766ec09..4f0ecbe6e8 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -76,7 +76,15 @@ foreach(build ${DEAL_II_BUILD_TYPES}) # Combine all ${build} OBJECT targets to a ${build} library: # - add_library(${DEAL_II_NAMESPACE}_${build_lowercase} dummy.cc) + set(_object_files "") + if(CMAKE_SYSTEM_NAME MATCHES "Windows") + get_property(_object_targets GLOBAL PROPERTY DEAL_II_OBJECT_TARGETS_${build}) + foreach(_target ${_object_targets}) + list(APPEND _object_files "$") + endforeach() + endif() + + add_library(${DEAL_II_NAMESPACE}_${build_lowercase} dummy.cc ${_object_files}) add_dependencies(library ${DEAL_II_NAMESPACE}_${build_lowercase}) # @@ -85,13 +93,15 @@ foreach(build ${DEAL_II_BUILD_TYPES}) # populate_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase} ${build}) - # - # Add all object targets as private link targets - # - get_property(_object_targets GLOBAL PROPERTY DEAL_II_OBJECT_TARGETS_${build}) - target_link_libraries(${DEAL_II_NAMESPACE}_${build_lowercase} - PRIVATE ${_object_targets} - ) + if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") + # + # Add all object targets as private link targets + # + get_property(_object_targets GLOBAL PROPERTY DEAL_II_OBJECT_TARGETS_${build}) + target_link_libraries(${DEAL_II_NAMESPACE}_${build_lowercase} + PRIVATE ${_object_targets} + ) + endif() set_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase} PROPERTIES