summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/common/DependencyOptions.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /cmake/scripts/common/DependencyOptions.cmake
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/scripts/common/DependencyOptions.cmake')
-rw-r--r--cmake/scripts/common/DependencyOptions.cmake23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/scripts/common/DependencyOptions.cmake b/cmake/scripts/common/DependencyOptions.cmake
new file mode 100644
index 0000000..a45dcec
--- /dev/null
+++ b/cmake/scripts/common/DependencyOptions.cmake
@@ -0,0 +1,23 @@
+# Set Option varname based on USE_INTERNAL_LIBS status
+#
+# Alternative to cmake_dependent_option
+# cmake_dependent_option is restrictive, in the fact that we cannot override the
+# set option value as a cache variable (-Dvar=foo)
+#
+# This allows us to have the same outcome as cmake_dependent_option whilst still allowing
+# user to override for platforms that would normally be forced ON
+#
+function(dependent_option varname optionmessage)
+
+ # If varname already set, accept that, as it was provided by the user
+ if(NOT DEFINED ${varname})
+ # Generally we only define USE_INTERNAL_LIBS as the exception for platforms
+ # we explicitly dont want to build internal libs (eg Linux/Freebsd)
+ if(NOT DEFINED USE_INTERNAL_LIBS)
+ option(${varname} ${optionmessage} ON)
+ else()
+ # Respect Value of USE_INTERNAL_LIBS for ON/OFF
+ option(${varname} ${optionmessage} ${USE_INTERNAL_LIBS})
+ endif()
+ endif()
+endfunction()