Skip to content

friendlyanon/check-type-align

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheckTypeAlign

This CMake module works similarly to CheckTypeSize, with the addition of the CHECK_TYPE_ALIGN_USE_EXTENSION cache variable. This can be set to something like __alignof__ on Clang or __alignof on MSVC to skip detection or to provide an extension that is not known by the module. Check the CheckTypeAlign.c.in source file for known compilers and their extensions. If you can help expanding the list, please open an issue.

The only real difference from CheckTypeSize is due to the way alignof is specified by the C++ and C standards; it cannot accept an expression as its argument, only a type-id. The compiler extensions all support the former, however the main target is the standard way, so the tests do not cover expressions. In C++ mode, you can still use decltype to convert an expression to a type.

This module requires CMake >= 3.9.

Usage

This module is usable as a proper CMake package:

find_package(CheckTypeAlign REQUIRED)
check_type_align(int ALIGNOF_INT)

Make sure find_package can find it when configuring your project.

About

Check the alignment requirement of a type in CMake

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published