-
Notifications
You must be signed in to change notification settings - Fork 0
CMake C Programs
Wiki ▸ CMake Build Logic ▸ CMake Scripts ▸ CMake C programs
A set of c programs are used to test compiler characteristics.
- CMakeHercTestAtomic.c
- CMakeHercTestC11Atomic.c
- CMakeHercTestC99FlexArrays.c
- CMakeHercTestPackedStruct.c
- CMakeHercTestRegparm3.c
- CMakeHercTestStrictAliasing.c
- CMakeHercTestStructPadding.c
- CMakeHercTestSync.c
Most of these programs are run via CMake try_compile commands coded in functions defined in Herc00_Includes.
Compiled by a try_compile command, this program tests if selected atomic operations are supported by the c compiler. This program is run only if C11 atomic operations are not available.
Scripts Herc25_Compilergcclike.cmake and Herc25_CompilerMSVC.cmake for gcc-like and MSVC compilers respectively used this c program directly.
Executed by a try_run command in function herc_Check_C11_Atomics in Herc00_Includes.cmake; while this confounds cross-compilation, gcc 4.9.2 requires program execution because the test result comes from a function call, not a macro definition.
This c program creates a CMake script of set commands that create CMake variables defining whether C11 Atomics are lock-free. The script name is determined by the caller of the herc_Check_C11_Atomics function. The file is currently named CMakeHercC11LockFree.cmake and is built in the binary directory.
Scripts Herc25_Compilergcclike.cmake and Herc25_CompilerMSVC.cmake for gcc-like and MSVC compilers respectively used this c program by calling herc_Check_C11_Atomics.
Compiled by a try_compile command, this program tests if selected _sync_ built-in functions are available in the c compiler. This program is run only if C11 atomic operations and Atomic operations are not available.
Scripts Herc25_Compilergcclike.cmake and Herc25_CompilerMSVC.cmake for gcc-like and MSVC compilers respectively used this c program directly.
This Wiki page Copyright © 2018 by Stephen R. Orso. This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.