Skip to content

Conversation

@McDaMastR
Copy link

G'day! I recently came across this repo and think I'll find it very useful. This PR just contains a few improvements to the build system. I've been careful to ensure that no existing functionality is altered or removed.

The main changes are adding explicit CMake configuration options. I noticed the CMake files check for certain variables (such as ENABLE_SANITIZER and ENABLE_TESTS) that aren't declared elsewhere, implying they are intended as command-line options. For each such variable, an option() or set(CACHE) command is used to set an option of the same name prefixed with CWK_. The prefix helps prevent naming conflicts when this project is used as a dependency for, or otherwise included in, any other project. Though to maintain backwards compatibility, the default value of each such option is the value of the previous variable it corresponds to. So for example, CWK_ENABLE_TESTS defaults to the value of ENABLE_TESTS.

Two minor changes to the cmake_minimum_required() command are also included. While the minimum version was stated as 3.9.2, the project() command uses the HOMEPAGE_URL option, which requires at least version 3.12. The minimum version is thus bumped up to 3.12 to account for this. The FATAL_ERROR option is also appended to this command. This just ensures CMake versions of 2.4 and less fail to build with an explicit error.

Specify five CMake variables users can optionally set to configure the
build process. Each variable was used prior for configuration, but were
not explicitly declared as options. Each option is appended with 'CWK_'
to prevent potential naming conflicts when integrating with other build
systems. However, the default value of each such option is the value of
the previously named un-prefixed variable to ensure backwards
compatibility.

These changes mainly impact the top-level CMakeLists.txt, but related
files - including build documentation and GitHub workflows - are also
updated to reflect the new options.

Also increases the minimum required CMake version to 3.12 since the
project() command's HOMEPAGE_URL option was added in this version. And
adds FATAL_ERROR to the cmake_minimum_required command to ensure CMake
versions <= 2.4 fail with an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant