Skip to content

CMake Prototype Files

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

WikiCMake Build LogicCMake ScriptsCMake Prototype Files

Two prototype files are used to create headers needed to compile Hercules. Each defines C preprocessor macros. A third prototype file creates the CMake script that is run as part of the uninstall target.

This prototype is used to create config.h. A config.h file is used for Hercules builds on all target systems including Windows.

Windows-specific coding is located at the end of CMakeconfig.h.in, and comments describe Windows-specific requirements. Some of those requirements exist to preserve source compatibility with the legacy NMake-based Windows build process for Hercules. That legacy process did not have a configuration tool to probe the target Windows system's capabilities.

CMake does not create an uninstall target. This prototype creates a script that is used to uninstall Hercules based on the installation manifest CMake creates when Hercules is installed. It is based on a suggestion provided in the CMake community Wiki at:

https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/recipe/AddUninstallTarget.

The exec_program command in the original suggestion is deprecated and fails on CMake 3.10 on Windows. It has bee replaced in cmake_uninstall.cmake.in with execute_process.

This prototype is used by Herc01_GitVer.cmake, described here, to create commitinfo.h, a header file containing git status of the Hercules repository being used as the source. This header is used by version.c.


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.