CMake 3.4 Release Notes¶
Contents
Changes made since CMake 3.3 include the following.
New Features¶
Generators¶
The
Visual Studio 14 2015generator learned to select a Windows 10 SDK based on the value of theCMAKE_SYSTEM_VERSIONvariable and the SDKs available on the host.CMake learned rudimentary support for the Apple Swift language. When using the
Xcodegenerator with Xcode 6.1 or higher, one may enable theSwiftlanguage with theenable_language()command or theproject()command (this is an error with other generators or when Xcode is too old). Then one may list.swiftsource files in targets for compilation.
Commands¶
The
find_program()command learned aNAMES_PER_DIRoption to consider all givenNAMESin each directory before moving on to the next directory.The
get_filename_component()command learned a newBASE_DIRsubcommand. This is used to specify a base directory when calculating an absolute path from a relative path.The
if()command learned a newTESToperator that evaluates to true if a given test name has been defined by theadd_test()command. See policyCMP0064.The
install(DIRECTORY)commandDESTINATIONoption learned to supportgenerator expressions.The
install(FILES)commandDESTINATIONoption learned to supportgenerator expressions.The
string()command learned a newAPPENDsubcommand.
Variables¶
The Makefile Generators and the
Ninjagenerator learned to add compiler launcher tools like distcc and ccache along with the compiler forCandCXXlanguages. See theCMAKE_<LANG>_COMPILER_LAUNCHERvariable and<LANG>_COMPILER_LAUNCHERtarget property for details.New
CMAKE_LINK_SEARCH_START_STATICandCMAKE_LINK_SEARCH_END_STATICvariables were introduced to initialize theLINK_SEARCH_START_STATICandLINK_SEARCH_END_STATICtarget properties, respectively.
Properties¶
Visual Studio Generators learned to support additonal target properties to customize projects for NVIDIA Nsight Tegra Visual Studio Edition:
The
ARCHIVE_OUTPUT_DIRECTORY,LIBRARY_OUTPUT_DIRECTORY, andRUNTIME_OUTPUT_DIRECTORYtarget properties learned to supportgenerator expressions.The
SOURCE_DIRandBINARY_DIRtarget properties were introduced to allow project code to query where a target is defined.The
OUTPUT_NAMEtarget property and its variants learned to supportgenerator expressions.A
TARGET_MESSAGESglobal property was added to tell the Makefile Generators whether to generate commands to print output after each target is completed.On Windows with MS-compatible tools, CMake learned to optionally generate a module definition (
.def) file forSHAREDlibraries. See theWINDOWS_EXPORT_ALL_SYMBOLStarget property.
Modules¶
The
ExternalProjectmoduleExternalProject_Add()functionGIT_SUBMODULESoption now also limits the set of submodules that are initialized in addition to the prior behavior of limiting the set of submodules that are updated.The
ExternalProjectmodule learned newUSES_TERMINALarguments for giving steps exclusive terminal access. This is useful with theNinjagenerator to monitor CMake superbuild progress and prevent CPU oversubscription.The
FindBISONmoduleBISON_TARGETmacro learned a newDEFINES_FILEoption to specify a custom output header to be generated.The
FindHDF5module learend a newHDF5_PREFER_PARALLELoption allowing users to specify that a parallel HDF5 tool is preferred if both are available.The
FindIcemodule now provides imported targets.The
FindJavamodule learned to optionally find theidljandjarsignertools.The
FindOpenSSLmodule now provides imported targets.The
FindOpenSSLmodule learned a newOPENSSL_USE_STATIC_LIBSoption to search only for static libraries.The
FindPkgConfiglearned a newpkg_get_variable()command which may be used to query for arbitrary variables from a package (such as for related tools or data and plugin install paths).The
FindProtobufmodule gained a newprotobuf_generate_python()function to generate python sources from.protofiles.The
FindTIFFmodule learned to search separately for debug and release variants.The
FindwxWidgetsmodule learned to support version requests.The
FindXercesCmodule learned to search separately for debug and release variants.The
FindZLIBmodule learned to search separately for debug and release variants.The
GNUInstallDirsmodule learned special default values for certain installation prefixes according to the GNU Coding Standards and the Filesystem Hierarchy Standard.The
UseJavamoduleadd_jarfunction learned to support response files (e.g.@srcs.txt) for source specification.The
UseJavamoduleinstall_jarfunction learned newDESTINATIONandCOMPONENToptions to specify the correspondinginstall()command options.The
UseJavamodule gained a newcreate_javahfunction to create C headers from Java classes.
Generator Expressions¶
A new
$<SHELL_PATH:...>generator expressionhas been added.
CTest¶
CTest learned to optionally measure the CPU load during parallel testing and avoid starting tests that may cause the load to exceed a given threshold. See the
ctest(1)command--test-loadoption, theTestLoadsetting of the CTest Test Step, theCTEST_TEST_LOADvariable, and theTEST_LOADoption of thectest_test()command.ctest(1)learned options--test-output-size-passedand--test-output-size-failedto customize the limit on test output size submitted when running as a Dashboard Client.
CPack¶
The
CPackDebmodule learned to set package dependencies per component. See variables:The
CPackmodule learned to package empty directories.The
CPackmodule gained a new setting,CPACK_VERBATIM_VARIABLES, which can be used to ensure the cpack program receives the settings’ values exactly as they were set, even if they contain CMake-special characters. For compatibility, it’s off by default.
Other¶
The
Compile Featuresfunctionality is now aware of features supported by GNU C compilers on Windows.CMake learned to honor
*.manifestsource files with MSVC tools. Manifest files named as sources of.exeand.dlltargets will be merged with linker-generated manifests and embedded in the binary.The Concurrent Fortran 77 compiler is now supported. Its
compiler idisCCur.cmake(1)gained a new--trace-expandcommand line option that is like--tracebut expands variable references in the output.
Deprecated and Removed Features¶
The
CMakeExpandImportedTargetsmodule is now documented as deprecated. See module documentation for an explanation.The
CMAKE_USE_RELATIVE_PATHSvariable no longer has any effect. Previously it was partially implemented and unreliable.
Other Changes¶
The
CheckFunctionExists,CheckLibraryExists,CheckSymbolExists, andFindThreadsmodules learned to work in environments where only CXX is enabled.The
CPackDebmodule now correctly excludes symlinks during package checksum calculation.The
CPackDebno longer uses fakeroot and system tar program for packaging.The
CPackmodule no longer mangles settings with CMake-special characters when they’re used as defaults for other settings. The macrocpack_set_if_not_set, which was responsible for this, is now deprecated.CMake no longer links executables with flags to export symbols unless the
ENABLE_EXPORTStarget property is set. See policyCMP0065.The
SONAMEfield is no longer set forMODULElibraries created with theadd_library()command.MODULElibraries are meant for explicit dynamic loading at runtime. They cannot be linked soSONAMEis not useful.The internal
CMAKE_<LANG>_COMPILE_OBJECTrule variable now substitutes compiler include flags in a separate<INCLUDES>placeholder instead of the main<FLAGS>placeholder.