Generates Visual Studio 17 (VS 2022) project files.
-.. warning::
-
- This is experimental and based on "Visual Studio 2022 Preview 4".
- As of this version of CMake, VS 2022 has not been released.
-
Project Types
^^^^^^^^^^^^^
Toolset Selection
^^^^^^^^^^^^^^^^^
-The ``v143`` toolset that comes with VS 17 2022 Preview 4 is selected by
-default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
+The ``v143`` toolset that comes with VS 17 2022 is selected by default.
+The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
.. |VS_TOOLSET_HOST_ARCH_DEFAULT| replace::
Generators
----------
-* The :generator:`Visual Studio 17 2022` generator was added. This is
- experimental and based on "Visual Studio 2022 Preview 4" because this
- version of VS has not been released.
+* The :generator:`Visual Studio 17 2022` generator was added.
* The :ref:`Makefile Generators` and the :generator:`Ninja` generator
learned to add linker launcher tools along with the linker for ``C``,
* ``hipcc`` may once again be used as a ``CXX`` compiler, and is treated as
whatever compiler it selects underneath, as CMake 3.20 and below did.
+
+3.21.4
+------
+
+* The :generator:`Visual Studio 17 2022` generator is now based on the
+ "Visual Studio 2022" release candidates. Previously it was based on
+ preview versions.
endif()
list(PREPEND _CMAKE_AR_NAMES "llvm-ar")
list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib")
- list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip")
+ if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 11)
+ # llvm-strip versions prior to 11 require additional flags we do not yet add.
+ list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip")
+ endif()
list(PREPEND _CMAKE_NM_NAMES "llvm-nm")
if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 9)
# llvm-objdump versions prior to 9 did not support everything we need.
"QtIFW-")
set(_CPACK_IFW_VERSIONS
+ "4.1"
"4.0"
"3.2"
"3.2.0"
cxx_std_14
cxx_std_17
cxx_std_20
+ cxx_std_23
)
_record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
endmacro()
set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17)
endif()
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
+ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+else()
+ # Before NVHPC 21.07 the `-MD` flag implicitly
+ # implies `-E` and therefore compilation and dependency generation
+ # can't occur in the same invocation
+ set(CMAKE_C_DEPENDS_EXTRA_COMMANDS "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
+endif()
+
__compiler_nvhpc(C)
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20)
endif()
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
+ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+ set(CMAKE_CXX_DEPFILE_FORMAT gcc)
+ set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
+else()
+ # Before NVHPC 21.07 the `-MD` flag implicitly
+ # implies `-E` and therefore compilation and dependency generation
+ # can't occur in the same invocation
+ set(CMAKE_CXX_DEPENDS_EXTRA_COMMANDS "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c++ -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
+endif()
__compiler_nvhpc(CXX)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
-
- if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
- set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
- set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
- set(CMAKE_${lang}_DEPENDS_USE_COMPILER TRUE)
- else()
- # Before NVHPC 21.07 the `-MD` flag implicitly
- # implies `-E` and therefore compilation and dependency generation
- # can't occur in the same invocation
- set(CMAKE_${lang}_DEPENDS_EXTRA_COMMANDS "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> ${CMAKE_${lang}_COMPILE_OPTIONS_EXPLICIT_LANGUAGE} -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
- endif()
-
endmacro()
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2021b=9.11"
"R2021a=9.10"
"R2020b=9.9"
"R2020a=9.8"
# configuration changes.
if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake
OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake
- OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake
OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake
- IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in
+ IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/Output.cmake.in
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt
OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake
"User executables (bin)")
_GNUInstallDirs_cache_path(CMAKE_INSTALL_SBINDIR "sbin"
"System admin executables (sbin)")
+_GNUInstallDirs_cache_path(CMAKE_INSTALL_LIBEXECDIR "libexec"
+ "Program executables (libexec)")
_GNUInstallDirs_cache_path(CMAKE_INSTALL_SYSCONFDIR "etc"
"Read-only single-machine data (etc)")
_GNUInstallDirs_cache_path(CMAKE_INSTALL_SHAREDSTATEDIR "com"
unset(_libdir_set)
unset(__LAST_LIBDIR_DEFAULT)
-if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
- AND NOT CMAKE_CROSSCOMPILING
- AND NOT EXISTS "/etc/arch-release"
- AND EXISTS "/etc/debian_version" # is this a debian system ?
- AND "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
- # see https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrlibexec
- # and https://www.debian.org/doc/debian-policy/ch-opersys#file-system-structure (section 9.1.1 bullet point 4)
- _GNUInstallDirs_cache_path(CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}"
- "Program executables (${CMAKE_INSTALL_LIBDIR})")
-else()
- _GNUInstallDirs_cache_path(CMAKE_INSTALL_LIBEXECDIR "libexec"
- "Program executables (libexec)")
-endif()
_GNUInstallDirs_cache_path(CMAKE_INSTALL_INCLUDEDIR "include"
"C header files (include)")
_GNUInstallDirs_cache_path(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include"
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 144)
message(WARNING "MSVC toolset v${MSVC_TOOLSET_VERSION} not yet supported.")
elseif(MSVC_TOOLSET_VERSION EQUAL 143)
- set(MSVC_REDIST_NAME VC142)
+ set(MSVC_REDIST_NAME VC143)
set(_MSVC_DLL_VERSION 140)
set(_MSVC_IDE_VERSION 17)
elseif(MSVC_TOOLSET_VERSION EQUAL 142)
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 21)
-set(CMake_VERSION_PATCH 3)
+set(CMake_VERSION_PATCH 4)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[7612abd52f CMake 3.21.3]==])
+ set(git_info [==[f65cebf51a CMake 3.21.4]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"RELATIVEDIR: \"" << relativeDir << "\"" << std::endl);
-#ifdef WIN32
+#ifdef _WIN32
std::string mode_t_adt_filename = file + ":cmake_mode_t";
cmsys::ifstream permissionStream(mode_t_adt_filename.c_str());
#include "cmAddTestCommand.h"
#include "cmBreakCommand.h"
#include "cmBuildCommand.h"
+#include "cmCMakeLanguageCommand.h"
#include "cmCMakeMinimumRequired.h"
#include "cmCMakePathCommand.h"
#include "cmCMakePolicyCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
# include "cmBuildNameCommand.h"
# include "cmCMakeHostSystemInformationCommand.h"
-# include "cmCMakeLanguageCommand.h"
# include "cmExportCommand.h"
# include "cmExportLibraryDependenciesCommand.h"
# include "cmFLTKWrapUICommand.h"
state->AddFlowControlCommand("return", cmReturnCommand);
state->AddFlowControlCommand("while", cmWhileCommand);
+ state->AddBuiltinCommand("cmake_language", cmCMakeLanguageCommand);
state->AddBuiltinCommand("cmake_minimum_required", cmCMakeMinimumRequired);
state->AddBuiltinCommand("cmake_path", cmCMakePathCommand);
state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand);
#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand("cmake_host_system_information",
cmCMakeHostSystemInformationCommand);
- state->AddBuiltinCommand("cmake_language", cmCMakeLanguageCommand);
state->AddBuiltinCommand("load_cache", cmLoadCacheCommand);
state->AddBuiltinCommand("remove", cmRemoveCommand);
state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand);
mode_t permissions)
{
if (permissions) {
-#ifdef WIN32
+#ifdef _WIN32
if (Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
// Store the mode in an NTFS alternate stream.
std::string mode_t_adt_filename = toFile + ":cmake_mode_t";
cmGlobalNinjaGenerator::WriteComment(this->GetRulesFileStream(),
"localized /showIncludes string");
this->GetRulesFileStream() << "msvc_deps_prefix = ";
-#ifdef WIN32
+#ifdef _WIN32
// Ninja uses the ANSI Windows APIs, so strings in the rules file
// typically need to be ANSI encoded. However, in this case the compiler
// is being invoked using the UTF-8 codepage so the /showIncludes prefix
// Add additional autogen target dependencies to
// '_autogen_timestamp_deps'.
for (const cmTarget* t : this->AutogenTarget.DependTargets) {
- dependencies.push_back(t->GetName());
+ std::string depname = t->GetName();
+ if (t->IsImported()) {
+ auto ttype = t->GetType();
+ if (ttype == cmStateEnums::TargetType::STATIC_LIBRARY ||
+ ttype == cmStateEnums::TargetType::SHARED_LIBRARY ||
+ ttype == cmStateEnums::TargetType::UNKNOWN_LIBRARY) {
+ depname = cmStrCat("$<TARGET_LINKER_FILE:", t->GetName(), ">");
+ }
+ }
+ dependencies.push_back(depname);
}
cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand(
cmSystemTools::Error("Problem extracting tar: " + outFile);
return 1;
}
-#ifdef WIN32
+#ifdef _WIN32
// OK, on windows 7 after we untar some files,
// sometimes we can not rename the directory after
// the untar is done. This breaks the external project
t = clock() - t;
status_message = (status == -1) ? "not ok" : "ok";
{
- double time_taken = ((double)t) / CLOCKS_PER_SEC;
+ double time_taken = CM_CAST(double, t) / CLOCKS_PER_SEC;
printf("%s %d %s # %f\n", status_message, i + 1, name, time_taken);
}
}
--- /dev/null
+include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
+
+set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
+
+set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
+if (CMAKE_IMPORT_LIBRARY_SUFFIX)
+ set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+endif ()
+
+set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}static${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}unknown${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
--- /dev/null
+include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
+
+set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
+
+if (CMAKE_IMPORT_LIBRARY_SUFFIX)
+ set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+else ()
+ set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif ()
+
+set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}static${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unknown${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
--- /dev/null
+include("${CMAKE_CURRENT_LIST_DIR}/CMP0111-imported-target-prelude.cmake")
+
+set_location(executable LOCATION "${CMAKE_CURRENT_BINARY_DIR}/executable${CMAKE_EXECUTABLE_SUFFIX}")
+
+set_location(shared LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}shared${CMAKE_SHARED_LIBRARY_SUFFIX}")
+if (CMAKE_IMPORT_LIBRARY_SUFFIX)
+ set_location(shared IMPLIB "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}shared${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+endif ()
+
+set_location(static LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}static${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+set_location(unknown LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}unknown${CMAKE_IMPORT_LIBRARY_SUFFIX}")
+set_location(module LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}module${CMAKE_SHARED_MODULE_SUFFIX}")
+
+set_location(interface LIBNAME "interface")
--- /dev/null
+enable_language(CXX)
+
+find_package(Qt5 REQUIRED COMPONENTS Core)
+
+# Detect `-NOTFOUND` libraries at generate time.
+cmake_policy(SET CMP0111 NEW)
+
+add_executable(imported::executable IMPORTED)
+add_library(imported::shared SHARED IMPORTED)
+add_library(imported::static STATIC IMPORTED)
+add_library(imported::unknown UNKNOWN IMPORTED)
+add_library(imported::interface INTERFACE IMPORTED)
+add_library(imported::module MODULE IMPORTED)
+
+function (set_location target name loc)
+ set_property(TARGET "imported::${target}" PROPERTY
+ "IMPORTED_${name}" "${loc}")
+endfunction ()
+
+set(CMAKE_AUTOMOC 1)
+
+add_library(automoc
+ empty.cpp)
+target_link_libraries(automoc
+ PRIVATE
+ imported::shared
+ imported::static
+ imported::unknown
+ imported::interface)
+add_dependencies(automoc
+ imported::executable
+ imported::module)
run_cmake(QtInFunction)
run_cmake(QtInFunctionNested)
run_cmake(QtInFunctionProperty)
+
+ run_cmake(CMP0111-imported-target-full)
+ run_cmake(CMP0111-imported-target-libname)
+ run_cmake(CMP0111-imported-target-implib-only)
endif ()
CMAKE_INSTALL_INCLUDEDIR='include'
CMAKE_INSTALL_INFODIR='share/info'
CMAKE_INSTALL_LIBDIR='lib/arch'
-CMAKE_INSTALL_LIBEXECDIR='lib/arch'
+CMAKE_INSTALL_LIBEXECDIR='libexec'
CMAKE_INSTALL_LOCALEDIR='share/locale'
CMAKE_INSTALL_LOCALSTATEDIR='var'
CMAKE_INSTALL_RUNSTATEDIR='var/run'
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
CMAKE_INSTALL_FULL_LIBDIR='/usr/lib/arch'
-CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/lib/arch'
+CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
CMAKE_INSTALL_FULL_RUNSTATEDIR='/var/run'
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(XcodeSchemaGeneration)
- run_cmake_command(XcodeSchemaGeneration-build xcodebuild -scheme foo build)
+ if (XCODE_VERSION VERSION_GREATER_EQUAL 13)
+ set(maybe_destination -destination platform=macOS)
+ else()
+ set(maybe_destination "")
+ endif()
+ run_cmake_command(XcodeSchemaGeneration-build xcodebuild -scheme foo ${maybe_destination} build)
endfunction()
if(NOT XCODE_VERSION VERSION_LESS 7)
return()
endif()
- string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out})
- string(REPLACE "architecture " "" actual "${architectures}")
+ string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out})
+ string(REPLACE "\narchitecture " "" actual "${architectures}")
list(SORT actual)
set(expected arm64 armv7 i386 x86_64)
return()
endif()
- string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out})
- string(REPLACE "architecture " "" actual "${architectures}")
+ string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out})
+ string(REPLACE "\narchitecture " "" actual "${architectures}")
list(SORT actual)
set(expected armv7 x86_64)
* Prefer these methods in priority order (0 > 1 > 2)
*/
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
-# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
-# define MEM_FORCE_MEMORY_ACCESS 2
-# elif defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
+# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
# define MEM_FORCE_MEMORY_ACCESS 1
# endif
#endif
* Prefer these methods in priority order (0 > 1 > 2)
*/
#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
-# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
-# define XXH_FORCE_MEMORY_ACCESS 2
-# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
+# if (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) || \
defined(__ICCARM__)
# define XXH_FORCE_MEMORY_ACCESS 1
cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool \
cmBreakCommand \
cmBuildCommand \
+ cmCMakeLanguageCommand \
cmCMakeMinimumRequired \
cmCMakePath \
cmCMakePathCommand \