cmake-init
cmake-init copied to clipboard
HP-UX and other platforms with older CMake distributions
HP-UX in particular cannot use CMake >= 3.10, because of a missing C++11 compiler. (ref)
Things that need to be removed/changed in a generated project to accomodate older CMake versions:
- Omitting the
DESTINATIONarguments forinstall(TARGETS)was added in CMake 3.14.- Solution is to use the older form of the
install(TARGETS)command with explicit destinations set. See theNAME LINKsection of this example's README for the version you target. The code in thecmake-3.8branch works for any older version, the command only changed in 3.12 and 3.14.
- Solution is to use the older form of the
- The
ARCH_INDEPENDENTargument (useful mainly for header-only libraries) for thewrite_basic_package_version_filecommand was added in CMake 3.14.- The
CMAKE_SIZEOF_VOID_Pvariable needs to be temporarily unset for the command call.
- The
- The documentation code (only available in dev mode) uses
FetchContent(added in CMake 3.11) and theFetchContent_MakeAvailablecommand (added in CMake 3.14.- Since this only affects development, this isn't that much of an issue, because both the dev mode and
BUILD_MCSS_DOCSvariables need to be enabled to hit this code path. Depending on your needs, you can either add a version check around the docs code (if(CMAKE_VERSION VERSION_GREATER "3.13")) or entirely remove it.
- Since this only affects development, this isn't that much of an issue, because both the dev mode and
- Compile features to select a specific standard level was added in CMake 3.8.
- Selecting a language level can still sort of be emulated with using the concrete features like
cxx_binary_literalsorc_function_prototypes. Please note that older CMake versions are not aware of newer C++ and C standards, so check the docs of the CMake version you wish to use as a minimum for support.
- Selecting a language level can still sort of be emulated with using the concrete features like
Everything else relates to docs:
-
cmakeitself can't use presets prior to CMake 3.19, so the documentation should mention that.- Note that the CMake docs discourage tools invoking CMake with
--preset, so there could still be editors/IDEs that can make use of them.
- Note that the CMake docs discourage tools invoking CMake with
- The
-Sand-Bflags were added in CMake 3.13. Prior versions required you navigating to the binary directory and invokingcmakewith the source directory without a flag. -
--installwas added in CMake 3.15.