-
Notifications
You must be signed in to change notification settings - Fork 0
CMake CMakeLists.txt
Wiki ▸ CMake Build Logic ▸ CMake Scripts ▸ CMakeLists.txt
CMakeLists.txt files in the Hyperion source directory and the subdirectories crypto and decNumber.
CMakeLists.txt in the Source Directory
The following is done:
- Verifies the installed versions of CMake and git against the minimums required to build Hercules.
- Checks for an in-source build, or an attempt to use a source directory that was contaminated by a previous in-source build. Terminates if either are detected.
- Sets Position Independent Code (PIC) for all compiles. If the target system ABI does not support PIC, CMake silently ignores the setting.
- Determines the build type, and whether the selected build tool supports multiple build configurations.
- (Windows only) Determines whether a 32-bit or 64-bit Hercules will be built. If building a 32-bit Hercules on a 64-bit system and using the default installation prefix, append "(x86)" to the installation prefix root.
- Defines the installation target directories appropriate to the target system. Windows uses a different structure than UNIX-like systems or macOS.
- Includes CMake functions, both CMake-provided and CMake/Herc00_Includes.cmake, needed for the rest of the configuration.
- Includes CMake scripts from the Herc2x.cmake and Herc3x.cmake series as appropriate for the target system and the c compiler in use.
- If any errors were detected prior to this point, they are dumped to the console and the configuration terminated. - Errors detected after this point are considered to be internal to the CMake scripts and result in
message( FATAL_ERROR )termination of configuration.FATAL_ERRORmessages merit creation of a github issue. See What To Do When it Fails for the information that is helpful when creating a github issue. - Herc41_ExtPackageBuild is run to create CMake external projects--using
add_externalproject()--for any external packages that must be built from source at the same time Hercules is compiled. Creation of an external project is the same for any project; Herc02_ExtPackageBuild contains the function that issues the CMakeadd_externalproject()command. - A list of system link libraries required to link Hercules is assembled based on the results from Herc22*.
- The RPATH value for the build and install trees is set. CMake ignores RPATH for Windows targets, as Windows uses a different method for locating shared libraries and loadable modules.
-
config.his generated fromCMake/config.h.inand the information collected during configuration. -
commitinfo.his generated fromCMake/commitinfo.h.inby CMake/Herc01_GitVer.cmake. Note: Herc01_GitVer.cmake is re-run to updatecommitinfo.hevery time Hercules is built to capture changes in the git status. - A summary of the configuration options is displayed on the console.
- (Windows only) A command is added to copy external package shared libraries to the build directory. This is done only for those external packages built from source when Hercules is compiled.
- Finally, the tests subdirectory is copied to the build directory. This eliminates any dependency on the source directory when running tests. (Note: this needs to be updated so that updates to the source tests directory get propagated to the build directory.)
CMakeLists.txt in the decNumber Directory
This straightforward script uses information collected by the main CMakeLists.txt to compile the decNumber shared library. There is no complexity or sophistication to this script.
CMakeLists.txt in the tests Directory
This straightforward script creates test groups and tests. One CMake variable is a list of the test group names, and each test group name is a CMake variable listing the files that make up the test group. If an extension is not included for a file name, the extension .tst is assumed.
This script may need to be updated with a custom target for the test cases and supporting files so that updates in the Hercules-390 repository and/or its clone are propagated to the Hercules build directory.
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.