Home GnuPG

build: Move common cmake and compiler settings to cmake modules

Description

build: Move common cmake and compiler settings to cmake modules

* CMakeLists.txt: Don't set a few variables. Include G10CMakeSettings
and G10CompilerSettings.
* cmake/modules/G10CMakeSettings.cmake,
cmake/modules/G10CompilerSettings.cmake: New.
* src/CMakeLists.txt: Don't set include directories for PRIVATE and
PUBLIC scope. Set include directory for INTERFACE scope.

The files G10CMakeSettings.cmake and G10CompilerSettings.cmake are
based on the corresponding KDE* files from KDE's Extra CMake Modules.
We'll use the same files for the Qt bindings. G10CompilerSettings adds
a few compiler definitions that were also added by autoconf, e.g.
_GNU_SOURCE, _LARGEFILE64_SOURCE, _FILE_OFFSET_BITS=64 (if needed),
and, for Windows builds, WIN32_LEAN_AND_MEAN, UNICODE, _UNICODE,
_USE_MATH_DEFINES, NOMINMAX.

The variables PACKAGE_STRING and PACKAGE_VERSION are not used. The
other variables previously set in the top-level CMakeLists.txt file
are set by G10CompilerSettings.

The PRIVATE and PUBLIC include directories are either not needed or
they are added automatically by cmake due to some settings in
G10CMakeSettings.