mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
Check*: Added include guards
This commit is contained in:
@@ -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.
|
in such variables may cause a false negative for this check.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
include(CMakeCheckCompilerFlagCommonPatterns)
|
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)
|
macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
||||||
if(NOT DEFINED "${VAR}")
|
if(NOT DEFINED "${VAR}")
|
||||||
|
@@ -60,6 +60,8 @@ subsequently be run.
|
|||||||
|
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||||
if(NOT DEFINED "${VAR}")
|
if(NOT DEFINED "${VAR}")
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
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.
|
in such variables may cause a false negative for this check.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
include(CMakeCheckCompilerFlagCommonPatterns)
|
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)
|
macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
|
||||||
if(NOT DEFINED "${VAR}")
|
if(NOT DEFINED "${VAR}")
|
||||||
set(_FAIL_REGEX)
|
set(_FAIL_REGEX)
|
||||||
|
@@ -60,6 +60,8 @@ subsequently be run.
|
|||||||
|
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
|
macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
|
||||||
if(NOT DEFINED "${VAR}")
|
if(NOT DEFINED "${VAR}")
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
|
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.
|
in such variables may cause a false negative for this check.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
include(CheckFortranSourceCompiles)
|
include(CheckFortranSourceCompiles)
|
||||||
include(CMakeCheckCompilerFlagCommonPatterns)
|
include(CMakeCheckCompilerFlagCommonPatterns)
|
||||||
|
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
#
|
#
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
|
macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
|
||||||
if(NOT DEFINED ${VARIABLE})
|
if(NOT DEFINED ${VARIABLE})
|
||||||
message(STATUS "Looking for Fortran ${FUNCTION}")
|
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)
|
macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
|
||||||
if(NOT DEFINED "${VAR}")
|
if(NOT DEFINED "${VAR}")
|
||||||
|
@@ -38,6 +38,8 @@
|
|||||||
# * ``check_function_exists()`` only verifies linking, it does not verify
|
# * ``check_function_exists()`` only verifies linking, it does not verify
|
||||||
# that the function is declared in system headers.
|
# that the function is declared in system headers.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
|
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
# at once. See the :module:`CheckIncludeFileCXX` module to check for headers
|
# at once. See the :module:`CheckIncludeFileCXX` module to check for headers
|
||||||
# using the ``CXX`` language.
|
# using the ``CXX`` language.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
|
macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}")
|
||||||
if(CMAKE_REQUIRED_INCLUDES)
|
if(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
|
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
|
||||||
# to check for one or more ``C`` headers.
|
# to check for one or more ``C`` headers.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
|
macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
|
||||||
if(CMAKE_REQUIRED_INCLUDES)
|
if(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
|
# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
|
||||||
# to check for a single header file in ``C`` or ``CXX`` languages.
|
# to check for a single header file in ``C`` or ``CXX`` languages.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}")
|
||||||
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
|
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
# message(STATUS "No Fortran support")
|
# message(STATUS "No Fortran support")
|
||||||
# endif()
|
# endif()
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(check_language lang)
|
macro(check_language lang)
|
||||||
if(NOT DEFINED CMAKE_${lang}_COMPILER)
|
if(NOT DEFINED CMAKE_${lang}_COMPILER)
|
||||||
set(_desc "Looking for a ${lang} compiler")
|
set(_desc "Looking for a ${lang} compiler")
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
|
macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}")
|
||||||
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
|
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
|
||||||
|
@@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
|
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
|
# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h
|
||||||
# HAVE_TIMEVAL_TV_SEC LANGUAGE C)
|
# HAVE_TIMEVAL_TV_SEC LANGUAGE C)
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ the way the check is run:
|
|||||||
execute quietly without messages
|
execute quietly without messages
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
|
macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
|
||||||
if(CMAKE_C_COMPILER_LOADED)
|
if(CMAKE_C_COMPILER_LOADED)
|
||||||
__CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
|
__CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
|
||||||
|
@@ -71,11 +71,13 @@
|
|||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
|
|
||||||
|
get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
cmake_policy(PUSH)
|
cmake_policy(PUSH)
|
||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
|
||||||
get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Helper function. DO NOT CALL DIRECTLY.
|
# Helper function. DO NOT CALL DIRECTLY.
|
||||||
function(__check_type_size_impl type var map builtin language)
|
function(__check_type_size_impl type var map builtin language)
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
# CMAKE_REQUIRED_QUIET = execute quietly without messages
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
|
macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
|
||||||
if(NOT DEFINED "${VARIABLE}")
|
if(NOT DEFINED "${VARIABLE}")
|
||||||
set(MACRO_CHECK_VARIABLE_DEFINITIONS
|
set(MACRO_CHECK_VARIABLE_DEFINITIONS
|
||||||
|
Reference in New Issue
Block a user