summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Asteborg <maastebo@microsoft.com>2020-04-22 22:42:18 -0700
committerMark Harris <mark.hsj@gmail.com>2020-06-13 00:21:06 -0700
commitd00d866e8c56d5a8acf764e34ce04dc54c790ac8 (patch)
tree9e563b2802ee201073b37b19fcb385fb4ee90ac2
parent48055ccc235a287c2ccf143a7196281a78a7746d (diff)
downloadopus-d00d866e8c56d5a8acf764e34ce04dc54c790ac8.tar.gz
cmake - add include guards to cmake files
Signed-off-by: Mark Harris <mark.hsj@gmail.com>
-rw-r--r--cmake/OpusBuildtype.cmake4
-rw-r--r--cmake/OpusConfig.cmake5
-rw-r--r--cmake/OpusFunctions.cmake9
-rw-r--r--cmake/OpusSources.cmake5
4 files changed, 18 insertions, 5 deletions
diff --git a/cmake/OpusBuildtype.cmake b/cmake/OpusBuildtype.cmake
index aaee9eff..557cc89b 100644
--- a/cmake/OpusBuildtype.cmake
+++ b/cmake/OpusBuildtype.cmake
@@ -1,4 +1,8 @@
# Set a default build type if none was specified
+if(__opus_buildtype)
+ return()
+endif()
+set(__opus_buildtype INCLUDED)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(CMAKE_C_FLAGS)
diff --git a/cmake/OpusConfig.cmake b/cmake/OpusConfig.cmake
index cb20e7fc..1d0dcccd 100644
--- a/cmake/OpusConfig.cmake
+++ b/cmake/OpusConfig.cmake
@@ -1,3 +1,8 @@
+if(__opus_config)
+ return()
+endif()
+set(__opus_config INCLUDED)
+
include(OpusFunctions)
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake.in config.h @ONLY)
diff --git a/cmake/OpusFunctions.cmake b/cmake/OpusFunctions.cmake
index a3ac1c09..f0da3822 100644
--- a/cmake/OpusFunctions.cmake
+++ b/cmake/OpusFunctions.cmake
@@ -1,8 +1,7 @@
-#[[Cmake helper function to parse source files from make files
-this is to avoid breaking existing make and auto make support
-but still have the option to use CMake with only lists at one place]]
-
-cmake_minimum_required(VERSION 3.1)
+if(__opus_functions)
+ return()
+endif()
+set(__opus_functions INCLUDED)
function(get_library_version OPUS_LIBRARY_VERSION OPUS_LIBRARY_VERSION_MAJOR)
file(STRINGS configure.ac opus_lt_current_string
diff --git a/cmake/OpusSources.cmake b/cmake/OpusSources.cmake
index d8c6cdf4..01e75d1a 100644
--- a/cmake/OpusSources.cmake
+++ b/cmake/OpusSources.cmake
@@ -1,3 +1,8 @@
+if(__opus_sources)
+ return()
+endif()
+set(__opus_sources INCLUDED)
+
include(OpusFunctions)
get_opus_sources(SILK_HEAD silk_headers.mk silk_headers)