CMake 3.7 Release Notes¶
Contents
Changes made since CMake 3.6 include the following.
New Features¶
Platforms¶
CMake now supports Cross Compiling for Android with simple toolchain files.
The Clang compiler is now supported on AIX.
Generators¶
The
Ninja
generator learned to conditionally support Fortran when using aninja
tool that has the necessary features. See generator documentation for details.The
Ninja
generator learned to produce phony targets of the formsub/dir/{test,install,package}
to drive the build of a subdirectory installation, test or packaging target. This is equivalent tocd sub/dir; make {test,install,package}
with Makefile Generators.The
Visual Studio 15 2017
generator was added. This is experimental and based on “Visual Studio 2017 RC” because this version of VS has not been released.Visual Studio Generators for VS 2010 and above learned to place
.natvis
source files into VS project files properly.The
Xcode
generator’s rudimentary Swift language support learned to honor a newCMAKE_Swift_LANGUAGE_VERSION
variable to tell Xcode what version of Swift is used by the source.The
CodeLite
generator gained a newCMAKE_CODELITE_USE_TARGETS
option to change project creation from projects to targets.
Commands¶
The
add_custom_command()
command gained a newDEPFILE
option that works with theNinja
generator to provide implicit dependency information to the build tool.The
cmake_parse_arguments()
command gained a newPARSE_ARGV
mode to read arguments directly fromARGC
andARGV#
variables inside afunction()
body.The
export()
command gained anANDROID_MK
option to generateAndroid.mk
files referencing CMake-built libraries as prebuilts for the Android NDK build system.The
file(DOWNLOAD)
andfile(UPLOAD)
commands gainedHTTPHEADER <HTTP-header>
andUSERPWD <username>:<password>
options.The
find_library()
andfind_package()
commands learned to search inlib32/
directories when the build targets a 32-bit architecture. See theFIND_LIBRARY_USE_LIB32_PATHS
global property.The
find_package()
command gained the possibility of sorting compatible libraries byNAME
or byNATURAL
sorting by setting the two new variablesCMAKE_FIND_PACKAGE_SORT_ORDER
andCMAKE_FIND_PACKAGE_SORT_DIRECTION
.The
if()
command gained new boolean comparison operationsLESS_EQUAL
,GREATER_EQUAL
,STRLESS_EQUAL
,STRGREATER_EQUAL
,VERSION_LESS_EQUAL
, andVERSION_GREATER_EQUAL
.The
install()
command gained anEXPORT_ANDROID_MK
subcommand to installAndroid.mk
files referencing installed libraries as prebuilts for the Android NDK build system.The
string(TIMESTAMP)
andfile(TIMESTAMP)
commands gained support for the%a
and%b
placeholders. These are the abbreviated weekday and month names.The
try_compile()
command source file signature now honors configuration-specific flags (e.g.CMAKE_<LANG>_FLAGS_DEBUG
) in the generated test project. Previously only the default such flags for the current toolchain were used. See policyCMP0066
.
Variables¶
Variable
CMAKE_FIND_PACKAGE_SORT_ORDER
was added to control the sorting mode of thefind_package()
command.Variable
CMAKE_FIND_PACKAGE_SORT_DIRECTION
was added to control the sorting direction thefind_package()
command.Toolchain files
may now set aCMAKE_<LANG>_FLAGS_INIT
variable to initialize theCMAKE_<LANG>_FLAGS
cache entry the first time a language is enabled in a build tree.Toolchain files
may now setCMAKE_EXE_LINKER_FLAGS_INIT
,CMAKE_SHARED_LINKER_FLAGS_INIT
, andCMAKE_MODULE_LINKER_FLAGS_INIT
variables to initialize theCMAKE_EXE_LINKER_FLAGS
,CMAKE_SHARED_LINKER_FLAGS
, andCMAKE_MODULE_LINKER_FLAGS
cache entries the first time a language is enabled in a build tree.
Properties¶
On Apple platforms the
BUNDLE_EXTENSION
target property now also applies to Frameworks and App Bundles.A
BINARY_DIR
directory property was added to get the absolute path to the binary directory corresponding to the source directory on which the property is read.A
BUILDSYSTEM_TARGETS
directory property was added to get the list of logical buildsystem target names added by the project in a directory.A
LINK_WHAT_YOU_USE
target property and supportingCMAKE_LINK_WHAT_YOU_USE
variable were introduced to detect (on UNIX) shared libraries that are linked but not needed by runningldd -r -u
.A
SOURCE_DIR
directory property was added to get the absolute path to the source directory associated with a directory.A
SUBDIRECTORIES
directory property was added to get the list of subdirectories added by a project in a directory.A
VS_SDK_REFERENCES
target property was added to tell Visual Studio Generators to reference the named SDKs.A
VS_TOOL_OVERRIDE
source file property was created to tell Visual Studio Generators what tool to use for a source file.The
WINDOWS_EXPORT_ALL_SYMBOLS
target property now applies to executable targets with theENABLE_EXPORTS
property set.A
XCODE_FILE_ATTRIBUTES
source file property was added to tell theXcode
generator to generate custom content in the Xcode project attributes for the file.
Modules¶
An
AndroidTestUtilities
module was added to manage transfer of test data to an Android device.The
CheckFortranSourceCompiles
module macroCHECK_Fortran_SOURCE_COMPILES
gained aSRC_EXT
option to specify a custom test Fortran source file extension.The
ExternalProject
module gainedHTTP_USERNAME
andHTTP_PASSWORD
options to set http download credentials.The
ExternalProject
module gained aHTTP_HEADER
option to add http download headers.The
FindBISON
moduleBISON_TARGET
macro learned a newREPORT_FILE
option to specify the bison--report-file=
option.The
FindBZip2
module now provides imported targets.A
FindICU
module was introduced to find the International Components for Unicode (ICU) libraries and programs.The
FindMatlab
module learned to find the SIMULINK and MAT components.The
FindMatlab
modulematlab_add_mex()
command learned to add executables and modules.The
FindMatlab
modulematlab_add_unit_test()
command learned to support inline Matlab test code.The
FindOpenCL
module now provides imported targets.The
FindOpenMP
module learned to detect the OpenMP version (specification date) from the compiler.A
FindVulkan
module was added.The
GenerateExportHeader
module learned a newCUSTOM_CONTENT_FROM_VARIABLE
option to specify a variable containing custom content for inclusion in the generated header.The
GNUInstallDirs
module gained a newGNUInstallDirs_get_absolute_install_dir()
command.The
UseJava
module gained APIs to “export” jar targets for use by external CMake projects. See theinstall_jar_exports
andexport_jars
functions.
CTest¶
CTest now supports test fixtures through the new
FIXTURES_SETUP
,FIXTURES_CLEANUP
andFIXTURES_REQUIRED
test properties. When using regular expressions or--rerun-failed
to limit the tests to be run, a fixture’s setup and cleanup tests will automatically be added to the execution set if any test requires that fixture.The
ctest_configure()
,ctest_build()
,ctest_test()
,ctest_coverage()
, andctest_upload()
commands gained a newCAPTURE_CMAKE_ERROR
option to capture any errors that occur as the commands run into a variable and avoid affecting the return code of thectest(1)
process.
CPack¶
CPack gained a
CPack productbuild Generator
on OS X.CPack gained a new
CPACK_PACKAGE_CHECKSUM
variable to enable generation of a checksum file for each package file.The
CPack DEB Generator
learned to support long file names when archive format is set to GNU tar. SeeCPACK_DEBIAN_ARCHIVE_TYPE
The
CPackIFW
module gained a newcpack_ifw_add_package_resources()
command to include additional resources in the installer binary.The
CPackIFW
modulecpack_ifw_configure_component()
andcpack_ifw_configure_component_group()
commands gained a newUSER_INTERFACES
option to add a list of additional pages to the IFW installer.The
CPack RPM Generator
learned to generate debuginfo packages on demand. SeeCPACK_RPM_DEBUGINFO_PACKAGE
and its per component version.The
CPack RPM Generator
learned to generate source rpm (SRPM) packages on demand. SeeCPACK_RPM_PACKAGE_SOURCES
,CPACK_RPM_SOURCE_PKG_BUILD_PARAMS
andCPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX
.The
CPack NSIS Generator
now supportsCPACK_NSIS_<compName>_INSTALL_DIRECTORY
. This can be used to set component specific installation directories.The
CPack WIX Generator
now supportsCPACK_WIX_SKIP_PROGRAM_FOLDER
to allow specification of a custom absolute installation prefix outside of the ProgramFiles folders.The
CPack WIX Generator
now supportsCPACK_COMPONENT_<compName>_DISABLED
. This can be used to deselect a component from being installed by default.The
CPack WIX Generator
now supportsCPACK_WIX_PATCH_FILE
fragments for Feature elements.The
CPack WIX Generator
now supportsCPACK_WIX_ROOT_FEATURE_TITLE
andCPACK_WIX_ROOT_FEATURE_DESCRIPTION
to allow the specification of a custom title and description for the root feature element.
Other¶
cmake(1)
gained a-E capabilities
option to provide a machine-readable (JSON) description of the capabilities of the cmake tool (available generators, etc.).A new
cmake-server(7)
mode was added to provide semantic information about a CMake-generated buildsystem to clients through a JSON protocol. Currently all protocols are experimental and subject to change.The
cmake(1)
command learned a--trace-source=<file>
option.ccmake(1)
learned to support vim-like navigation bindings.cmake-gui(1)
gained a button to open the generated project file for Visual Studio Generators and theXcode
generator.
Deprecated and Removed Features¶
We no longer provide Linux i386 binaries for download from
cmake.org
for new versions of CMake.Vim support files
cmake-indent.vim
,cmake-syntax.vim
, andcmake-help.vim
have been removed in favor of the files now provided from the vim-cmake-syntax project.Support for building CMake itself with some compilers was dropped:
Visual Studio 7.1 and 2005 – superseded by VS 2008 and above
MinGW.org mingw32 – superseded by MSYS2 mingw32 and mingw64
CMake still supports generating build systems for other projects using these compilers.
Other Changes¶
The Fortran dependency scanner learned to support the syntax of Fortran Submodules.
Vim support files
indent/cmake.vim
andsyntax/cmake.vim
from the vim-cmake-syntax project are now distributed with CMake.