Explorar o código

Merge topic 'pragma-once'

4d611868 Check*: Added include guards

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1327
Brad King %!s(int64=8) %!d(string=hai) anos
pai
achega
d5681e353a

+ 1 - 0
Modules/CheckCCompilerFlag.cmake

@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
   in such variables may cause a false negative for this check.
 #]=======================================================================]
 
+include_guard(GLOBAL)
 include(CheckCSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 

+ 1 - 0
Modules/CheckCSourceCompiles.cmake

@@ -60,6 +60,7 @@ Check if given C source compiles and links into an executable.
 
 #]=======================================================================]
 
+include_guard(GLOBAL)
 
 macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
   if(NOT DEFINED "${VAR}")

+ 2 - 0
Modules/CheckCSourceRuns.cmake

@@ -60,6 +60,8 @@ subsequently be run.
 
 #]=======================================================================]
 
+include_guard(GLOBAL)
+
 macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
   if(NOT DEFINED "${VAR}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS

+ 1 - 0
Modules/CheckCXXCompilerFlag.cmake

@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
   in such variables may cause a false negative for this check.
 #]=======================================================================]
 
+include_guard(GLOBAL)
 include(CheckCXXSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 

+ 2 - 0
Modules/CheckCXXSourceCompiles.cmake

@@ -60,6 +60,8 @@ Check if given C++ source compiles and links into an executable.
 
 #]=======================================================================]
 
+include_guard(GLOBAL)
+
 macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
   if(NOT DEFINED "${VAR}")
     set(_FAIL_REGEX)

+ 2 - 0
Modules/CheckCXXSourceRuns.cmake

@@ -60,6 +60,8 @@ subsequently be run.
 
 #]=======================================================================]
 
+include_guard(GLOBAL)
+
 macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
   if(NOT DEFINED "${VAR}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS

+ 1 - 0
Modules/CheckCXXSymbolExists.cmake

@@ -32,6 +32,7 @@
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
 #   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
+include_guard(GLOBAL)
 include(CheckSymbolExists)
 
 macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE)

+ 1 - 0
Modules/CheckFortranCompilerFlag.cmake

@@ -32,6 +32,7 @@ effect or even a specific one is beyond the scope of this module.
   in such variables may cause a false negative for this check.
 #]=======================================================================]
 
+include_guard(GLOBAL)
 include(CheckFortranSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)
 

+ 2 - 0
Modules/CheckFortranFunctionExists.cmake

@@ -24,6 +24,8 @@
 #
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
 
+include_guard(GLOBAL)
+
 macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
   if(NOT DEFINED ${VARIABLE})
     message(STATUS "Looking for Fortran ${FUNCTION}")

+ 1 - 0
Modules/CheckFortranSourceCompiles.cmake

@@ -66,6 +66,7 @@ Check if given Fortran source compiles and links into an executable.
 
 #]=======================================================================]
 
+include_guard(GLOBAL)
 
 macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
   if(NOT DEFINED "${VAR}")

+ 2 - 0
Modules/CheckFunctionExists.cmake

@@ -38,6 +38,8 @@
 #   * ``check_function_exists()`` only verifies linking, it does not verify
 #     that the function is declared in system headers.
 
+include_guard(GLOBAL)
+
 macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
   if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS

+ 2 - 0
Modules/CheckIncludeFile.cmake

@@ -34,6 +34,8 @@
 # at once.  See the :module:`CheckIncludeFileCXX` module to check for headers
 # using the ``CXX`` language.
 
+include_guard(GLOBAL)
+
 macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
   if(NOT DEFINED "${VARIABLE}")
     if(CMAKE_REQUIRED_INCLUDES)

+ 2 - 0
Modules/CheckIncludeFileCXX.cmake

@@ -33,6 +33,8 @@
 # See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
 # to check for one or more ``C`` headers.
 
+include_guard(GLOBAL)
+
 macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
   if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
     if(CMAKE_REQUIRED_INCLUDES)

+ 2 - 0
Modules/CheckIncludeFiles.cmake

@@ -39,6 +39,8 @@
 # See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
 # to check for a single header file in ``C`` or ``CXX`` languages.
 
+include_guard(GLOBAL)
+
 macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
   if(NOT DEFINED "${VARIABLE}")
     set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")

+ 2 - 0
Modules/CheckLanguage.cmake

@@ -31,6 +31,8 @@
 #     message(STATUS "No Fortran support")
 #   endif()
 
+include_guard(GLOBAL)
+
 macro(check_language lang)
   if(NOT DEFINED CMAKE_${lang}_COMPILER)
     set(_desc "Looking for a ${lang} compiler")

+ 2 - 0
Modules/CheckLibraryExists.cmake

@@ -29,6 +29,8 @@
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
 #   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
+include_guard(GLOBAL)
+
 macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
   if(NOT DEFINED "${VARIABLE}")
     set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION

+ 1 - 1
Modules/CheckPrototypeDefinition.cmake

@@ -41,9 +41,9 @@
 
 #
 
-
 get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
 
+include_guard(GLOBAL)
 
 function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
 

+ 1 - 0
Modules/CheckStructHasMember.cmake

@@ -38,6 +38,7 @@
 # Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
 # HAVE_TIMEVAL_TV_SEC LANGUAGE C)
 
+include_guard(GLOBAL)
 include(CheckCSourceCompiles)
 include(CheckCXXSourceCompiles)
 

+ 2 - 0
Modules/CheckSymbolExists.cmake

@@ -43,6 +43,8 @@ the way the check is run:
   execute quietly without messages
 #]=======================================================================]
 
+include_guard(GLOBAL)
+
 macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
   if(CMAKE_C_COMPILER_LOADED)
     __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )

+ 4 - 2
Modules/CheckTypeSize.cmake

@@ -71,11 +71,13 @@
 include(CheckIncludeFile)
 include(CheckIncludeFileCXX)
 
+get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+include_guard(GLOBAL)
+
 cmake_policy(PUSH)
 cmake_policy(SET CMP0054 NEW)
 
-get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
-
 #-----------------------------------------------------------------------------
 # Helper function.  DO NOT CALL DIRECTLY.
 function(__check_type_size_impl type var map builtin language)

+ 2 - 0
Modules/CheckVariableExists.cmake

@@ -32,6 +32,8 @@
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
 #   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
+include_guard(GLOBAL)
+
 macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
   if(NOT DEFINED "${VARIABLE}")
     set(MACRO_CHECK_VARIABLE_DEFINITIONS