Add shared library support for Windows

This commit is contained in:
Martin Vejdarski
2020-03-10 02:02:16 +07:00
parent 67561f97ec
commit 0ca2cb625e
22 changed files with 118 additions and 100 deletions

View File

@@ -126,10 +126,11 @@ if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO)
endif()
if (SPDLOG_BUILD_SHARED)
if(WIN32)
message(FATAL_ERROR "spdlog shared lib is not yet supported under windows")
endif()
add_library(spdlog SHARED ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB)
if(WIN32)
target_compile_options(spdlog PUBLIC /wd4251 /wd4275)
endif()
else()
add_library(spdlog STATIC ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
endif()
@@ -265,7 +266,10 @@ if (SPDLOG_INSTALL)
# Include files
#---------------------------------------------------------------------------------------
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" PATTERN "fmt/bundled" EXCLUDE)
install(TARGETS spdlog spdlog_header_only EXPORT spdlog DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(TARGETS spdlog spdlog_header_only EXPORT spdlog
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NOT SPDLOG_FMT_EXTERNAL AND NOT SPDLOG_FMT_EXTERNAL_HO)
install(DIRECTORY include/${PROJECT_NAME}/fmt/bundled/