diff options
author | Ryan Prichard <rprichard@google.com> | 2022-01-13 17:30:17 -0800 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2022-01-13 17:30:31 -0800 |
commit | 7aea7e9880110799088cd1de509886871078306f (patch) | |
tree | 5cf68b7dabd868f99ec4160cf1f7237ff63e4c37 /share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake | |
parent | d09ee7574f3e46668b23b3b6efebd0ea75de85b2 (diff) | |
download | darwin-x86-7aea7e9880110799088cd1de509886871078306f.tar.gz |
Update Darwin CMake prebuilt to 3.22.1HEADndk-r27-rc1ndk-r26dndk-r26cndk-r26bndk-r26-rc1ndk-r26-beta1ndk-r26ndk-r25cndk-r25bndk-r25-beta4ndk-r25-beta3ndk-r25-beta2ndk-r25-beta1ndk-r25rust-1.73.0ndk-r27-releasendk-r26-releasendk-r25-releasemastermainllvm-r487747llvm-r450784androidx-window-extensions-releaseandroidx-window-extensions-core-releaseandroidx-wear-wear-tooling-preview-releaseandroidx-wear-platform-releaseandroidx-wear-compose-releaseandroidx-tv-material-releaseandroidx-test-uiautomator-releaseandroidx-profileinstaller-releaseandroidx-privacysandbox-ads-releaseandroidx-platform-releaseandroidx-metrics-releaseandroidx-health-releaseandroidx-graphics-releaseandroidx-graphics-core-releaseandroidx-customview-customview-poolingcontainer-releaseandroidx-credential-releaseandroidx-core-remoteviews-releaseandroidx-core-performance-releaseandroidx-core-animation-releaseandroidx-compose-material3-adaptive-releaseandroidx-compose-g3-releaseandroidx-compose-compiler-releaseandroidx-compose-beta-releaseandroid-games-sdk-games-performance-tuner-releaseandroid-games-sdk-games-memory-advice-releaseandroid-games-sdk-games-frame-pacing-releaseandroid-games-sdk-games-controller-releaseandroid-games-sdk-game-text-input-releaseandroid-games-sdk-game-activity-release
Fusion2: http://fusion2/610fb8e3-5633-41a6-b50b-ed5819f55cd6
GCS path: gs://ndk-kokoro-release-artifacts/prod/ndk/cmake/darwin_release/3/20211215-131219
Prebuilt updated using: ndk/scripts/update_kokoro_prebuilts.py
Test: Treehugger, Kokoro presubmit
Bug: http://b/213946898
Change-Id: Icbb6d90cad49dbe67f168075508872b1704d9f61
Diffstat (limited to 'share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake')
-rw-r--r-- | share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake b/share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake new file mode 100644 index 0000000..d29c5e8 --- /dev/null +++ b/share/cmake-3.22/Modules/CheckPrototypeDefinition.cmake @@ -0,0 +1,131 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CheckPrototypeDefinition +------------------------ + +Check if the prototype we expect is correct. + +.. command:: check_prototype_definition + + .. code-block:: cmake + + check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE) + + :: + + FUNCTION - The name of the function (used to check if prototype exists) + PROTOTYPE- The prototype to check. + RETURN - The return value of the function. + HEADER - The header files required. + VARIABLE - The variable to store the result. + Will be created as an internal cache variable. + + Example: + + .. code-block:: cmake + + check_prototype_definition(getpwent_r + "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)" + "NULL" + "unistd.h;pwd.h" + SOLARIS_GETPWENT_R) + +The following variables may be set before calling this function to modify +the way the check is run: + +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + list of include directories. +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. +#]=======================================================================] + +# + +get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +include_guard(GLOBAL) + +function(check_prototype_definition _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) + + if (NOT DEFINED ${_VARIABLE}) + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_START "Checking prototype ${_FUNCTION} for ${_VARIABLE}") + endif() + set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n") + + set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if (CMAKE_REQUIRED_LINK_OPTIONS) + set(CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS + LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) + else() + set(CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS) + endif() + if (CMAKE_REQUIRED_LIBRARIES) + set(CHECK_PROTOTYPE_DEFINITION_LIBS + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_PROTOTYPE_DEFINITION_LIBS) + endif() + if (CMAKE_REQUIRED_INCLUDES) + set(CMAKE_SYMBOL_EXISTS_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CMAKE_SYMBOL_EXISTS_INCLUDES) + endif() + + foreach(_FILE ${_HEADER}) + string(APPEND CHECK_PROTOTYPE_DEFINITION_HEADER + "#include <${_FILE}>\n") + endforeach() + + set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION}) + set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE}) + set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN}) + + configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY) + + file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE) + + try_compile(${_VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS} + ${CHECK_PROTOTYPE_DEFINITION_LIBS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS} + "${CMAKE_SYMBOL_EXISTS_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + if (${_VARIABLE}) + set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_PASS "True") + endif() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" + "${OUTPUT}\n\n") + else () + if(NOT CMAKE_REQUIRED_QUIET) + message(CHECK_FAIL "False") + endif() + set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" + "${OUTPUT}\n\n${_SOURCE}\n\n") + endif () + endif() + +endfunction() |