From e868cdf022890fee56fd5c4608190d196362b36d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Oct 2018 08:09:42 +0100 Subject: cmake: add include guards --- CMakeLists.txt | 2 +- cmake/GetGitRevisionDescription.cmake | 2 ++ cmake/GetGitRevisionDescription.cmake.in | 2 ++ cmake/opentrack-boilerplate.cmake | 2 ++ cmake/opentrack-hier.cmake | 2 ++ cmake/opentrack-i18n.cmake | 2 ++ cmake/opentrack-install.cmake | 1 + cmake/opentrack-load-user-settings.cmake | 1 + cmake/opentrack-mrproper.cmake | 2 ++ cmake/opentrack-pkg-config.cmake | 1 + cmake/opentrack-platform.cmake | 2 ++ cmake/opentrack-policy.cmake | 1 + cmake/opentrack-qt.cmake | 1 + cmake/opentrack-rift.cmake | 1 + cmake/opentrack-variant.cmake | 2 +- cmake/opentrack-version.cmake | 1 + cmake/opentrack-word-size.cmake | 1 + 17 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 320b732c..b2bbb12f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") include(opentrack-mrproper) project(opentrack) -cmake_minimum_required(VERSION 3.8 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) include(opentrack-policy NO_POLICY_SCOPE) include(opentrack-load-user-settings) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index e4ac79c0..0c016cc0 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -30,6 +30,8 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +include_guard(GLOBAL) + if(__get_git_revision_description) return() endif() diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/GetGitRevisionDescription.cmake.in index 888ce13a..032dda66 100644 --- a/cmake/GetGitRevisionDescription.cmake.in +++ b/cmake/GetGitRevisionDescription.cmake.in @@ -13,6 +13,8 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +include_guard(GLOBAL) + set(HEAD_HASH) file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 78d0e1dd..9ac95cb9 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -1,3 +1,5 @@ +include_guard(GLOBAL) + set(opentrack-perms-file WORLD_READ OWNER_WRITE OWNER_READ GROUP_READ) set(opentrack-perms-dir WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) set(opentrack-perms-exec "${opentrack-perms-dir}") diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 734ba183..2b3159b4 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -7,6 +7,8 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. +include_guard(GLOBAL) + set(opentrack-install-rpath "") if(APPLE) set(opentrack-hier-pfx ".") diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake index c23d5d1d..2e35ba6b 100644 --- a/cmake/opentrack-i18n.cmake +++ b/cmake/opentrack-i18n.cmake @@ -1,3 +1,5 @@ +include_guard(GLOBAL) + add_custom_target(i18n ALL) function(otr_i18n_for_target_directory n) diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index d15951e9..cd4f6278 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) macro(otr_install_misc path) install(${ARGN} DESTINATION "${path}" PERMISSIONS ${opentrack-perms-file}) endmacro() diff --git a/cmake/opentrack-load-user-settings.cmake b/cmake/opentrack-load-user-settings.cmake index f1598ae1..35085b65 100644 --- a/cmake/opentrack-load-user-settings.cmake +++ b/cmake/opentrack-load-user-settings.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) if(WIN32) set(__sdk_username "$ENV{USERNAME}") else() diff --git a/cmake/opentrack-mrproper.cmake b/cmake/opentrack-mrproper.cmake index faa11bd4..6efb0be3 100644 --- a/cmake/opentrack-mrproper.cmake +++ b/cmake/opentrack-mrproper.cmake @@ -7,6 +7,8 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. +include_guard(GLOBAL) + function(cleanup_build_dir) file(GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${CMAKE_BINARY_DIR}" "*") diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake index 3f4c41d5..b12b786c 100644 --- a/cmake/opentrack-pkg-config.cmake +++ b/cmake/opentrack-pkg-config.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) include(FindPkgConfig) function(otr_pkgconfig target) diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 365aba62..4b7cde09 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -21,6 +21,8 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. +include_guard(GLOBAL) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE) if(NOT CMAKE_BUILD_TYPE) diff --git a/cmake/opentrack-policy.cmake b/cmake/opentrack-policy.cmake index e4fded7a..e86cd284 100644 --- a/cmake/opentrack-policy.cmake +++ b/cmake/opentrack-policy.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) foreach(k CMP0020 CMP0022 CMP0058 CMP0028 CMP0042 CMP0063 CMP0053 CMP0011 CMP0054 CMP0012) if(POLICY ${k}) cmake_policy(SET ${k} NEW) diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 8d975712..b5aecdc2 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET) if(WIN32) find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) diff --git a/cmake/opentrack-rift.cmake b/cmake/opentrack-rift.cmake index 88adbb3e..cdcfc946 100644 --- a/cmake/opentrack-rift.cmake +++ b/cmake/opentrack-rift.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) function(otr_rift proj opt) if(${opt}) set(link-flags) diff --git a/cmake/opentrack-variant.cmake b/cmake/opentrack-variant.cmake index bae5a451..3ea01eaa 100644 --- a/cmake/opentrack-variant.cmake +++ b/cmake/opentrack-variant.cmake @@ -1,4 +1,4 @@ -# XXX that belongs in each variant's directory! +include_guard(GLOBAL) function(otr_dist_select_variant) file(GLOB variants "variant/*") diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake index 24970b59..a85d7ffe 100644 --- a/cmake/opentrack-version.cmake +++ b/cmake/opentrack-version.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) include(GetGitRevisionDescription) find_package(Git QUIET) diff --git a/cmake/opentrack-word-size.cmake b/cmake/opentrack-word-size.cmake index 4ed82e02..e539f1cd 100644 --- a/cmake/opentrack-word-size.cmake +++ b/cmake/opentrack-word-size.cmake @@ -1,3 +1,4 @@ +include_guard(GLOBAL) if(CMAKE_SIZEOF_VOID_P GREATER 4) set(opentrack-64bit TRUE) else() -- cgit v1.2.3