cmake-init icon indicating copy to clipboard operation
cmake-init copied to clipboard

HP-UX and other platforms with older CMake distributions

Open friendlyanon opened this issue 4 years ago • 0 comments

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 DESTINATION arguments for install(TARGETS) was added in CMake 3.14.
    • Solution is to use the older form of the install(TARGETS) command with explicit destinations set. See the NAME LINK section of this example's README for the version you target. The code in the cmake-3.8 branch works for any older version, the command only changed in 3.12 and 3.14.
  • The ARCH_INDEPENDENT argument (useful mainly for header-only libraries) for the write_basic_package_version_file command was added in CMake 3.14.
    • The CMAKE_SIZEOF_VOID_P variable needs to be temporarily unset for the command call.
  • The documentation code (only available in dev mode) uses FetchContent (added in CMake 3.11) and the FetchContent_MakeAvailable command (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_DOCS variables 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.
  • 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_literals or c_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.

Everything else relates to docs:

  • cmake itself 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.
  • The -S and -B flags were added in CMake 3.13. Prior versions required you navigating to the binary directory and invoking cmake with the source directory without a flag.
  • --install was added in CMake 3.15.

friendlyanon avatar Dec 30 '21 15:12 friendlyanon