Commit 4d611868 authored by Cristian Adam's avatar Cristian Adam 💬
Browse files

Check*: Added include guards

parent 65f21a7e
Pipeline #83165 passed with stage
......@@ -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)
......
......@@ -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}")
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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}")
......
......@@ -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}")
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -34,6 +34,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")
......
......@@ -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")
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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}" )
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment