CMake 3.7 Release Notes¶
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 - Ninjagenerator learned to conditionally support Fortran when using a- ninjatool that has the necessary features. See generator documentation for details.
- The - Ninjagenerator learned to produce phony targets of the form- sub/dir/{test,install,package}to drive the build of a subdirectory installation, test or packaging target. This is equivalent to- cd sub/dir; make {test,install,package}with Makefile Generators.
- The - Visual Studio 15 2017generator 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 - .natvissource files into VS project files properly.
- The - Xcodegenerator's rudimentary Swift language support learned to honor a new- CMAKE_Swift_LANGUAGE_VERSIONvariable to tell Xcode what version of Swift is used by the source.
- The - CodeLitegenerator gained a new- CMAKE_CODELITE_USE_TARGETSoption to change project creation from projects to targets.
Commands¶
- The - add_custom_command()command gained a new- DEPFILEoption that works with the- Ninjagenerator to provide implicit dependency information to the build tool.
- The - cmake_parse_arguments()command gained a new- PARSE_ARGVmode to read arguments directly from- ARGCand- ARGV#variables inside a- function()body.
- The - export()command gained an- ANDROID_MKoption to generate- Android.mkfiles referencing CMake-built libraries as prebuilts for the Android NDK build system.
- The - file(DOWNLOAD)and- file(UPLOAD)commands gained- HTTPHEADER <HTTP-header>and- USERPWD <username>:<password>options.
- The - find_library()and- find_package()commands learned to search in- lib32/directories when the build targets a 32-bit architecture. See the- FIND_LIBRARY_USE_LIB32_PATHSglobal property.
- The - find_package()command gained the possibility of sorting compatible libraries by- NAMEor by- NATURALsorting by setting the two new variables- CMAKE_FIND_PACKAGE_SORT_ORDERand- CMAKE_FIND_PACKAGE_SORT_DIRECTION.
- The - if()command gained new boolean comparison operations- LESS_EQUAL,- GREATER_EQUAL,- STRLESS_EQUAL,- STRGREATER_EQUAL,- VERSION_LESS_EQUAL, and- VERSION_GREATER_EQUAL.
- The - install()command gained an- EXPORT_ANDROID_MKsubcommand to install- Android.mkfiles referencing installed libraries as prebuilts for the Android NDK build system.
- The - string(TIMESTAMP)and- file(TIMESTAMP)commands gained support for the- %aand- %bplaceholders. 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 policy- CMP0066.
Variables¶
- Variable - CMAKE_FIND_PACKAGE_SORT_ORDERwas added to control the sorting mode of the- find_package()command.
- Variable - CMAKE_FIND_PACKAGE_SORT_DIRECTIONwas added to control the sorting direction the- find_package()command.
- Toolchain filesmay now set a- CMAKE_<LANG>_FLAGS_INITvariable to initialize the- CMAKE_<LANG>_FLAGScache entry the first time a language is enabled in a build tree.
- Toolchain filesmay now set- CMAKE_EXE_LINKER_FLAGS_INIT,- CMAKE_SHARED_LINKER_FLAGS_INIT, and- CMAKE_MODULE_LINKER_FLAGS_INITvariables to initialize the- CMAKE_EXE_LINKER_FLAGS,- CMAKE_SHARED_LINKER_FLAGS, and- CMAKE_MODULE_LINKER_FLAGScache entries the first time a language is enabled in a build tree.
Properties¶
- On Apple platforms the - BUNDLE_EXTENSIONtarget property now also applies to Frameworks and App Bundles.
- A - BINARY_DIRdirectory 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_TARGETSdirectory property was added to get the list of logical buildsystem target names added by the project in a directory.
- A - LINK_WHAT_YOU_USEtarget property and supporting- CMAKE_LINK_WHAT_YOU_USEvariable were introduced to detect (on UNIX) shared libraries that are linked but not needed by running- ldd -r -u.
- A - SOURCE_DIRdirectory property was added to get the absolute path to the source directory associated with a directory.
- A - SUBDIRECTORIESdirectory property was added to get the list of subdirectories added by a project in a directory.
- A - VS_SDK_REFERENCEStarget property was added to tell Visual Studio Generators to reference the named SDKs.
- A - VS_TOOL_OVERRIDEsource file property was created to tell Visual Studio Generators what tool to use for a source file.
- The - WINDOWS_EXPORT_ALL_SYMBOLStarget property now applies to executable targets with the- ENABLE_EXPORTSproperty set.
- A - XCODE_FILE_ATTRIBUTESsource file property was added to tell the- Xcodegenerator to generate custom content in the Xcode project attributes for the file.
Modules¶
- An - AndroidTestUtilitiesmodule was added to manage transfer of test data to an Android device.
- The - CheckFortranSourceCompilesmodule macro- CHECK_Fortran_SOURCE_COMPILESgained a- SRC_EXToption to specify a custom test Fortran source file extension.
- The - ExternalProjectmodule gained- HTTP_USERNAMEand- HTTP_PASSWORDoptions to set http download credentials.
- The - ExternalProjectmodule gained a- HTTP_HEADERoption to add http download headers.
- The - FindBISONmodule- BISON_TARGETmacro learned a new- REPORT_FILEoption to specify the bison- --report-file=option.
- The - FindBZip2module now provides imported targets.
- A - FindICUmodule was introduced to find the International Components for Unicode (ICU) libraries and programs.
- The - FindMatlabmodule learned to find the SIMULINK and MAT components.
- The - FindMatlabmodule- matlab_add_mex()command learned to add executables and modules.
- The - FindMatlabmodule- matlab_add_unit_test()command learned to support inline Matlab test code.
- The - FindOpenCLmodule now provides imported targets.
- The - FindOpenMPmodule learned to detect the OpenMP version (specification date) from the compiler.
- A - FindVulkanmodule was added.
- The - GenerateExportHeadermodule learned a new- CUSTOM_CONTENT_FROM_VARIABLEoption to specify a variable containing custom content for inclusion in the generated header.
- The - GNUInstallDirsmodule gained a new- GNUInstallDirs_get_absolute_install_dir()command.
- The - UseJavamodule gained APIs to "export" jar targets for use by external CMake projects. See the- install_jar_exportsand- export_jarsfunctions.
CTest¶
- CTest now supports test fixtures through the new - FIXTURES_SETUP,- FIXTURES_CLEANUPand- FIXTURES_REQUIREDtest properties. When using regular expressions or- --rerun-failedto 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(), and- ctest_upload()commands gained a new- CAPTURE_CMAKE_ERRORoption to capture any errors that occur as the commands run into a variable and avoid affecting the return code of the- ctest(1)process.
CPack¶
- CPack gained a - CPack productbuild Generatoron OS X.
- CPack gained a new - CPACK_PACKAGE_CHECKSUMvariable to enable generation of a checksum file for each package file.
- The - CPack DEB Generatorlearned to support long file names when archive format is set to GNU tar. See- CPACK_DEBIAN_ARCHIVE_TYPE
- The - CPackIFWmodule gained a new- cpack_ifw_add_package_resources()command to include additional resources in the installer binary.
- The - CPackIFWmodule- cpack_ifw_configure_component()and- cpack_ifw_configure_component_group()commands gained a new- USER_INTERFACESoption to add a list of additional pages to the IFW installer.
- The - CPack RPM Generatorlearned to generate debuginfo packages on demand. See- CPACK_RPM_DEBUGINFO_PACKAGEand its per component version.
- The - CPack RPM Generatorlearned to generate source rpm (SRPM) packages on demand. See- CPACK_RPM_PACKAGE_SOURCES,- CPACK_RPM_SOURCE_PKG_BUILD_PARAMSand- CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX.
- The - CPack NSIS Generatornow supports- CPACK_NSIS_<compName>_INSTALL_DIRECTORY. This can be used to set component specific installation directories.
- The - CPack WIX Generatornow supports- CPACK_WIX_SKIP_PROGRAM_FOLDERto allow specification of a custom absolute installation prefix outside of the ProgramFiles folders.
- The - CPack WIX Generatornow supports- CPACK_COMPONENT_<compName>_DISABLED. This can be used to deselect a component from being installed by default.
- The - CPack WIX Generatornow supports- CPACK_WIX_PATCH_FILEfragments for Feature elements.
- The - CPack WIX Generatornow supports- CPACK_WIX_ROOT_FEATURE_TITLEand- CPACK_WIX_ROOT_FEATURE_DESCRIPTIONto allow the specification of a custom title and description for the root feature element.
Other¶
- cmake(1)gained a- -E capabilitiesoption 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 the- Xcodegenerator.
Deprecated and Removed Features¶
- We no longer provide Linux i386 binaries for download from - cmake.orgfor new versions of CMake.
- Vim support files - cmake-indent.vim,- cmake-syntax.vim, and- cmake-help.vimhave 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.vimand- syntax/cmake.vimfrom the vim-cmake-syntax project are now distributed with CMake.
