Skip to content

Commit

Permalink
Try fix windows link error with visiblity
Browse files Browse the repository at this point in the history
  • Loading branch information
gabime committed Jan 18, 2025
1 parent b93c0f8 commit ace82f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ if (BUILD_SHARED_LIBS)
endif ()
add_library(spdlog SHARED ${VERSION_RC})
target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB)
set_target_properties(spdlog PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)

if (MSVC)
# disable dlls related warnings on msvc
Expand All @@ -254,6 +251,9 @@ if (BUILD_SHARED_LIBS)
else ()
add_library(spdlog STATIC)
endif ()

set_target_properties(spdlog PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)

add_library(spdlog::spdlog ALIAS spdlog)
target_sources(spdlog PRIVATE ${SPDLOG_SRCS})
target_sources(
Expand Down
6 changes: 5 additions & 1 deletion include/spdlog/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
#define SPDLOG_API __attribute__((visibility("default")))
#endif
#else // !defined(SPDLOG_SHARED_LIB)
#define SPDLOG_API
#if defined(_WIN32)
#define SPDLOG_API
#else
#define SPDLOG_API __attribute__((visibility("default")))
#endif
#endif

#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string)
Expand Down

0 comments on commit ace82f7

Please sign in to comment.