Skip to content
Stephen Orso edited this page May 13, 2018 · 1 revision

WikiCMake Build LogicCMake ScriptsHerc2x.cmake

The Herc2x scripts probe the target system and compiler. The last script uses the results of the probes and the user build options to set CMake variables that control the balance of the build and create config.h.

Only one of the two scripts Herc22_Userland.cmake and Herc22_UserlandWin.cmake are run when configuring Hercules depending on the target system. Only one of the two scripts Herc25_Compilergcclike.cmake and Herc25_CompilerMSVC.cmake are run when configuring Hercules depending on the c compiler in use.

This script probes the target system's characteristics. This includes the size of the following types: int, ``size_t, long`, `int *`, and `off_t`.

If building for Windows or off_t is 8, large file system support is presumed to exist. Otherwise, this script tests for GNU/Linux variables that indicate the availability of large file support, _LFS_LARGEFILE and _LFS64_LARGEFILE

GNU/Linux, BSD, and macOS systems only.

There are two Apple-specific tests in one section of this script. Apart from that, there are no differences in the tests required for BSD, GNU/Linux, and macOS systems.

There are a number of WIN32 tests left over from a prior design for the CMake build. These should be removed from this script.

Windows systems only. Windows systems are relatively homogeneous; this script is not long. Coments in the code are the best source of enlightenment about the script's logic.

Used for gcc and c compilers that present a gcc appearance such as clang, including clang on macOS and on FreeBSD.

Used for the c compiler included with Microsoft Visual Studio 2008 and newer or Microsoft C++ Express Edition 2008.

This script combines builder-specified options and information from the target system, userland, and compiler to set variables that will a) control the remainder of the configuration and b) become the basis for config.h. Despite this being a keystone of the CMake build scripts, most of it is straightforward.


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.