CMake 3.2 Release Notes¶
Contents
Changes made since CMake 3.1 include the following.
New Features¶
Syntax¶
- CMake learned to support unicode characters
encoded as UTF-8
on Windows. This was already supported on platforms whose
system APIs accept UTF-8 encoded strings.
Unicode characters may now be used in CMake code, paths to
source files, configured files such as
.h.in
files, and other files read and written by CMake. Note that because CMake interoperates with many other tools, there may still be some limitations when using certain unicode characters.
Commands¶
- The
add_custom_command()
andadd_custom_target()
commands learned a newBYPRODUCTS
option to specify files produced as side effects of the custom commands. These are not outputs because they do not always have to be newer than inputs. - The
add_custom_command()
andadd_custom_target()
commands learned a newUSES_TERMINAL
option to request that the command be given direct access to the terminal if possible. TheNinja
generator will places such commands in theconsole
pool
. Build targets provided by CMake that are meant for individual interactive use, such asinstall
, are now placed in this pool. - A new
continue()
command was added that can be called inside loop contexts to end the current iteration and start the next one at the top of the loop block. - The
file(LOCK)
subcommand was created to allow CMake processes to synchronize through file and directory locks. - The
file(STRINGS)
now supports UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE asENCODING
options. - The
install(EXPORT)
command now works with an absoluteDESTINATION
even if targets in the export set are installed with a destination or usage requirements specified relative to the install prefix. The value of theCMAKE_INSTALL_PREFIX
variable is hard-coded into the installed export file as the base for relative references. - The
try_compile()
command source file signature now honors link flags (e.g.CMAKE_EXE_LINKER_FLAGS
) in the generated test project. See policyCMP0056
. - The
try_run()
command learned to honor theLINK_LIBRARIES
option just astry_compile()
already does. - The
file(GENERATE)
command now generates the output file with the same permissions as the input file if set. - The
file(GENERATE)
command can now generate files which are used as source files for buildsystem targets. Generated files automatically get theirGENERATED
property set toTRUE
.
Variables¶
- The
CMAKE_MATCH_COUNT
variable was introduced to record the number of matches made in the last regular expression matched in anif()
command or astring()
command.
Properties¶
- An
ANDROID_API_MIN
target property was introduced to specify the minimum version to be targeted by the toolchain. - A
VS_SHADER_FLAGS
source file property was added to specify additional shader flags to.hlsl
files, for the Visual Studio generators.
Modules¶
- The
ExternalData
module learned to support Custom Fetch Scripts. This allows projects to specify custom.cmake
scripts for fetching data objects during the build. - The
ExternalProject
module learned options to create independent external project step targets that do not depend on the builtin steps. - The
ExternalProject
moduleExternalProject_Add()
command learned a newCMAKE_CACHE_DEFAULT_ARGS
option to initialize cache values in the external project without setting them on future builds. - The
ExternalProject
moduleExternalProject_Add()
command learned a newTEST_EXCLUDE_FROM_MAIN
option to exclude tests from the main build. - The
ExternalProject
moduleExternalProject_Add()
command learned a newUPDATE_DISCONNECTED
option to avoid automatically updating the source tree checkout from version control. - The
FindCUDA
module learned about thecusolver
library in CUDA 7.0. - The
FindGit
module learned to find thegit
command-line tool that comes with GitHub for Windows installed in user home directories. - A
FindGSL
module was introduced to find the GNU Scientific Library. - A
FindIntl
module was introduced to find the Gettextlibintl
library. - The
FindLATEX
module learned to support components. - The
FindMPI
module learned to find MS-MPI on Windows. - The
FindOpenSSL
module now reportscrypto
andssl
libraries separately inOPENSSL_CRYPTO_LIBRARY
andOPENSSL_SSL_LIBRARY
, respectively, to allow applications to link to one without the other. - The
WriteCompilerDetectionHeader
module learned to create a define for portability of thecxx_thread_local
feature. The define expands to either the C++11thread_local
keyword, or a pre-standardization compiler-specific equivalent, as appropriate. - The
WriteCompilerDetectionHeader
module learned to create multiple output files per compiler and per language, instead of creating one large file.
CTest¶
- The
ctest_coverage()
command learned to support Delphi coverage. - The
ctest_coverage()
command learned to support Javascript coverage. - The
CTestCoverageCollectGCOV
module was introduced as an alternative to thectest_coverage()
command for collectinggcov
results for submission to CDash.
CPack¶
- The
CPack RPM Generator
learned options to set per-component descriptions and summaries. See theCPACK_RPM_<component>_PACKAGE_DESCRIPTION
andCPACK_RPM_<component>_PACKAGE_SUMMARY
variables. - The
CPack RPM Generator
learned options to specify requirements for pre- and post-install scripts. See theCPACK_RPM_PACKAGE_REQUIRES_PRE
andCPACK_RPM_PACKAGE_REQUIRES_POST
variables. - The
CPack RPM Generator
learned options to specify requirements for pre- and post-uninstall scripts. See theCPACK_RPM_PACKAGE_REQUIRES_PREUN
andCPACK_RPM_PACKAGE_REQUIRES_POSTUN
variables. - The
CPack RPM Generator
learned a newCPACK_RPM_<COMPONENT>_PACKAGE_PREFIX
variable to specify a component-specific value to use instead ofCPACK_PACKAGING_INSTALL_PREFIX
. - The
CPack RPM Generator
learned a newCPACK_RPM_RELOCATION_PATHS
variable to specify multiple relocation prefixes for a single rpm package.
Other¶
- The
cmake(1)
-E tar
command now supports creating.xz
-compressed archives with theJ
flag. - The
cmake(1)
-E tar
command learned a new--files-from=<file>
option to specify file names using lines in a file to overcome command-line length limits. - The
cmake(1)
-E tar
command learned a new--mtime=<date>
option to specify the modification time recorded in tarball entries. - The
Compile Features
functionality is now aware of features supported by more compilers, including:- Apple Clang (
AppleClang
) for Xcode versions 4.4 though 6.1. - GNU compiler versions 4.4 through 5.0 on UNIX and Apple (
GNU
). - Microsoft Visual Studio (
MSVC
) for versions 2010 through 2015. - Oracle SolarisStudio (
SunPro
) version 12.4.
- Apple Clang (
- The AUTORCC feature now tracks files listed in
.qrc
files as dependencies. If an input file to thercc
tool is changed, the tool is automatically re-run.
Deprecated and Removed Features¶
- Files written in the
cmake-language(7)
, such asCMakeLists.txt
or*.cmake
files, are now expected to be encoded as UTF-8. If files are already ASCII, they will be compatible. If files were in a different encoding, including Latin 1, they will need to be converted. - The
FindOpenGL
module no longer explicitly searches for any dependency on X11 libraries with theFindX11
module. Such dependencies should not need to be explicit. Applications using X11 APIs themselves should find and link to X11 libraries explicitly. - The implementation of CMake now relies on some C++ compiler features which
are not supported by some older compilers. As a result, those old compilers
can no longer be used to build CMake itself. CMake continues to be able to
generate Makefiles and project files for users of those old compilers
however. Compilers known to no longer be capable of building CMake are:
- Visual Studio 6 and 7.0 – superseded by VisualStudio 7.1 and newer.
- GCC 2.95 – superseded by GCC 3 and newer compilers.
- Borland compilers – superseded by other Windows compilers.
- Compaq compilers – superseded by other compilers.
- SGI compilers – IRIX was dropped as a host platform.
Other Changes¶
On Windows and OS X, commands supporting network communication via
https
, such asfile(DOWNLOAD)
,file(UPLOAD)
, andctest_submit()
, now support SSL/TLS even when CMake is not built against OpenSSL. The Windows or OS X native SSL/TLS implementation is used by default. OS-configured certificate authorities will be trusted automatically.On other platforms, when CMake is built with OpenSSL, these commands now search for OS-configured certificate authorities in a few
/etc
paths to be trusted automatically.On OS X with Makefile and Ninja generators, when a compiler is found in
/usr/bin
it is now mapped to the corresponding compiler inside the Xcode application folder, if any. This allows such build trees to continue to work with their original compiler even whenxcode-select
switches to a different Xcode installation.The Visual Studio generators now write solution and project files in UTF-8 instead of Windows-1252. Windows-1252 supported Latin 1 languages such as those found in North and South America and Western Europe. With UTF-8, additional languages are now supported.
The
Xcode
generator no longer requires a value for theCMAKE_MAKE_PROGRAM
variable to be located up front. It now locatesxcodebuild
when needed at build time.When building CMake itself using SolarisStudio 12, the default
libCStd
standard library is not sufficient to build CMake. The SolarisStudio distribution supports compiler options to useSTLPort4
orlibstdc++
. An appropriate option to select the standard library is now added automatically when building CMake with SolarisStudio compilers.