vcpkg/ports/libopnmidi/cmake-build-shared-libs-support.patch

25 lines
985 B
Diff
Raw Permalink Normal View History

2023-03-09 06:16:13 +08:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4276e23..1d6ac82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,8 +120,17 @@ if(NOT EMSCRIPTEN
AND NOT NINTENDO_WIIU
AND NOT NINTENDO_SWITCH
AND NOT MSDOS)
- option(libOPNMIDI_STATIC "Build static library of libOPNMIDI" ON)
- option(libOPNMIDI_SHARED "Build shared library of libOPNMIDI" OFF)
+ set(libOPNMIDI_STATIC_ENABLED_BY_DEFAULT ON)
+ set(libOPNMIDI_SHARED_ENABLED_BY_DEFAULT OFF)
+
+ # When defined, respect CMake's BUILD_SHARED_LIBS setting
+ if (BUILD_SHARED_LIBS)
+ set(libOPNMIDI_SHARED_ENABLED_BY_DEFAULT ON)
+ set(libOPNMIDI_STATIC_ENABLED_BY_DEFAULT OFF)
+ endif()
+
+ option(libOPNMIDI_STATIC "Build static library of libOPNMIDI" ${libOPNMIDI_STATIC_ENABLED_BY_DEFAULT})
+ option(libOPNMIDI_SHARED "Build shared library of libOPNMIDI" ${libOPNMIDI_SHARED_ENABLED_BY_DEFAULT})
else()
set(libOPNMIDI_STATIC ON)
set(libOPNMIDI_SHARED OFF)