Skip to content

Commit

Permalink
Merge pull request #3975 from terrelln/2024-03-18-cmake-docs
Browse files Browse the repository at this point in the history
[cmake] Emit warnings for contradictory build settings
  • Loading branch information
Cyan4973 committed Mar 21, 2024
2 parents 1d3f664 + 42b02f5 commit 76fbb5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/cmake/lib/CMakeLists.txt
Expand Up @@ -152,11 +152,17 @@ if (ZSTD_BUILD_STATIC)
add_definition(libzstd_static ZDICTLIB_STATIC_API)
endif ()
if (ZSTD_BUILD_SHARED AND NOT ZSTD_BUILD_STATIC)
if (NOT BUILD_SHARED_LIBS)
message(WARNING "BUILD_SHARED_LIBS is OFF, but ZSTD_BUILD_SHARED is ON and ZSTD_BUILD_STATIC is OFF, which takes precedence, so libzstd is a shared library")
endif ()
add_library(libzstd INTERFACE)
target_link_libraries(libzstd INTERFACE libzstd_shared)
list(APPEND library_targets libzstd)
endif ()
if (ZSTD_BUILD_STATIC AND NOT ZSTD_BUILD_SHARED)
if (BUILD_SHARED_LIBS)
message(WARNING "BUILD_SHARED_LIBS is ON, but ZSTD_BUILD_SHARED is OFF and ZSTD_BUILD_STATIC is ON, which takes precedence, is set so libzstd is a static library")
endif ()
add_library(libzstd INTERFACE)
target_link_libraries(libzstd INTERFACE libzstd_static)
list(APPEND library_targets libzstd)
Expand Down

0 comments on commit 76fbb5f

Please sign in to comment.