Support building mingw static and dynamic at the same time (#677)

Restrict the behavior disallowing the build of both libraries to MSVC. The mingw CMake generators
handle the situation properly:

- Shared library suffix: .dll
- Import library suffix: .a.dll
- Static library suffix: .a
This commit is contained in:
Quim Muntal 2021-02-04 21:13:18 +01:00 committed by GitHub
parent 3ea441ec1c
commit 253059c639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -804,7 +804,7 @@ else()
draco_points_enc)
# Library targets that consume the object collections.
if(MSVC OR WIN32)
if(MSVC)
# In order to produce a DLL and import library the Windows tools require
# that the exported symbols are part of the DLL target. The unfortunate side
# effect of this is that a single configuration cannot output both the

View File

@ -6,7 +6,7 @@ set(DRACO_CMAKE_DRACO_BUILD_DEFINITIONS_CMAKE_ 1)
# Utility for controlling the main draco library dependency. This changes in
# shared builds, and when an optional target requires a shared library build.
macro(set_draco_target)
if(MSVC OR WIN32)
if(MSVC)
set(draco_dependency draco)
set(draco_plugin_dependency ${draco_dependency})
else()

View File

@ -55,7 +55,7 @@ macro(draco_setup_install_target)
install(TARGETS draco_encoder DESTINATION
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
if(WIN32)
if(MSVC)
install(TARGETS draco DESTINATION
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
else()

View File

@ -164,8 +164,8 @@ endmacro()
# cmake-format: off
# - OUTPUT_NAME: Override output file basename. Target basename defaults to
# NAME. OUTPUT_NAME is ignored when BUILD_SHARED_LIBS is enabled and CMake
# is generating a build for which MSVC or WIN32 are true. This is to avoid
# output basename collisions with DLL import libraries.
# is generating a build for which MSVC is true. This is to avoid output
# basename collisions with DLL import libraries.
# - TEST: Flag. Presence means treat library as a test.
# - DEFINES: List of preprocessor macro definitions.
# - INCLUDES: list of include directories for the target.
@ -260,7 +260,7 @@ macro(draco_add_library)
endif()
if(lib_OUTPUT_NAME)
if(NOT (BUILD_SHARED_LIBS AND (MSVC OR WIN32)))
if(NOT (BUILD_SHARED_LIBS AND MSVC))
set_target_properties(${lib_NAME}
PROPERTIES OUTPUT_NAME ${lib_OUTPUT_NAME})
endif()