The release of the cross-platform open source build script generator CMake 4.0.0 is presented. It acts as an alternative to Autotools and is used in such projects as KDE, LLVM/Clang, MySQL, MariaDB, ReactOS and Blender. The CMake code is written in C++ and is distributed under the BSD license.
CMake is notable for providing a simple scripting language, extending functionality through modules, caching support, cross-compilation tools, support for generating build files for a wide range of build systems and compilers, ctest and cpack utilities for defining test scripts and package builds, cmake utility -gui to interactively set build options.
Major changes:
- Compatibility with CMake versions prior to 3.5 has been broken. Linking to unsupported versions will now throw an error in cmake_minimum_required() and cmake_policy().
- Added environment variable "CMAKE_POLICY_VERSION_MINIMUM" to override the minimum CMake version whose functionality is required to build the project. The added variable allows you to do without changing the cmake_minimum_required(VERSION) and cmake_policy(VERSION) calls in the project itself, for example, to configure the version policy in projects that do not provide such an option.
- In the generator expression "$ " added the "NATIVE_PATH" operation to convert a file path from the CMake representation (which always uses "/" to separate directories) to a system path (Unix-like systems use "/", and Windows — «\»).
- On the platform macOS When using Ninja-based build script generators and Makefile generators, if a compiler is present in the /usr/bin directory, it is now left as is, without being linked to the compiler in Xcode. When building for the platform macOS The default behavior of selecting the SDK and passing the "-isysroot" flag to the compiler has been discontinued (the SDK is now selected by the compiler itself, not by CMake).
- Added the LINK_WARNING_AS_ERROR property, which will treat linker warnings as errors. To disable this property, the command line option "--link-no-warning-as-error" was added.
- The cmake utility has a "--project-file" option for specifying an alternative name for the CMakeLists.txt file.
- The CPack generator now has the ability to create uncompressed tar archives.
- The target_link_libraries() command and the CMAKE_EXE_LINKER_FLAGS*, CMAKE_SHARED_LINKER_FLAGS*, CMAKE_MODULE_LINKER_FLAGS* variables have been updated to support the "LINKER:" prefix.
- New variables added:
- CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL,
- CMAKE_ _LINK_MODE,
- CMAKE_ _DEVICE_LINK_MODE,
- CMAKE_LINK_WARNING_AS_ERROR,
- CMAKE_MSVC_RUNTIME_CHECKS,
- CMAKE_DEBUGGER_WORKING_DIRECTORY,
- CMAKE_XCODE_SCHEME_LLDB_INIT_FILE,
- CMAKE_XCODE_SCHEME_TEST_CONFIGURATION.
- Added new properties: DEBUGGER_WORKING_DIRECTORY and VS_SOLUTION_ITEMS (for attaching files to .sln for Visual Studio).
- Generation of ready-made CMake assemblies for SunOS for sparc64 and x86_64 architectures is provided.
Source: opennet.ru
