Skip to content

Commit 5a1ef7e

Browse files
committed
Redo visibility fallback
1 parent bea58bf commit 5a1ef7e

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/CMakeLists.txt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,21 @@ set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)
435435
# so we want to check & warn users if they do this. However, we won't abort
436436
# the configuration step so that we don't have to also provide an override.
437437
if (BUILD_SHARED_LIBS)
438-
get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET)
439-
get_target_property(_ExportAll Catch2 WINDOWS_EXPORT_ALL_SYMBOLS)
440-
if (MSVC AND NOT _ExportAll
441-
OR _VisPreset STREQUAL "hidden")
438+
if (MSVC)
439+
set_target_properties(Catch2 Catch2WithMain
440+
PROPERTIES
441+
WINDOWS_EXPORT_ALL_SYMBOLS ON
442+
)
443+
endif()
442444

443-
message(WARNING
444-
"Catch2 does not support being built as a dynamic library with hidden"
445-
" visibility. You have to ensure that visibility is handled yourself."
445+
get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET)
446+
if (NOT MSVC AND _VisPreset STREQUAL "hidden")
447+
set_target_properties(Catch2 Catch2WithMain
448+
PROPERTIES
449+
CXX_VISIBILITY_PRESET "default"
450+
VISIBILITY_INLINES_HIDDEN OFF
446451
)
452+
message(WARNING "Setting Catch2's visibility to default."
453+
" Hidden visibility is not supported.")
447454
endif()
448455
endif()

0 commit comments

Comments
 (0)