Skip to content

Files

Latest commit

Jul 3, 2025
026f9ce · Jul 3, 2025

History

History
49 lines (33 loc) · 1 KB

CheckAttribute.md

File metadata and controls

49 lines (33 loc) · 1 KB

PHP/CheckAttribute

This module checks if GNU C function or variable attribute is supported by the C compiler:

include(PHP/CheckAttribute)

Commands

This module provides the following commands:

php_check_function_attribute(<attribute> <result-var>)
php_check_variable_attribute(<attribute> <result-var>)
  • <attribute> Name of the attribute to check.

  • <result-var> Cache variable name to store the result of whether the C compiler supports the attribute <attribute>.

Supported function attributes:

  • ifunc
  • target
  • visibility

Supported variable attributes:

  • aligned

Examples

Basic usage:

# CMakeLists.txt
include(PHP/CheckAttribute)

php_check_function_attribute(ifunc HAVE_FUNC_ATTRIBUTE_IFUNC)
php_check_variable_attribute(aligned HAVE_ATTRIBUTE_ALIGNED)