Skip to content

Commit

Permalink
CMake: Respect BUILD_SHARED_LIBS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarkar authored and Wohlstand committed Mar 3, 2023
1 parent a48f3f7 commit 76e4610
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 76e4610

Please sign in to comment.