sezero / mikmod

Mikmod Sound System (mirror of git repo at https://sf.net/projects/mikmod/)
http://mikmod.sourceforge.net/
72 stars 22 forks source link

Add cmake rule to disable shared library builds for libmikmod #66

Closed davidgfnet closed 2 years ago

davidgfnet commented 2 years ago

The cmakefile has a rule to enable/disable static builds, which is awesome! However, in some platforms, might not be even possible to generate a shared object (or at least not trivially). For this, it is helpful to have a knob to disable said build.

This PR adds a knob for this, which is enabled by default thus not changing the default behaviour.

sezero commented 2 years ago

Thanks. Maybe do this too, though (on top of your patch):

diff -u a/libmikmod/CMakeLists.txt b/libmikmod/CMakeLists.txt
--- a/libmikmod/CMakeLists.txt
+++ b/libmikmod/CMakeLists.txt
@@ -170,6 +170,10 @@
 SET (ENABLE_SHARED 1 CACHE BOOL "Whether to build the shared library" )
 SET (ENABLE_STATIC 1 CACHE BOOL "Whether to build the static library" )

+if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED)
+    message(FATAL_ERROR "Both static and shared builds got disabled. You must enable at least one of them.")
+endif()
+
 ### This is to set the RPATH correctly, so when installed
 ### under a prefix the executables will find the libraries.
 ### See:  http://www.cmake.org/Wiki/CMake_RPATH_handling
davidgfnet commented 2 years ago

Absolutely! Didnt think about this indeed! Thanks for considering the PR, really appreciated!

sezero commented 2 years ago

Thanks, applied.