diff options
author | Brad King <brad.king@kitware.com> | 2020-12-11 15:39:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-11 15:39:14 (GMT) |
commit | 3765a415dfd4c521b4e656412503cbe1051a4c0b (patch) | |
tree | a29565d1f4efd97306d2f23684b04e9a659bb2fc | |
parent | ff4d1d44f217bcbd90ba97f0fc41806cccb34e57 (diff) | |
parent | adc6a4c5402658b8218a591639b652604893b919 (diff) | |
download | CMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.zip CMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.tar.gz CMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.tar.bz2 |
Merge branch 'master' into doc-3_19_release-fixes
992 files changed, 18650 insertions, 9371 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5550c2f..626071a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,7 +52,7 @@ prep:doc-package: - .cmake_doc_artifacts - .run_only_for_package -.upload:source-package: +upload:source-package: extends: - .rsync_upload - .run_only_for_package @@ -175,7 +175,7 @@ build:linux-x86_64-package: needs: - prep:doc-package -.upload:linux-x86_64-package: +upload:linux-x86_64-package: extends: - .rsync_upload - .run_only_for_package @@ -250,7 +250,7 @@ build:macos-package: needs: - prep:doc-package -.upload:macos-package: +upload:macos-package: extends: - .rsync_upload - .run_only_for_package diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 2340543..90556bf 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -19,6 +19,7 @@ set(CMake_TEST_FindGSL "ON" CACHE BOOL "") set(CMake_TEST_FindGTest "ON" CACHE BOOL "") set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "") set(CMake_TEST_FindIconv "ON" CACHE BOOL "") +set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") set(CMake_TEST_FindLAPACK "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora33_makefiles.cmake b/.gitlab/ci/configure_fedora33_makefiles.cmake index 8d2454f..db2d005 100644 --- a/.gitlab/ci/configure_fedora33_makefiles.cmake +++ b/.gitlab/ci/configure_fedora33_makefiles.cmake @@ -19,6 +19,7 @@ set(CMake_TEST_FindGSL "ON" CACHE BOOL "") set(CMake_TEST_FindGTest "ON" CACHE BOOL "") set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "") set(CMake_TEST_FindIconv "ON" CACHE BOOL "") +set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") set(CMake_TEST_FindLAPACK "ON" CACHE BOOL "") diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index c69302a..6684d71 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -52,7 +52,7 @@ image: "kitware/cmake:ci-fedora33-x86_64-2020-11-13" variables: - GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" + GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" #### Lint builds diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index caaf0d5..6137ea9 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -27,6 +27,8 @@ ;; cmake-command-help Written by James Bigler ;; +(require 'rst) + (defcustom cmake-mode-cmake-executable "cmake" "*The name of the cmake executable. @@ -258,7 +260,27 @@ optional argument topic will be appended to the argument list." (save-selected-window (select-window (display-buffer buffer 'not-this-window)) (cmake-mode) - (read-only-mode 1)) + (read-only-mode 1) + (view-mode 1)) + ) + ) + +;;;###autoload +(defun cmake-command-run-help (type &optional topic buffer) + "`cmake-command-run' but rendered in `rst-mode'." + (interactive "s") + (let* ((bufname (if buffer buffer (concat "*CMake" type (if topic "-") topic "*"))) + (buffer (if (get-buffer bufname) (get-buffer bufname) (generate-new-buffer bufname))) + (command (concat cmake-mode-cmake-executable " " type " " topic)) + ;; Turn of resizing of mini-windows for shell-command. + (resize-mini-windows nil) + ) + (shell-command command buffer) + (save-selected-window + (select-window (display-buffer buffer 'not-this-window)) + (rst-mode) + (read-only-mode 1) + (view-mode 1)) ) ) @@ -266,7 +288,7 @@ optional argument topic will be appended to the argument list." (defun cmake-help-list-commands () "Prints out a list of the cmake commands." (interactive) - (cmake-command-run "--help-command-list") + (cmake-command-run-help "--help-command-list") ) (defvar cmake-commands '() "List of available topics for --help-command.") @@ -292,7 +314,7 @@ and store the result as a list in LISTVAR." (if (not (symbol-value listvar)) (let ((temp-buffer-name "*CMake Temporary*")) (save-window-excursion - (cmake-command-run (concat "--help-" listname "-list") nil temp-buffer-name) + (cmake-command-run-help (concat "--help-" listname "-list") nil temp-buffer-name) (with-current-buffer temp-buffer-name ; FIXME: Ignore first line if it is "cmake version ..." from CMake < 3.0. (set listvar (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t))))) @@ -326,25 +348,25 @@ and store the result as a list in LISTVAR." (defun cmake-help-command () "Prints out the help message for the command the cursor is on." (interactive) - (cmake-command-run "--help-command" (cmake-help-type "command") "*CMake Help*")) + (cmake-command-run-help "--help-command" (cmake-help-type "command") "*CMake Help*")) ;;;###autoload (defun cmake-help-module () "Prints out the help message for the module the cursor is on." (interactive) - (cmake-command-run "--help-module" (cmake-help-type "module") "*CMake Help*")) + (cmake-command-run-help "--help-module" (cmake-help-type "module") "*CMake Help*")) ;;;###autoload (defun cmake-help-variable () "Prints out the help message for the variable the cursor is on." (interactive) - (cmake-command-run "--help-variable" (cmake-help-type "variable") "*CMake Help*")) + (cmake-command-run-help "--help-variable" (cmake-help-type "variable") "*CMake Help*")) ;;;###autoload (defun cmake-help-property () "Prints out the help message for the property the cursor is on." (interactive) - (cmake-command-run "--help-property" (cmake-help-type "property") "*CMake Help*")) + (cmake-command-run-help "--help-property" (cmake-help-type "property") "*CMake Help*")) ;;;###autoload (defun cmake-help () @@ -367,13 +389,13 @@ and store the result as a list in LISTVAR." (if (string= input "") (error "No argument given") (if (member input command-list) - (cmake-command-run "--help-command" input "*CMake Help*") + (cmake-command-run-help "--help-command" input "*CMake Help*") (if (member input variable-list) - (cmake-command-run "--help-variable" input "*CMake Help*") + (cmake-command-run-help "--help-variable" input "*CMake Help*") (if (member input module-list) - (cmake-command-run "--help-module" input "*CMake Help*") + (cmake-command-run-help "--help-module" input "*CMake Help*") (if (member input property-list) - (cmake-command-run "--help-property" input "*CMake Help*") + (cmake-command-run-help "--help-property" input "*CMake Help*") (error "Not a know help topic.") ; this really should not happen )))))) ) diff --git a/Auxiliary/vim/extract-upper-case.pl b/Auxiliary/vim/extract-upper-case.pl index 204b496..1179199 100755 --- a/Auxiliary/vim/extract-upper-case.pl +++ b/Auxiliary/vim/extract-upper-case.pl @@ -3,6 +3,8 @@ use strict; use warnings; use POSIX qw(strftime); +use JSON; +use File::Basename; #my $cmake = "/home/pboettch/devel/upstream/cmake/build/bin/cmake"; my $cmake = "cmake"; @@ -96,6 +98,28 @@ close(CMAKE); # transform all properties in a hash my %properties = map { $_ => 1 } @properties; +# read in manually written files +my $modules_dir = dirname(__FILE__) . "/modules"; +opendir(DIR, $modules_dir) || die "can't opendir $modules_dir: $!"; +my @json_files = grep { /\.json$/ && -f "$modules_dir/$_" } readdir(DIR); +closedir DIR; + +foreach my $file (@json_files) { + local $/; # Enable 'slurp' mode + open my $fh, "<", $modules_dir."/".$file; + my $json = <$fh>; + close $fh; + + my $mod = decode_json($json); + foreach my $var (@{$mod->{variables}}) { + $variables{$var} = 1; + } + + while (my ($cmd, $keywords) = each %{$mod->{commands}}) { + $keywords{$cmd} = [ sort @{$keywords} ]; + } +} + # version open(CMAKE, "$cmake --version|"); my $version = 'unknown'; diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 2dd3174..a9bcf47 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -1,13 +1,13 @@ " Vim syntax file " Program: CMake - Cross-Platform Makefile Generator -" Version: cmake version 3.14.20190529-g067a4f +" Version: cmake version 3.19.20201028-gdab947f " Language: CMake " Author: Andy Cedilnik <andy.cedilnik@kitware.com>, " Nicholas Hutchinson <nshutchinson@gmail.com>, " Patrick Boettcher <patrick.boettcher@posteo.de> " Maintainer: Dimitri Merejkowsky <d.merej@gmail.com> " Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: 2019 May 29 +" Last Change: 2020 oct. 28 " " Licence: The CMake license applies to this file. See " https://cmake.org/licensing @@ -44,7 +44,9 @@ syn keyword cmakeProperty contained \ ADDITIONAL_CLEAN_FILES \ ADDITIONAL_MAKE_CLEAN_FILES \ ADVANCED + \ AIX_EXPORT_ALL_SYMBOLS \ ALIASED_TARGET + \ ALIAS_GLOBAL \ ALLOW_DUPLICATE_CUSTOM_TARGETS \ ANDROID_ANT_ADDITIONAL_OPTIONS \ ANDROID_API @@ -79,6 +81,7 @@ syn keyword cmakeProperty contained \ AUTOMOC_EXECUTABLE \ AUTOMOC_MACRO_NAMES \ AUTOMOC_MOC_OPTIONS + \ AUTOMOC_PATH_PREFIX \ AUTOMOC_SOURCE_GROUP \ AUTOMOC_TARGETS_FOLDER \ AUTORCC @@ -100,8 +103,8 @@ syn keyword cmakeProperty contained \ CACHE_VARIABLES \ CLEAN_NO_CUSTOM \ CMAKE_CONFIGURE_DEPENDS - \ CMAKE_CXX_KNOWN_FEATURES \ CMAKE_CUDA_KNOWN_FEATURES + \ CMAKE_CXX_KNOWN_FEATURES \ CMAKE_C_KNOWN_FEATURES \ CMAKE_ROLE \ COMMON_LANGUAGE_RUNTIME @@ -123,9 +126,11 @@ syn keyword cmakeProperty contained \ CPACK_START_MENU_SHORTCUTS \ CPACK_WIX_ACL \ CROSSCOMPILING_EMULATOR + \ CUDA_ARCHITECTURES \ CUDA_EXTENSIONS \ CUDA_PTX_COMPILATION \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_RUNTIME_LIBRARY \ CUDA_SEPARABLE_COMPILATION \ CUDA_STANDARD \ CUDA_STANDARD_REQUIRED @@ -142,8 +147,11 @@ syn keyword cmakeProperty contained \ DEPENDS \ DEPLOYMENT_ADDITIONAL_FILES \ DEPLOYMENT_REMOTE_DIRECTORY + \ DEPRECATION \ DISABLED \ DISABLED_FEATURES + \ DISABLE_PRECOMPILE_HEADERS + \ DOTNET_TARGET_FRAMEWORK \ DOTNET_TARGET_FRAMEWORK_VERSION \ ECLIPSE_EXTRA_CPROJECT_CONTENTS \ ECLIPSE_EXTRA_NATURES @@ -202,6 +210,7 @@ syn keyword cmakeProperty contained \ INCLUDE_DIRECTORIES \ INCLUDE_REGULAR_EXPRESSION \ INSTALL_NAME_DIR + \ INSTALL_REMOVE_ENVIRONMENT_RPATH \ INSTALL_RPATH \ INSTALL_RPATH_USE_LINK_PATH \ INTERFACE_AUTOUIC_OPTIONS @@ -214,11 +223,14 @@ syn keyword cmakeProperty contained \ INTERFACE_LINK_LIBRARIES \ INTERFACE_LINK_OPTIONS \ INTERFACE_POSITION_INDEPENDENT_CODE + \ INTERFACE_PRECOMPILE_HEADERS \ INTERFACE_SOURCES \ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES \ INTERPROCEDURAL_OPTIMIZATION \ IN_TRY_COMPILE \ IOS_INSTALL_COMBINED + \ ISPC_HEADER_DIRECTORY + \ ISPC_INSTRUCTION_SETS \ JOB_POOLS \ JOB_POOL_COMPILE \ JOB_POOL_LINK @@ -242,6 +254,8 @@ syn keyword cmakeProperty contained \ LINK_WHAT_YOU_USE \ LISTFILE_STACK \ LOCATION + \ MACHO_COMPATIBILITY_VERSION + \ MACHO_CURRENT_VERSION \ MACOSX_BUNDLE \ MACOSX_BUNDLE_INFO_PLIST \ MACOSX_FRAMEWORK_INFO_PLIST @@ -255,18 +269,29 @@ syn keyword cmakeProperty contained \ NAME \ NO_SONAME \ NO_SYSTEM_FROM_IMPORTED + \ OBJCXX_EXTENSIONS + \ OBJCXX_STANDARD + \ OBJCXX_STANDARD_REQUIRED + \ OBJC_EXTENSIONS + \ OBJC_STANDARD + \ OBJC_STANDARD_REQUIRED \ OBJECT_DEPENDS \ OBJECT_OUTPUTS + \ OPTIMIZE_DEPENDENCIES \ OSX_ARCHITECTURES \ OUTPUT_NAME \ PACKAGES_FOUND \ PACKAGES_NOT_FOUND \ PARENT_DIRECTORY \ PASS_REGULAR_EXPRESSION + \ PCH_INSTANTIATE_TEMPLATES + \ PCH_WARN_INVALID \ PDB_NAME \ PDB_OUTPUT_DIRECTORY \ POSITION_INDEPENDENT_CODE \ POST_INSTALL_SCRIPT + \ PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS_REUSE_FROM \ PREDEFINED_TARGETS_FOLDER \ PREFIX \ PRE_INSTALL_SCRIPT @@ -278,6 +303,7 @@ syn keyword cmakeProperty contained \ REPORT_UNDEFINED_PROPERTIES \ REQUIRED_FILES \ RESOURCE + \ RESOURCE_GROUPS \ RESOURCE_LOCK \ RULE_LAUNCH_COMPILE \ RULE_LAUNCH_CUSTOM @@ -291,8 +317,10 @@ syn keyword cmakeProperty contained \ SKIP_AUTORCC \ SKIP_AUTOUIC \ SKIP_BUILD_RPATH + \ SKIP_PRECOMPILE_HEADERS \ SKIP_REGULAR_EXPRESSION \ SKIP_RETURN_CODE + \ SKIP_UNITY_BUILD_INCLUSION \ SOURCES \ SOURCE_DIR \ SOVERSION @@ -304,6 +332,7 @@ syn keyword cmakeProperty contained \ SYMBOLIC \ Swift_DEPENDENCIES_FILE \ Swift_DIAGNOSTICS_FILE + \ Swift_LANGUAGE_VERSION \ Swift_MODULE_DIRECTORY \ Swift_MODULE_NAME \ TARGET_ARCHIVES_MAY_BE_SHARED_LIBS @@ -315,6 +344,12 @@ syn keyword cmakeProperty contained \ TIMEOUT \ TIMEOUT_AFTER_MATCH \ TYPE + \ UNITY_BUILD + \ UNITY_BUILD_BATCH_SIZE + \ UNITY_BUILD_CODE_AFTER_INCLUDE + \ UNITY_BUILD_CODE_BEFORE_INCLUDE + \ UNITY_BUILD_MODE + \ UNITY_GROUP \ USE_FOLDERS \ VALUE \ VARIABLES @@ -329,9 +364,11 @@ syn keyword cmakeProperty contained \ VS_DEPLOYMENT_CONTENT \ VS_DEPLOYMENT_LOCATION \ VS_DESKTOP_EXTENSIONS_VERSION + \ VS_DOTNET_DOCUMENTATION_FILE \ VS_DOTNET_REFERENCES \ VS_DOTNET_REFERENCES_COPY_LOCAL \ VS_DOTNET_TARGET_FRAMEWORK_VERSION + \ VS_DPI_AWARE \ VS_GLOBAL_KEYWORD \ VS_GLOBAL_PROJECT_TYPES \ VS_GLOBAL_ROOTNAMESPACE @@ -342,6 +379,8 @@ syn keyword cmakeProperty contained \ VS_KEYWORD \ VS_MOBILE_EXTENSIONS_VERSION \ VS_NO_SOLUTION_DEPLOY + \ VS_PACKAGE_REFERENCES + \ VS_PLATFORM_TOOLSET \ VS_PROJECT_IMPORT \ VS_RESOURCE_GENERATOR \ VS_SCC_AUXPATH @@ -349,6 +388,7 @@ syn keyword cmakeProperty contained \ VS_SCC_PROJECTNAME \ VS_SCC_PROVIDER \ VS_SDK_REFERENCES + \ VS_SETTINGS \ VS_SHADER_DISABLE_OPTIMIZATIONS \ VS_SHADER_ENABLE_DEBUG \ VS_SHADER_ENTRYPOINT @@ -358,6 +398,7 @@ syn keyword cmakeProperty contained \ VS_SHADER_OUTPUT_HEADER_FILE \ VS_SHADER_TYPE \ VS_SHADER_VARIABLE_NAME + \ VS_SOLUTION_DEPLOY \ VS_STARTUP_PROJECT \ VS_TOOL_OVERRIDE \ VS_USER_PROPS @@ -376,11 +417,13 @@ syn keyword cmakeProperty contained \ XCODE_FILE_ATTRIBUTES \ XCODE_GENERATE_SCHEME \ XCODE_LAST_KNOWN_FILE_TYPE + \ XCODE_LINK_BUILD_PHASE_MODE \ XCODE_PRODUCT_TYPE \ XCODE_SCHEME_ADDRESS_SANITIZER \ XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN \ XCODE_SCHEME_ARGUMENTS \ XCODE_SCHEME_DEBUG_AS_ROOT + \ XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING \ XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER \ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS \ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE @@ -395,6 +438,7 @@ syn keyword cmakeProperty contained \ XCODE_SCHEME_THREAD_SANITIZER_STOP \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + \ XCODE_SCHEME_WORKING_DIRECTORY \ XCODE_SCHEME_ZOMBIE_OBJECTS \ XCTEST @@ -405,6 +449,7 @@ syn keyword cmakeVariable contained \ BUILD_SHARED_LIBS \ CACHE \ CMAKE_ABSOLUTE_DESTINATION_FILES + \ CMAKE_AIX_EXPORT_ALL_SYMBOLS \ CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS \ CMAKE_ANDROID_API \ CMAKE_ANDROID_API_MIN @@ -485,6 +530,9 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_LINKER_WRAPPER_FLAG \ CMAKE_ASM_LINKER_WRAPPER_FLAG_SEP \ CMAKE_ASM_LINK_EXECUTABLE + \ CMAKE_ASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_LINK_LIBRARY_SUFFIX \ CMAKE_ASM_MASM \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_MACHINE \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_PREFIX @@ -535,6 +583,9 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG_SEP \ CMAKE_ASM_MASM_LINK_EXECUTABLE + \ CMAKE_ASM_MASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_MASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_MASM_LINK_LIBRARY_SUFFIX \ CMAKE_ASM_MASM_OUTPUT_EXTENSION \ CMAKE_ASM_MASM_PLATFORM_ID \ CMAKE_ASM_MASM_SIMULATE_ID @@ -594,6 +645,9 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG_SEP \ CMAKE_ASM_NASM_LINK_EXECUTABLE + \ CMAKE_ASM_NASM_LINK_LIBRARY_FILE_FLAG + \ CMAKE_ASM_NASM_LINK_LIBRARY_FLAG + \ CMAKE_ASM_NASM_LINK_LIBRARY_SUFFIX \ CMAKE_ASM_NASM_OUTPUT_EXTENSION \ CMAKE_ASM_NASM_PLATFORM_ID \ CMAKE_ASM_NASM_SIMULATE_ID @@ -620,6 +674,7 @@ syn keyword cmakeVariable contained \ CMAKE_AUTOMOC_DEPEND_FILTERS \ CMAKE_AUTOMOC_MACRO_NAMES \ CMAKE_AUTOMOC_MOC_OPTIONS + \ CMAKE_AUTOMOC_PATH_PREFIX \ CMAKE_AUTOMOC_RELAXED_MODE \ CMAKE_AUTORCC \ CMAKE_AUTORCC_OPTIONS @@ -640,6 +695,7 @@ syn keyword cmakeVariable contained \ CMAKE_CACHE_MINOR_VERSION \ CMAKE_CACHE_PATCH_VERSION \ CMAKE_CFG_INTDIR + \ CMAKE_CLANG_VFS_OVERLAY \ CMAKE_CL_64 \ CMAKE_CODEBLOCKS_COMPILER_ID \ CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES @@ -655,6 +711,7 @@ syn keyword cmakeVariable contained \ CMAKE_CPACK_COMMAND \ CMAKE_CROSSCOMPILING \ CMAKE_CROSSCOMPILING_EMULATOR + \ CMAKE_CROSS_CONFIGS \ CMAKE_CSharp \ CMAKE_CSharp_ANDROID_TOOLCHAIN_MACHINE \ CMAKE_CSharp_ANDROID_TOOLCHAIN_PREFIX @@ -705,6 +762,9 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_LINKER_WRAPPER_FLAG \ CMAKE_CSharp_LINKER_WRAPPER_FLAG_SEP \ CMAKE_CSharp_LINK_EXECUTABLE + \ CMAKE_CSharp_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CSharp_LINK_LIBRARY_FLAG + \ CMAKE_CSharp_LINK_LIBRARY_SUFFIX \ CMAKE_CSharp_OUTPUT_EXTENSION \ CMAKE_CSharp_PLATFORM_ID \ CMAKE_CSharp_SIMULATE_ID @@ -714,11 +774,13 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_CSharp_STANDARD_LIBRARIES \ CMAKE_CSharp_VISIBILITY_PRESET + \ CMAKE_CTEST_ARGUMENTS \ CMAKE_CTEST_COMMAND \ CMAKE_CUDA \ CMAKE_CUDA_ANDROID_TOOLCHAIN_MACHINE \ CMAKE_CUDA_ANDROID_TOOLCHAIN_PREFIX \ CMAKE_CUDA_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_CUDA_ARCHITECTURES \ CMAKE_CUDA_ARCHIVE_APPEND \ CMAKE_CUDA_ARCHIVE_CREATE \ CMAKE_CUDA_ARCHIVE_FINISH @@ -728,7 +790,6 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_COMPILER_AR \ CMAKE_CUDA_COMPILER_ARCHITECTURE_ID \ CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN - \ CMAKE_CUDA_COMPILE_FEATURES \ CMAKE_CUDA_COMPILER_ID \ CMAKE_CUDA_COMPILER_LAUNCHER \ CMAKE_CUDA_COMPILER_LOADED @@ -737,6 +798,7 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_COMPILER_TARGET \ CMAKE_CUDA_COMPILER_VERSION \ CMAKE_CUDA_COMPILER_VERSION_INTERNAL + \ CMAKE_CUDA_COMPILE_FEATURES \ CMAKE_CUDA_COMPILE_OBJECT \ CMAKE_CUDA_CPPCHECK \ CMAKE_CUDA_CPPLINT @@ -768,8 +830,13 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_LINKER_WRAPPER_FLAG \ CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP \ CMAKE_CUDA_LINK_EXECUTABLE + \ CMAKE_CUDA_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CUDA_LINK_LIBRARY_FLAG + \ CMAKE_CUDA_LINK_LIBRARY_SUFFIX \ CMAKE_CUDA_OUTPUT_EXTENSION \ CMAKE_CUDA_PLATFORM_ID + \ CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS + \ CMAKE_CUDA_RUNTIME_LIBRARY \ CMAKE_CUDA_SEPARABLE_COMPILATION \ CMAKE_CUDA_SIMULATE_ID \ CMAKE_CUDA_SIMULATE_VERSION @@ -782,6 +849,10 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES \ CMAKE_CUDA_VISIBILITY_PRESET \ CMAKE_CURRENT_BINARY_DIR + \ CMAKE_CURRENT_FUNCTION + \ CMAKE_CURRENT_FUNCTION_LIST_DIR + \ CMAKE_CURRENT_FUNCTION_LIST_FILE + \ CMAKE_CURRENT_FUNCTION_LIST_LINE \ CMAKE_CURRENT_LIST_DIR \ CMAKE_CURRENT_LIST_FILE \ CMAKE_CURRENT_LIST_LINE @@ -838,6 +909,9 @@ syn keyword cmakeVariable contained \ CMAKE_CXX_LINKER_WRAPPER_FLAG \ CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP \ CMAKE_CXX_LINK_EXECUTABLE + \ CMAKE_CXX_LINK_LIBRARY_FILE_FLAG + \ CMAKE_CXX_LINK_LIBRARY_FLAG + \ CMAKE_CXX_LINK_LIBRARY_SUFFIX \ CMAKE_CXX_OUTPUT_EXTENSION \ CMAKE_CXX_PLATFORM_ID \ CMAKE_CXX_SIMULATE_ID @@ -900,6 +974,9 @@ syn keyword cmakeVariable contained \ CMAKE_C_LINKER_WRAPPER_FLAG \ CMAKE_C_LINKER_WRAPPER_FLAG_SEP \ CMAKE_C_LINK_EXECUTABLE + \ CMAKE_C_LINK_LIBRARY_FILE_FLAG + \ CMAKE_C_LINK_LIBRARY_FLAG + \ CMAKE_C_LINK_LIBRARY_SUFFIX \ CMAKE_C_OUTPUT_EXTENSION \ CMAKE_C_PLATFORM_ID \ CMAKE_C_SIMULATE_ID @@ -913,9 +990,13 @@ syn keyword cmakeVariable contained \ CMAKE_C_VISIBILITY_PRESET \ CMAKE_DEBUG_POSTFIX \ CMAKE_DEBUG_TARGET_PROPERTIES + \ CMAKE_DEFAULT_BUILD_TYPE + \ CMAKE_DEFAULT_CONFIGS \ CMAKE_DEPENDS_IN_PROJECT_ONLY \ CMAKE_DIRECTORY_LABELS + \ CMAKE_DISABLE_PRECOMPILE_HEADERS \ CMAKE_DL_LIBS + \ CMAKE_DOTNET_TARGET_FRAMEWORK \ CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION \ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES \ CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT @@ -936,6 +1017,7 @@ syn keyword cmakeVariable contained \ CMAKE_EXTRA_GENERATOR \ CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES \ CMAKE_FIND_APPBUNDLE + \ CMAKE_FIND_DEBUG_MODE \ CMAKE_FIND_FRAMEWORK \ CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX \ CMAKE_FIND_LIBRARY_PREFIXES @@ -960,6 +1042,7 @@ syn keyword cmakeVariable contained \ CMAKE_FIND_USE_PACKAGE_REGISTRY \ CMAKE_FIND_USE_PACKAGE_ROOT_PATH \ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH + \ CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY \ CMAKE_FOLDER \ CMAKE_FRAMEWORK \ CMAKE_FRAMEWORK_PATH @@ -1014,6 +1097,9 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_LINKER_WRAPPER_FLAG \ CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP \ CMAKE_Fortran_LINK_EXECUTABLE + \ CMAKE_Fortran_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Fortran_LINK_LIBRARY_FLAG + \ CMAKE_Fortran_LINK_LIBRARY_SUFFIX \ CMAKE_Fortran_MODDIR_DEFAULT \ CMAKE_Fortran_MODDIR_FLAG \ CMAKE_Fortran_MODOUT_FLAG @@ -1048,7 +1134,6 @@ syn keyword cmakeVariable contained \ CMAKE_HOST_UNIX \ CMAKE_HOST_WIN32 \ CMAKE_IGNORE_PATH - \ CMAKE_ISPC_HEADER_DIRECTORY \ CMAKE_IMPORT_LIBRARY_PREFIX \ CMAKE_IMPORT_LIBRARY_SUFFIX \ CMAKE_INCLUDE_CURRENT_DIR @@ -1062,11 +1147,14 @@ syn keyword cmakeVariable contained \ CMAKE_INSTALL_NAME_DIR \ CMAKE_INSTALL_PREFIX \ CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT + \ CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH \ CMAKE_INSTALL_RPATH \ CMAKE_INSTALL_RPATH_USE_LINK_PATH \ CMAKE_INTERNAL_PLATFORM_ABI \ CMAKE_INTERPROCEDURAL_OPTIMIZATION \ CMAKE_IOS_INSTALL_COMBINED + \ CMAKE_ISPC_HEADER_DIRECTORY + \ CMAKE_ISPC_INSTRUCTION_SETS \ CMAKE_JOB_POOLS \ CMAKE_JOB_POOL_COMPILE \ CMAKE_JOB_POOL_LINK @@ -1121,6 +1209,9 @@ syn keyword cmakeVariable contained \ CMAKE_Java_LINKER_WRAPPER_FLAG \ CMAKE_Java_LINKER_WRAPPER_FLAG_SEP \ CMAKE_Java_LINK_EXECUTABLE + \ CMAKE_Java_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Java_LINK_LIBRARY_FLAG + \ CMAKE_Java_LINK_LIBRARY_SUFFIX \ CMAKE_Java_OUTPUT_EXTENSION \ CMAKE_Java_PLATFORM_ID \ CMAKE_Java_SIMULATE_ID @@ -1151,6 +1242,10 @@ syn keyword cmakeVariable contained \ CMAKE_MAKE_PROGRAM \ CMAKE_MATCH_COUNT \ CMAKE_MAXIMUM_RECURSION_DEPTH + \ CMAKE_MESSAGE_CONTEXT + \ CMAKE_MESSAGE_CONTEXT_SHOW + \ CMAKE_MESSAGE_INDENT + \ CMAKE_MESSAGE_LOG_LEVEL \ CMAKE_MFC_FLAG \ CMAKE_MINIMUM_REQUIRED_VERSION \ CMAKE_MINOR_VERSION @@ -1165,12 +1260,23 @@ syn keyword cmakeVariable contained \ CMAKE_NOT_USING_CONFIG_FLAGS \ CMAKE_NO_BUILTIN_CHRPATH \ CMAKE_NO_SYSTEM_FROM_IMPORTED + \ CMAKE_OBJCXX_CLANG_TIDY + \ CMAKE_OBJCXX_EXTENSIONS + \ CMAKE_OBJCXX_STANDARD + \ CMAKE_OBJCXX_STANDARD_REQUIRED + \ CMAKE_OBJC_CLANG_TIDY + \ CMAKE_OBJC_EXTENSIONS + \ CMAKE_OBJC_STANDARD + \ CMAKE_OBJC_STANDARD_REQUIRED \ CMAKE_OBJECT_PATH_MAX + \ CMAKE_OPTIMIZE_DEPENDENCIES \ CMAKE_OSX_ARCHITECTURES \ CMAKE_OSX_DEPLOYMENT_TARGET \ CMAKE_OSX_SYSROOT \ CMAKE_PARENT_LIST_FILE \ CMAKE_PATCH_VERSION + \ CMAKE_PCH_INSTANTIATE_TEMPLATES + \ CMAKE_PCH_WARN_INVALID \ CMAKE_PDB_OUTPUT_DIRECTORY \ CMAKE_POSITION_INDEPENDENT_CODE \ CMAKE_PREFIX_PATH @@ -1236,6 +1342,9 @@ syn keyword cmakeVariable contained \ CMAKE_RC_LINKER_WRAPPER_FLAG \ CMAKE_RC_LINKER_WRAPPER_FLAG_SEP \ CMAKE_RC_LINK_EXECUTABLE + \ CMAKE_RC_LINK_LIBRARY_FILE_FLAG + \ CMAKE_RC_LINK_LIBRARY_FLAG + \ CMAKE_RC_LINK_LIBRARY_SUFFIX \ CMAKE_RC_OUTPUT_EXTENSION \ CMAKE_RC_PLATFORM_ID \ CMAKE_RC_SIMULATE_ID @@ -1335,7 +1444,11 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_LINKER_WRAPPER_FLAG \ CMAKE_Swift_LINKER_WRAPPER_FLAG_SEP \ CMAKE_Swift_LINK_EXECUTABLE + \ CMAKE_Swift_LINK_LIBRARY_FILE_FLAG + \ CMAKE_Swift_LINK_LIBRARY_FLAG + \ CMAKE_Swift_LINK_LIBRARY_SUFFIX \ CMAKE_Swift_MODULE_DIRECTORY + \ CMAKE_Swift_NUM_THREADS \ CMAKE_Swift_OUTPUT_EXTENSION \ CMAKE_Swift_PLATFORM_ID \ CMAKE_Swift_SIMULATE_ID @@ -1350,6 +1463,8 @@ syn keyword cmakeVariable contained \ CMAKE_TRY_COMPILE_PLATFORM_VARIABLES \ CMAKE_TRY_COMPILE_TARGET_TYPE \ CMAKE_TWEAK_VERSION + \ CMAKE_UNITY_BUILD + \ CMAKE_UNITY_BUILD_BATCH_SIZE \ CMAKE_USER_MAKE_RULES_OVERRIDE \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_MASM @@ -1378,6 +1493,7 @@ syn keyword cmakeVariable contained \ CMAKE_VS_PLATFORM_NAME_DEFAULT \ CMAKE_VS_PLATFORM_TOOLSET \ CMAKE_VS_PLATFORM_TOOLSET_CUDA + \ CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR \ CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE \ CMAKE_VS_PLATFORM_TOOLSET_VERSION \ CMAKE_VS_SDK_EXCLUDE_DIRECTORIES @@ -1388,19 +1504,24 @@ syn keyword cmakeVariable contained \ CMAKE_VS_SDK_REFERENCE_DIRECTORIES \ CMAKE_VS_SDK_SOURCE_DIRECTORIES \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION + \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM \ CMAKE_VS_WINRT_BY_DEFAULT \ CMAKE_WARN_DEPRECATED \ CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION \ CMAKE_WIN32_EXECUTABLE \ CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS + \ CMAKE_XCODE_BUILD_SYSTEM \ CMAKE_XCODE_GENERATE_SCHEME \ CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY + \ CMAKE_XCODE_LINK_BUILD_PHASE_MODE \ CMAKE_XCODE_PLATFORM_TOOLSET \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN + \ CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING \ CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER \ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS \ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + \ CMAKE_XCODE_SCHEME_ENVIRONMENT \ CMAKE_XCODE_SCHEME_GUARD_MALLOC \ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP \ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES @@ -1410,13 +1531,13 @@ syn keyword cmakeVariable contained \ CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + \ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY \ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS \ CPACK_ABSOLUTE_DESTINATION_FILES \ CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY \ CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION \ CPACK_INCLUDE_TOPLEVEL_DIRECTORY \ CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS - \ CPACK_INSTALL_SCRIPT \ CPACK_PACKAGING_INSTALL_PREFIX \ CPACK_SET_DESTDIR \ CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION @@ -1476,6 +1597,7 @@ syn keyword cmakeVariable contained \ CTEST_P4_COMMAND \ CTEST_P4_OPTIONS \ CTEST_P4_UPDATE_OPTIONS + \ CTEST_RESOURCE_SPEC_FILE \ CTEST_RUN_CURRENT_SCRIPT \ CTEST_SCP_COMMAND \ CTEST_SITE @@ -1493,6 +1615,283 @@ syn keyword cmakeVariable contained \ CTEST_UPDATE_VERSION_OVERRIDE \ CTEST_USE_LAUNCHERS \ CYGWIN + \ DOXYGEN_ABBREVIATE_BRIEF + \ DOXYGEN_ALIASES + \ DOXYGEN_ALLEXTERNALS + \ DOXYGEN_ALLOW_UNICODE_NAMES + \ DOXYGEN_ALPHABETICAL_INDEX + \ DOXYGEN_ALWAYS_DETAILED_SEC + \ DOXYGEN_AUTOLINK_SUPPORT + \ DOXYGEN_BINARY_TOC + \ DOXYGEN_BRIEF_MEMBER_DESC + \ DOXYGEN_BUILTIN_STL_SUPPORT + \ DOXYGEN_CALLER_GRAPH + \ DOXYGEN_CALL_GRAPH + \ DOXYGEN_CASE_SENSE_NAMES + \ DOXYGEN_CHM_FILE + \ DOXYGEN_CHM_INDEX_ENCODING + \ DOXYGEN_CITE_BIB_FILES + \ DOXYGEN_CLANG_ASSISTED_PARSING + \ DOXYGEN_CLANG_DATABASE_PATH + \ DOXYGEN_CLANG_OPTIONS + \ DOXYGEN_CLASS_DIAGRAMS + \ DOXYGEN_CLASS_GRAPH + \ DOXYGEN_COLLABORATION_GRAPH + \ DOXYGEN_COLS_IN_ALPHA_INDEX + \ DOXYGEN_COMPACT_LATEX + \ DOXYGEN_COMPACT_RTF + \ DOXYGEN_CPP_CLI_SUPPORT + \ DOXYGEN_CREATE_SUBDIRS + \ DOXYGEN_DIAFILE_DIRS + \ DOXYGEN_DIA_PATH + \ DOXYGEN_DIRECTORY_GRAPH + \ DOXYGEN_DISABLE_INDEX + \ DOXYGEN_DISTRIBUTE_GROUP_DOC + \ DOXYGEN_DOCBOOK_OUTPUT + \ DOXYGEN_DOCBOOK_PROGRAMLISTING + \ DOXYGEN_DOCSET_BUNDLE_ID + \ DOXYGEN_DOCSET_FEEDNAME + \ DOXYGEN_DOCSET_PUBLISHER_ID + \ DOXYGEN_DOCSET_PUBLISHER_NAME + \ DOXYGEN_DOTFILE_DIRS + \ DOXYGEN_DOT_CLEANUP + \ DOXYGEN_DOT_FONTNAME + \ DOXYGEN_DOT_FONTPATH + \ DOXYGEN_DOT_FONTSIZE + \ DOXYGEN_DOT_GRAPH_MAX_NODES + \ DOXYGEN_DOT_IMAGE_FORMAT + \ DOXYGEN_DOT_MULTI_TARGETS + \ DOXYGEN_DOT_NUM_THREADS + \ DOXYGEN_DOT_PATH + \ DOXYGEN_DOT_TRANSPARENT + \ DOXYGEN_DOXYFILE_ENCODING + \ DOXYGEN_ECLIPSE_DOC_ID + \ DOXYGEN_ENABLED_SECTIONS + \ DOXYGEN_ENABLE_PREPROCESSING + \ DOXYGEN_ENUM_VALUES_PER_LINE + \ DOXYGEN_EXAMPLE_PATH + \ DOXYGEN_EXAMPLE_PATTERNS + \ DOXYGEN_EXAMPLE_RECURSIVE + \ DOXYGEN_EXCLUDE + \ DOXYGEN_EXCLUDE_PATTERNS + \ DOXYGEN_EXCLUDE_SYMBOLS + \ DOXYGEN_EXCLUDE_SYMLINKS + \ DOXYGEN_EXPAND_AS_DEFINED + \ DOXYGEN_EXPAND_ONLY_PREDEF + \ DOXYGEN_EXTENSION_MAPPING + \ DOXYGEN_EXTERNAL_GROUPS + \ DOXYGEN_EXTERNAL_PAGES + \ DOXYGEN_EXTERNAL_SEARCH + \ DOXYGEN_EXTERNAL_SEARCH_ID + \ DOXYGEN_EXTRACT_ALL + \ DOXYGEN_EXTRACT_ANON_NSPACES + \ DOXYGEN_EXTRACT_LOCAL_CLASSES + \ DOXYGEN_EXTRACT_LOCAL_METHODS + \ DOXYGEN_EXTRACT_PACKAGE + \ DOXYGEN_EXTRACT_PRIVATE + \ DOXYGEN_EXTRACT_PRIV_VIRTUAL + \ DOXYGEN_EXTRACT_STATIC + \ DOXYGEN_EXTRA_PACKAGES + \ DOXYGEN_EXTRA_SEARCH_MAPPINGS + \ DOXYGEN_EXT_LINKS_IN_WINDOW + \ DOXYGEN_FILE_PATTERNS + \ DOXYGEN_FILE_VERSION_FILTER + \ DOXYGEN_FILTER_PATTERNS + \ DOXYGEN_FILTER_SOURCE_FILES + \ DOXYGEN_FILTER_SOURCE_PATTERNS + \ DOXYGEN_FORCE_LOCAL_INCLUDES + \ DOXYGEN_FORMULA_FONTSIZE + \ DOXYGEN_FORMULA_TRANSPARENT + \ DOXYGEN_FULL_PATH_NAMES + \ DOXYGEN_GENERATE_AUTOGEN_DEF + \ DOXYGEN_GENERATE_BUGLIST + \ DOXYGEN_GENERATE_CHI + \ DOXYGEN_GENERATE_DEPRECATEDLIST + \ DOXYGEN_GENERATE_DOCBOOK + \ DOXYGEN_GENERATE_DOCSET + \ DOXYGEN_GENERATE_ECLIPSEHELP + \ DOXYGEN_GENERATE_HTML + \ DOXYGEN_GENERATE_HTMLHELP + \ DOXYGEN_GENERATE_LATEX + \ DOXYGEN_GENERATE_LEGEND + \ DOXYGEN_GENERATE_MAN + \ DOXYGEN_GENERATE_PERLMOD + \ DOXYGEN_GENERATE_QHP + \ DOXYGEN_GENERATE_RTF + \ DOXYGEN_GENERATE_TAGFILE + \ DOXYGEN_GENERATE_TESTLIST + \ DOXYGEN_GENERATE_TODOLIST + \ DOXYGEN_GENERATE_TREEVIEW + \ DOXYGEN_GENERATE_XML + \ DOXYGEN_GRAPHICAL_HIERARCHY + \ DOXYGEN_GROUP_GRAPHS + \ DOXYGEN_GROUP_NESTED_COMPOUNDS + \ DOXYGEN_HAVE_DOT + \ DOXYGEN_HHC_LOCATION + \ DOXYGEN_HIDE_COMPOUND_REFERENCE + \ DOXYGEN_HIDE_FRIEND_COMPOUNDS + \ DOXYGEN_HIDE_IN_BODY_DOCS + \ DOXYGEN_HIDE_SCOPE_NAMES + \ DOXYGEN_HIDE_UNDOC_CLASSES + \ DOXYGEN_HIDE_UNDOC_MEMBERS + \ DOXYGEN_HIDE_UNDOC_RELATIONS + \ DOXYGEN_HTML_COLORSTYLE_GAMMA + \ DOXYGEN_HTML_COLORSTYLE_HUE + \ DOXYGEN_HTML_COLORSTYLE_SAT + \ DOXYGEN_HTML_DYNAMIC_MENUS + \ DOXYGEN_HTML_DYNAMIC_SECTIONS + \ DOXYGEN_HTML_EXTRA_FILES + \ DOXYGEN_HTML_EXTRA_STYLESHEET + \ DOXYGEN_HTML_FILE_EXTENSION + \ DOXYGEN_HTML_FOOTER + \ DOXYGEN_HTML_HEADER + \ DOXYGEN_HTML_INDEX_NUM_ENTRIES + \ DOXYGEN_HTML_OUTPUT + \ DOXYGEN_HTML_STYLESHEET + \ DOXYGEN_HTML_TIMESTAMP + \ DOXYGEN_IDL_PROPERTY_SUPPORT + \ DOXYGEN_IGNORE_PREFIX + \ DOXYGEN_IMAGE_PATH + \ DOXYGEN_INCLUDED_BY_GRAPH + \ DOXYGEN_INCLUDE_FILE_PATTERNS + \ DOXYGEN_INCLUDE_GRAPH + \ DOXYGEN_INCLUDE_PATH + \ DOXYGEN_INHERIT_DOCS + \ DOXYGEN_INLINE_GROUPED_CLASSES + \ DOXYGEN_INLINE_INFO + \ DOXYGEN_INLINE_INHERITED_MEMB + \ DOXYGEN_INLINE_SIMPLE_STRUCTS + \ DOXYGEN_INLINE_SOURCES + \ DOXYGEN_INPUT + \ DOXYGEN_INPUT_ENCODING + \ DOXYGEN_INPUT_FILTER + \ DOXYGEN_INTERACTIVE_SVG + \ DOXYGEN_INTERNAL_DOCS + \ DOXYGEN_JAVADOC_AUTOBRIEF + \ DOXYGEN_JAVADOC_BANNER + \ DOXYGEN_LATEX_BATCHMODE + \ DOXYGEN_LATEX_BIB_STYLE + \ DOXYGEN_LATEX_CMD_NAME + \ DOXYGEN_LATEX_EMOJI_DIRECTORY + \ DOXYGEN_LATEX_EXTRA_FILES + \ DOXYGEN_LATEX_EXTRA_STYLESHEET + \ DOXYGEN_LATEX_FOOTER + \ DOXYGEN_LATEX_HEADER + \ DOXYGEN_LATEX_HIDE_INDICES + \ DOXYGEN_LATEX_MAKEINDEX_CMD + \ DOXYGEN_LATEX_OUTPUT + \ DOXYGEN_LATEX_SOURCE_CODE + \ DOXYGEN_LATEX_TIMESTAMP + \ DOXYGEN_LAYOUT_FILE + \ DOXYGEN_LOOKUP_CACHE_SIZE + \ DOXYGEN_MACRO_EXPANSION + \ DOXYGEN_MAKEINDEX_CMD_NAME + \ DOXYGEN_MAN_EXTENSION + \ DOXYGEN_MAN_LINKS + \ DOXYGEN_MAN_OUTPUT + \ DOXYGEN_MAN_SUBDIR + \ DOXYGEN_MARKDOWN_SUPPORT + \ DOXYGEN_MATHJAX_CODEFILE + \ DOXYGEN_MATHJAX_EXTENSIONS + \ DOXYGEN_MATHJAX_FORMAT + \ DOXYGEN_MATHJAX_RELPATH + \ DOXYGEN_MAX_DOT_GRAPH_DEPTH + \ DOXYGEN_MAX_INITIALIZER_LINES + \ DOXYGEN_MSCFILE_DIRS + \ DOXYGEN_MULTILINE_CPP_IS_BRIEF + \ DOXYGEN_OPTIMIZE_FOR_FORTRAN + \ DOXYGEN_OPTIMIZE_OUTPUT_FOR_C + \ DOXYGEN_OPTIMIZE_OUTPUT_JAVA + \ DOXYGEN_OPTIMIZE_OUTPUT_SLICE + \ DOXYGEN_OPTIMIZE_OUTPUT_VHDL + \ DOXYGEN_OUTPUT_DIRECTORY + \ DOXYGEN_OUTPUT_LANGUAGE + \ DOXYGEN_OUTPUT_TEXT_DIRECTION + \ DOXYGEN_PAPER_TYPE + \ DOXYGEN_PDF_HYPERLINKS + \ DOXYGEN_PERLMOD_LATEX + \ DOXYGEN_PERLMOD_MAKEVAR_PREFIX + \ DOXYGEN_PERLMOD_PRETTY + \ DOXYGEN_PLANTUML_CFG_FILE + \ DOXYGEN_PLANTUML_INCLUDE_PATH + \ DOXYGEN_PLANTUML_JAR_PATH + \ DOXYGEN_PREDEFINED + \ DOXYGEN_PROJECT_BRIEF + \ DOXYGEN_PROJECT_LOGO + \ DOXYGEN_PROJECT_NAME + \ DOXYGEN_PROJECT_NUMBER + \ DOXYGEN_QCH_FILE + \ DOXYGEN_QHG_LOCATION + \ DOXYGEN_QHP_CUST_FILTER_ATTRS + \ DOXYGEN_QHP_CUST_FILTER_NAME + \ DOXYGEN_QHP_NAMESPACE + \ DOXYGEN_QHP_SECT_FILTER_ATTRS + \ DOXYGEN_QHP_VIRTUAL_FOLDER + \ DOXYGEN_QT_AUTOBRIEF + \ DOXYGEN_QUIET + \ DOXYGEN_RECURSIVE + \ DOXYGEN_REFERENCED_BY_RELATION + \ DOXYGEN_REFERENCES_LINK_SOURCE + \ DOXYGEN_REFERENCES_RELATION + \ DOXYGEN_REPEAT_BRIEF + \ DOXYGEN_RTF_EXTENSIONS_FILE + \ DOXYGEN_RTF_HYPERLINKS + \ DOXYGEN_RTF_OUTPUT + \ DOXYGEN_RTF_SOURCE_CODE + \ DOXYGEN_RTF_STYLESHEET_FILE + \ DOXYGEN_SEARCHDATA_FILE + \ DOXYGEN_SEARCHENGINE + \ DOXYGEN_SEARCHENGINE_URL + \ DOXYGEN_SEARCH_INCLUDES + \ DOXYGEN_SEPARATE_MEMBER_PAGES + \ DOXYGEN_SERVER_BASED_SEARCH + \ DOXYGEN_SHORT_NAMES + \ DOXYGEN_SHOW_FILES + \ DOXYGEN_SHOW_GROUPED_MEMB_INC + \ DOXYGEN_SHOW_INCLUDE_FILES + \ DOXYGEN_SHOW_NAMESPACES + \ DOXYGEN_SHOW_USED_FILES + \ DOXYGEN_SIP_SUPPORT + \ DOXYGEN_SKIP_FUNCTION_MACROS + \ DOXYGEN_SORT_BRIEF_DOCS + \ DOXYGEN_SORT_BY_SCOPE_NAME + \ DOXYGEN_SORT_GROUP_NAMES + \ DOXYGEN_SORT_MEMBERS_CTORS_1ST + \ DOXYGEN_SORT_MEMBER_DOCS + \ DOXYGEN_SOURCE_BROWSER + \ DOXYGEN_SOURCE_TOOLTIPS + \ DOXYGEN_STRICT_PROTO_MATCHING + \ DOXYGEN_STRIP_CODE_COMMENTS + \ DOXYGEN_STRIP_FROM_INC_PATH + \ DOXYGEN_STRIP_FROM_PATH + \ DOXYGEN_SUBGROUPING + \ DOXYGEN_TAB_SIZE + \ DOXYGEN_TAGFILES + \ DOXYGEN_TCL_SUBST + \ DOXYGEN_TEMPLATE_RELATIONS + \ DOXYGEN_TOC_EXPAND + \ DOXYGEN_TOC_INCLUDE_HEADINGS + \ DOXYGEN_TREEVIEW_WIDTH + \ DOXYGEN_TYPEDEF_HIDES_STRUCT + \ DOXYGEN_UML_LIMIT_NUM_FIELDS + \ DOXYGEN_UML_LOOK + \ DOXYGEN_USE_HTAGS + \ DOXYGEN_USE_MATHJAX + \ DOXYGEN_USE_MDFILE_AS_MAINPAGE + \ DOXYGEN_USE_PDFLATEX + \ DOXYGEN_VERBATIM_HEADERS + \ DOXYGEN_VERBATIM_VARS + \ DOXYGEN_VERSION + \ DOXYGEN_WARNINGS + \ DOXYGEN_WARN_AS_ERROR + \ DOXYGEN_WARN_FORMAT + \ DOXYGEN_WARN_IF_DOC_ERROR + \ DOXYGEN_WARN_IF_UNDOCUMENTED + \ DOXYGEN_WARN_LOGFILE + \ DOXYGEN_WARN_NO_PARAMDOC + \ DOXYGEN_XML_NS_MEMB_FILE_SCOPE + \ DOXYGEN_XML_OUTPUT + \ DOXYGEN_XML_PROGRAMLISTING \ ENV \ EXECUTABLE_OUTPUT_PATH \ GHS-MULTI @@ -1541,9 +1940,11 @@ syn keyword cmakeKWExternalProject contained \ BUILD_BYPRODUCTS \ BUILD_COMMAND \ BUILD_IN_SOURCE + \ CHECKOUT \ CMAKE_ARGS \ CMAKE_CACHE_ARGS \ CMAKE_CACHE_DEFAULT_ARGS + \ CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY \ CMAKE_TLS_CAINFO \ CMAKE_TLS_VERIFY \ COMMENT @@ -1568,14 +1969,17 @@ syn keyword cmakeKWExternalProject contained \ EP_STEP_TARGETS \ EP_UPDATE_DISCONNECTED \ EXCLUDE_FROM_ALL + \ FALSE \ FORCE \ GHS \ GIT_CONFIG \ GIT_PROGRESS \ GIT_REMOTE_NAME + \ GIT_REMOTE_UPDATE_STRATEGY \ GIT_REPOSITORY \ GIT_SHALLOW \ GIT_SUBMODULES + \ GIT_SUBMODULES_RECURSE \ GIT_TAG \ HG_REPOSITORY \ HG_TAG @@ -1583,6 +1987,7 @@ syn keyword cmakeKWExternalProject contained \ HTTP_PASSWORD \ HTTP_USERNAME \ IGNORED + \ INACTIVITY_TIMEOUT \ INDEPENDENT_STEP_TARGETS \ INSTALL_COMMAND \ INSTALL_DIR @@ -1609,6 +2014,8 @@ syn keyword cmakeKWExternalProject contained \ PATCH_COMMAND \ PREFIX \ PROPERTY + \ REBASE + \ REBASE_CHECKOUT \ REQUIRED \ SOURCE_DIR \ SOURCE_SUBDIR @@ -1671,12 +2078,16 @@ syn keyword cmakeKWadd_custom_command contained \ MAIN_DEPENDENCY \ NOT \ OUTPUT + \ PATH \ POST_BUILD \ PRE_BUILD \ PRE_LINK \ SYMBOLIC \ TARGET_FILE + \ TARGET_LINKER_FILE + \ TARGET_PDB_FILE \ TARGET_PROPERTY + \ TARGET_SONAME_FILE \ USES_TERMINAL \ VERBATIM \ WORKING_DIRECTORY @@ -1695,8 +2106,13 @@ syn keyword cmakeKWadd_custom_target contained \ JOB_POOL \ JOB_POOLS \ JOIN + \ PATH \ SOURCES + \ TARGET_FILE + \ TARGET_LINKER_FILE + \ TARGET_PDB_FILE \ TARGET_PROPERTY + \ TARGET_SONAME_FILE \ USES_TERMINAL \ VERBATIM \ WORKING_DIRECTORY @@ -1710,6 +2126,7 @@ syn keyword cmakeKWadd_dependencies contained syn keyword cmakeKWadd_executable contained \ ALIAS + \ ALIAS_GLOBAL \ CONFIG \ EXCLUDE_FROM_ALL \ GLOBAL @@ -1725,6 +2142,7 @@ syn keyword cmakeKWadd_executable contained syn keyword cmakeKWadd_library contained \ ALIAS + \ ALIAS_GLOBAL \ ARCHIVE_OUTPUT_DIRECTORY \ CLI \ CONFIG @@ -1735,11 +2153,15 @@ syn keyword cmakeKWadd_library contained \ HEADER_FILE_ONLY \ IMPORTED \ IMPORTED_ + \ IMPORTED_IMPLIB + \ IMPORTED_IMPLIB_ \ IMPORTED_LOCATION \ IMPORTED_LOCATION_ \ IMPORTED_OBJECTS \ IMPORTED_OBJECTS_ + \ INTERFACE \ INTERFACE_ + \ INTERFACE_SOURCES \ LIBRARY_OUTPUT_DIRECTORY \ MODULE \ OBJECT @@ -1749,17 +2171,23 @@ syn keyword cmakeKWadd_library contained \ POST_BUILD \ PRE_BUILD \ PRE_LINK - \ PUBLIC_HEADER + \ PRIVATE + \ PUBLIC \ RUNTIME_OUTPUT_DIRECTORY \ SHARED + \ SOURCES \ STATIC \ TARGET_OBJECTS \ UNKNOWN syn keyword cmakeKWadd_link_options contained \ CMAKE_ + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION + \ DEVICE_LINK \ GCC \ GNU + \ HOST_LINK \ LANG \ LINKER \ LINK_OPTIONS @@ -1775,6 +2203,7 @@ syn keyword cmakeKWadd_subdirectory contained syn keyword cmakeKWadd_test contained \ BUILD_TESTING \ COMMAND + \ COMMAND_EXPAND_LISTS \ CONFIGURATIONS \ FAIL_REGULAR_EXPRESSION \ NAME @@ -1816,6 +2245,23 @@ syn keyword cmakeKWcmake_host_system_information contained \ TOTAL_PHYSICAL_MEMORY \ TOTAL_VIRTUAL_MEMORY +syn keyword cmakeKWcmake_language contained + \ AND + \ CALL + \ CANCEL_CALL + \ CODE + \ DEFER + \ DIRECTORY + \ EVAL + \ FALSE + \ GET_CALL_IDS + \ ID + \ ID_VAR + \ OR + \ STATUS + \ TRUE + \ WRITE + syn keyword cmakeKWcmake_minimum_required contained \ FATAL_ERROR \ VERSION @@ -1845,6 +2291,72 @@ syn keyword cmakeKWcmake_parse_arguments contained \ _KEYWORDS_MISSING_VALUES \ _UNPARSED_ARGUMENTS +syn keyword cmakeKWcmake_path contained + \ ABSOLUTE_PATH + \ AND + \ APPEND + \ BASE_DIRECTORY + \ CMAKE_PATH + \ COMPARE + \ CONCAT + \ CONVERT + \ ELSEIF + \ ENDIF + \ EXTENSION + \ EXTENSION_DEF + \ FALSE + \ FILENAME_DEF + \ GET + \ GET_EXTENSION + \ GET_FILENAME + \ GET_PARENT_PATH + \ GET_RELATIVE_PATH + \ GET_ROOT_DIRECTORY + \ GET_ROOT_NAME + \ GET_ROOT_PATH + \ GET_STEM + \ HASH + \ HAS_EXTENSION + \ HAS_FILENAME + \ HAS_PARENT_PATH + \ HAS_RELATIVE_PATH + \ HAS_ROOT_DIRECTORY + \ HAS_ROOT_NAME + \ HAS_ROOT_PATH + \ HAS_STEM + \ IF + \ IS_ABSOLUTE + \ IS_PREFIX + \ IS_RELATIVE + \ LAST_ONLY + \ MATCHES + \ NATIVE_PATH + \ NORMALIZE + \ NORMAL_PATH + \ NOT + \ NOT_EQUAL + \ OP + \ OS + \ OUTPUT_VARIABLE + \ PARENT_PATH + \ PROXIMATE_PATH + \ REAL_PATH + \ RELATIVE_PATH + \ REMOVE_EXTENSION + \ REMOVE_FILENAME + \ REPLACE_EXTENSION + \ REPLACE_FILENAME + \ RETURN + \ ROOT_DIRECTORY + \ ROOT_NAME + \ ROOT_PATH + \ STEM + \ STREQUAL + \ TO_CMAKE_PATH_LIST + \ TO_NATIVE_PATH_LIST + \ TRUE + \ XOR + syn keyword cmakeKWcmake_policy contained \ CMAKE_POLICY_DEFAULT_CMP \ CMP @@ -1862,10 +2374,13 @@ syn keyword cmakeKWconfigure_file contained \ CRLF \ DOS \ ESCAPE_QUOTES + \ FILE_PERMISSIONS \ FOO_ENABLE \ FOO_STRING \ LF \ NEWLINE_STYLE + \ NO_SOURCE_PERMISSIONS + \ USE_SOURCE_PERMISSIONS \ VAR syn keyword cmakeKWcreate_test_sourcelist contained @@ -1935,6 +2450,7 @@ syn keyword cmakeKWctest_run_script contained syn keyword cmakeKWctest_start contained \ APPEND + \ GROUP \ QUIET \ TAG \ TRACK @@ -1957,6 +2473,7 @@ syn keyword cmakeKWctest_submit contained \ SUBMIT_URL syn keyword cmakeKWctest_test contained + \ AFTER_TIMEOUT \ APPEND \ BUILD \ CAPTURE_CMAKE_ERROR @@ -1972,12 +2489,17 @@ syn keyword cmakeKWctest_test contained \ ON \ PARALLEL_LEVEL \ QUIET + \ REPEAT + \ RESOURCE_SPEC_FILE \ RETURN_VALUE \ SCHEDULE_RANDOM \ START + \ STOP_ON_FAILURE \ STOP_TIME \ STRIDE \ TEST_LOAD + \ UNTIL_FAIL + \ UNTIL_PASS syn keyword cmakeKWctest_update contained \ CAPTURE_CMAKE_ERROR @@ -2005,9 +2527,18 @@ syn keyword cmakeKWdefine_property contained \ TEST \ VARIABLE +syn keyword cmakeKWdoxygen_add_docs contained + \ ALL + \ COMMENT + \ USE_STAMP_FILE + \ WORKING_DIRECTORY + syn keyword cmakeKWenable_language contained \ ASM \ CUDA + \ ISPC + \ OBJC + \ OBJCXX \ OPTIONAL syn keyword cmakeKWenable_testing contained @@ -2020,15 +2551,20 @@ syn keyword cmakeKWexec_program contained syn keyword cmakeKWexecute_process contained \ ANSI + \ ANY \ AUTO \ COMMAND \ COMMAND_ECHO + \ COMMAND_ERROR_IS_FATAL + \ ECHO_ERROR_VARIABLE + \ ECHO_OUTPUT_VARIABLE \ ENCODING \ ERROR_FILE \ ERROR_QUIET \ ERROR_STRIP_TRAILING_WHITESPACE \ ERROR_VARIABLE \ INPUT_FILE + \ LAST \ NONE \ OEM \ OUTPUT_FILE @@ -2070,63 +2606,107 @@ syn keyword cmakeKWexport_library_dependencies contained syn keyword cmakeKWfile contained \ ALGO \ APPEND + \ ARCHIVE_CREATE + \ ARCHIVE_EXTRACT \ ASCII + \ BASE_DIRECTORY + \ BUNDLE_EXECUTABLE + \ CHMOD + \ CHMOD_RECURSE + \ CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND + \ CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM + \ CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL + \ CMAKE_OBJDUMP \ CMAKE_TLS_CAINFO \ CMAKE_TLS_VERIFY + \ CODE + \ COMPILE_FEATURES + \ COMPRESSION + \ COMPRESSION_LEVEL \ CONDITION - \ CONFIG + \ CONFIGURE \ CONFIGURE_DEPENDS + \ CONFLICTING_DEPENDENCIES_PREFIX \ CONTENT + \ CONVERT \ COPY \ COPY_ON_ERROR \ CREATE_LINK + \ CRLF \ DESTINATION + \ DIRECTORIES \ DIRECTORY_PERMISSIONS + \ DLL + \ DOS \ DOWNLOAD \ ENCODING - \ EXCLUDE + \ ESCAPE_QUOTES + \ EXECUTABLES \ EXPECTED_HASH \ FILES_MATCHING \ FILE_PERMISSIONS \ FOLLOW_SYMLINKS \ FOLLOW_SYMLINK_CHAIN + \ FORMAT \ FUNCTION \ GENERATE + \ GET_RUNTIME_DEPENDENCIES \ GLOB \ GLOB_RECURSE + \ GROUP_EXECUTE + \ GROUP_READ + \ GROUP_WRITE \ GUARD \ HASH \ HEX \ HTTPHEADER \ IGNORED \ INACTIVITY_TIMEOUT + \ INPUT \ INSTALL \ IS_ABSOLUTE \ LENGTH_MAXIMUM \ LENGTH_MINIMUM \ LF + \ LIBRARIES \ LIMIT \ LIMIT_COUNT \ LIMIT_INPUT \ LIMIT_OUTPUT \ LIST_DIRECTORIES + \ LIST_ONLY \ LOCK \ LOG \ MAKE_DIRECTORY + \ MODULES + \ MTIME + \ MYLIBRARY \ NETRC \ NETRC_FILE \ NEWLINE_CONSUME + \ NEWLINE_STYLE \ NOT \ NO_HEX_CONVERSION \ NO_SOURCE_PERMISSIONS \ OFFSET - \ OLD + \ ONLY \ OPTIONAL \ OUTPUT + \ OWNER_EXECUTE + \ OWNER_READ + \ OWNER_WRITE + \ PATHS \ PATTERN + \ PATTERNS + \ PERMISSIONS + \ POST_EXCLUDE_REGEXES + \ POST_INCLUDE_REGEXES + \ PRE_EXCLUDE_REGEXES + \ PRE_INCLUDE_REGEXES \ PROCESS \ READ \ READ_SYMLINK + \ REAL_PATH \ REGEX \ RELATIVE_PATH \ RELEASE @@ -2134,33 +2714,51 @@ syn keyword cmakeKWfile contained \ REMOVE_RECURSE \ RENAME \ REQUIRED + \ RESOLVED_DEPENDENCIES_VAR \ RESULT \ RESULT_VARIABLE + \ RPATH + \ RUNPATH + \ SCRIPT + \ SHARED \ SHOW_PROGRESS \ SIZE \ SSL + \ STATIC \ STATUS \ STRINGS \ SYMBOLIC + \ TARGET + \ TARGET_PROPERTY \ TIMESTAMP \ TLS_CAINFO \ TLS_VERIFY \ TOUCH \ TOUCH_NOCREATE \ TO_CMAKE_PATH + \ TO_CMAKE_PATH_LIST \ TO_NATIVE_PATH + \ TO_NATIVE_PATH_LIST + \ UNRESOLVED_DEPENDENCIES_VAR \ UPLOAD \ URL \ USERPWD \ USE_SOURCE_PERMISSIONS \ UTC \ UTF + \ VERBOSE + \ WORLD_EXECUTE + \ WORLD_READ + \ WORLD_WRITE \ WRITE + \ XZ + \ _FILENAMES syn keyword cmakeKWfind_file contained \ CMAKE_FIND_ROOT_PATH_BOTH \ DOC \ DVAR + \ FALSE \ HINTS \ INCLUDE \ NAMES @@ -2174,14 +2772,16 @@ syn keyword cmakeKWfind_file contained \ ONLY_CMAKE_FIND_ROOT_PATH \ PATHS \ PATH_SUFFIXES + \ REQUIRED \ VAR syn keyword cmakeKWfind_library contained \ CMAKE_FIND_ROOT_PATH_BOTH \ DOC \ DVAR + \ FALSE \ HINTS - \ LIB + \ INCLUDE \ NAMES \ NAMES_PER_DIR \ NO_CMAKE_ENVIRONMENT_PATH @@ -2194,6 +2794,7 @@ syn keyword cmakeKWfind_library contained \ ONLY_CMAKE_FIND_ROOT_PATH \ PATHS \ PATH_SUFFIXES + \ REQUIRED \ VAR syn keyword cmakeKWfind_package contained @@ -2207,8 +2808,12 @@ syn keyword cmakeKWfind_package contained \ DEC \ DVAR \ EXACT + \ EXCLUDE + \ FALSE + \ FIND_PACKAGE_VERSION_FORMAT \ FRAMEWORK \ HINTS + \ INCLUDE \ MODULE \ NAMES \ NATURAL @@ -2228,12 +2833,26 @@ syn keyword cmakeKWfind_package contained \ OPTIONAL_COMPONENTS \ PACKAGE_FIND_NAME \ PACKAGE_FIND_VERSION + \ PACKAGE_FIND_VERSION_COMPLETE \ PACKAGE_FIND_VERSION_COUNT \ PACKAGE_FIND_VERSION_MAJOR + \ PACKAGE_FIND_VERSION_MAX + \ PACKAGE_FIND_VERSION_MAX_COUNT + \ PACKAGE_FIND_VERSION_MAX_MAJOR + \ PACKAGE_FIND_VERSION_MAX_MINOR + \ PACKAGE_FIND_VERSION_MAX_PATCH + \ PACKAGE_FIND_VERSION_MAX_TWEAK \ PACKAGE_FIND_VERSION_MINOR + \ PACKAGE_FIND_VERSION_MIN_COUNT + \ PACKAGE_FIND_VERSION_MIN_MAJOR + \ PACKAGE_FIND_VERSION_MIN_MINOR + \ PACKAGE_FIND_VERSION_MIN_PATCH + \ PACKAGE_FIND_VERSION_MIN_TWEAK \ PACKAGE_FIND_VERSION_PATCH + \ PACKAGE_FIND_VERSION_RANGE + \ PACKAGE_FIND_VERSION_RANGE_MAX + \ PACKAGE_FIND_VERSION_RANGE_MIN \ PACKAGE_FIND_VERSION_TWEAK - \ PACKAGE_VERSION \ PACKAGE_VERSION_COMPATIBLE \ PACKAGE_VERSION_EXACT \ PACKAGE_VERSION_UNSUITABLE @@ -2258,6 +2877,7 @@ syn keyword cmakeKWfind_path contained \ CMAKE_FIND_ROOT_PATH_BOTH \ DOC \ DVAR + \ FALSE \ HINTS \ INCLUDE \ NAMES @@ -2271,12 +2891,14 @@ syn keyword cmakeKWfind_path contained \ ONLY_CMAKE_FIND_ROOT_PATH \ PATHS \ PATH_SUFFIXES + \ REQUIRED \ VAR syn keyword cmakeKWfind_program contained \ CMAKE_FIND_ROOT_PATH_BOTH \ DOC \ DVAR + \ FALSE \ HINTS \ NAMES \ NAMES_PER_DIR @@ -2290,22 +2912,26 @@ syn keyword cmakeKWfind_program contained \ ONLY_CMAKE_FIND_ROOT_PATH \ PATHS \ PATH_SUFFIXES + \ REQUIRED \ VAR syn keyword cmakeKWfltk_wrap_ui contained \ FLTK syn keyword cmakeKWforeach contained + \ APPEND \ IN \ ITEMS \ LISTS \ RANGE \ STATUS + \ ZIP_LISTS syn keyword cmakeKWfunction contained \ ARGC \ ARGN \ ARGV + \ CALL \ FOO \ PARENT_SCOPE @@ -2333,6 +2959,7 @@ syn keyword cmakeKWget_filename_component contained \ PROGRAM \ PROGRAM_ARGS \ REALPATH + \ REAL_PATH syn keyword cmakeKWget_property contained \ BRIEF_DOCS @@ -2345,13 +2972,15 @@ syn keyword cmakeKWget_property contained \ SET \ SOURCE \ TARGET + \ TARGET_DIRECTORY \ TEST \ VARIABLE syn keyword cmakeKWget_source_file_property contained + \ DIRECTORY \ INHERITED \ LOCATION - \ VAR + \ TARGET_DIRECTORY syn keyword cmakeKWget_target_property contained \ INHERITED @@ -2427,6 +3056,7 @@ syn keyword cmakeKWinclude_guard contained syn keyword cmakeKWinstall contained \ AFTER + \ AIX \ APT \ ARCHIVE \ BEFORE @@ -2460,6 +3090,7 @@ syn keyword cmakeKWinstall contained \ DIRECTORY_PERMISSIONS \ DLL \ DOC + \ ENABLE_EXPORTS \ EXCLUDE_FROM_ALL \ EXPORT \ EXPORT_ANDROID_MK @@ -2565,6 +3196,7 @@ syn keyword cmakeKWlist contained \ INTERNAL \ JOIN \ LENGTH + \ NATURAL \ ORDER \ OUTPUT_VARIABLE \ PARENT_SCOPE @@ -2600,6 +3232,7 @@ syn keyword cmakeKWmacro contained \ ARGC \ ARGN \ ARGV + \ CALL \ DEFINED \ FOO \ GREATER @@ -2616,12 +3249,18 @@ syn keyword cmakeKWmath contained \ OUTPUT_FORMAT syn keyword cmakeKWmessage contained + \ APPEND \ AUTHOR_WARNING + \ CHECK_ + \ CHECK_FAIL + \ CHECK_PASS + \ CHECK_START \ DEBUG \ DEPRECATION \ FATAL_ERROR \ GUI \ NOTICE + \ POP_BACK \ SEND_ERROR \ STATUS \ TRACE @@ -2638,15 +3277,18 @@ syn keyword cmakeKWproject contained \ CUDA \ DESCRIPTION \ HOMEPAGE_URL + \ ISPC \ LANGUAGES \ NAME \ NONE + \ OBJC + \ OBJCXX \ PROJECT \ VERSION \ _BINARY_DIR \ _DESCRIPTION \ _HOMEPAGE_URL - \ _INCLUDE + \ _INCLUDE_BEFORE \ _SOURCE_DIR \ _VERSION \ _VERSION_MAJOR @@ -2664,9 +3306,14 @@ syn keyword cmakeKWremove contained \ VALUE \ VAR +syn keyword cmakeKWreturn contained + \ DEFER + syn keyword cmakeKWseparate_arguments contained \ MSDN \ NATIVE_COMMAND + \ PROGRAM + \ SEPARATE_ARGS \ UNIX_COMMAND \ WINDOWS_COMMAND @@ -2695,12 +3342,15 @@ syn keyword cmakeKWset_property contained \ PROPERTY \ SOURCE \ TARGET + \ TARGET_DIRECTORY \ TEST \ WIX syn keyword cmakeKWset_source_files_properties contained + \ DIRECTORY \ PROPERTIES \ SOURCE + \ TARGET_DIRECTORY syn keyword cmakeKWset_target_properties contained \ PROPERTIES @@ -2710,6 +3360,9 @@ syn keyword cmakeKWset_tests_properties contained \ PROPERTIES \ TEST +syn keyword cmakeKWsite_name contained + \ HOSTNAME + syn keyword cmakeKWsource_group contained \ FILES \ PREFIX @@ -2719,20 +3372,27 @@ syn keyword cmakeKWsource_group contained syn keyword cmakeKWstring contained \ ALPHABET \ APPEND + \ ARRAY \ ASCII + \ BOOLEAN \ CMAKE_MATCH_ \ COMPARE \ CONCAT \ CONFIGURE \ EQUAL + \ ERROR_VARIABLE \ ESCAPE_QUOTES \ FIND \ GENEX_STRIP + \ GET \ GREATER \ GREATER_EQUAL \ GUID \ HASH + \ HEX \ JOIN + \ JSON + \ JSONLENGTH \ LENGTH \ LESS \ LESS_EQUAL @@ -2740,17 +3400,24 @@ syn keyword cmakeKWstring contained \ MATCH \ MATCHALL \ MATCHES + \ MEMBER \ NAMESPACE \ NOTEQUAL + \ NULL + \ NUMBER + \ OBJECT + \ OFF \ ONLY \ PREPEND \ RANDOM \ RANDOM_SEED \ REGEX + \ REMOVE \ REPEAT \ REPLACE \ REVERSE \ RFC + \ SET \ SHA \ SOURCE_DATE_EPOCH \ STRIP @@ -2853,8 +3520,12 @@ syn keyword cmakeKWtarget_link_options contained \ ALIAS \ BEFORE \ CMAKE_ + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION + \ DEVICE_LINK \ GCC \ GNU + \ HOST_LINK \ IMPORTED \ INTERFACE \ INTERFACE_LINK_OPTIONS @@ -2870,9 +3541,23 @@ syn keyword cmakeKWtarget_link_options contained \ _LINKER_WRAPPER_FLAG_SEP syn keyword cmakeKWtarget_precompile_headers contained + \ ALIAS + \ ANGLE + \ BUILD_INTERFACE + \ COMPILE_LANGUAGE + \ DISABLE_PRECOMPILE_HEADERS + \ EXPORT + \ FI + \ GCC + \ IMPORTED \ INTERFACE + \ INTERFACE_PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS + \ PRECOMPILE_HEADERS_REUSE_FROM \ PRIVATE \ PUBLIC + \ REUSE_FROM + \ SKIP_PRECOMPILE_HEADERS syn keyword cmakeKWtarget_sources contained \ ALIAS @@ -2911,6 +3596,12 @@ syn keyword cmakeKWtry_compile contained \ LINK_OPTIONS \ MULTI \ NOT + \ OBJCXX_EXTENSIONS + \ OBJCXX_STANDARD + \ OBJCXX_STANDARD_REQUIRED + \ OBJC_EXTENSIONS + \ OBJC_STANDARD + \ OBJC_STANDARD_REQUIRED \ OUTPUT_VARIABLE \ PRIVATE \ SOURCES @@ -2956,7 +3647,14 @@ syn keyword cmakeKWvariable_requires contained \ TEST_VARIABLE syn keyword cmakeKWvariable_watch contained + \ APPEND \ COMMAND + \ DEFINED + \ MODIFIED_ACCESS + \ READ_ACCESS + \ REMOVED_ACCESS + \ UNKNOWN_MODIFIED_ACCESS + \ UNKNOWN_READ_ACCESS syn keyword cmakeKWwrite_file contained \ APPEND @@ -2988,39 +3686,49 @@ syn keyword cmakeGeneratorExpressions contained \ CONFIGURATION \ CUDA_COMPILER_ID \ CUDA_COMPILER_VERSION + \ CUDA_RESOLVE_DEVICE_SYMBOLS + \ CUDA_SEPARABLE_COMPILATION \ CUSTOM_KEYS \ CXX_COMPILER_ID \ CXX_COMPILER_VERSION + \ CXX_CONFIG \ CXX_STANDARD \ C_COMPILER_ID \ C_COMPILER_VERSION \ C_STANDARD \ DEBUG_MODE \ DEBUG_POSTFIX + \ DEVICE_LINK + \ DLL \ EXCLUDE \ EXPORT \ FALSE \ FILTER \ FOO_EXTRA_THINGS - \ Fortran_COMPILER_ID - \ Fortran_COMPILER_VERSION \ GENERATE \ GENEX_EVAL \ GNU + \ HOST_LINK \ IF \ IGNORE \ IMPORT_PREFIX \ IMPORT_SUFFIX \ INCLUDE_DIRECTORIES \ INSTALL_INTERFACE + \ INSTALL_NAME_DIR \ INSTALL_PREFIX + \ INTERFACE \ INTERFACE_LINK_LIBRARIES \ IN_LIST + \ ISPC_COMPILER_ID + \ ISPC_COMPILER_VERSION \ JOIN \ LANG \ LANG_COMPILER_ID \ LIBRARY_OUTPUT_NAME \ LIBRARY_OUTPUT_NAME_ + \ LINK_LANGUAGE + \ LINK_LANG_AND_ID \ LINK_LIBRARIES \ LINK_ONLY \ LOWER_CASE @@ -3028,6 +3736,10 @@ syn keyword cmakeGeneratorExpressions contained \ MAP_IMPORTED_CONFIG_ \ NO \ NOT + \ OBJCXX_COMPILER_ID + \ OBJCXX_COMPILER_VERSION + \ OBJC_COMPILER_ID + \ OBJC_COMPILER_VERSION \ OFF \ OLD_COMPILER \ OUTPUT_NAME @@ -3046,6 +3758,7 @@ syn keyword cmakeGeneratorExpressions contained \ SDK \ SEMICOLON \ SHELL_PATH + \ STATIC \ STREQUAL \ TARGET_BUNDLE_CONTENT_DIR \ TARGET_BUNDLE_DIR @@ -3100,8 +3813,10 @@ syn keyword cmakeCommand \ break \ build_command \ cmake_host_system_information + \ cmake_language \ cmake_minimum_required \ cmake_parse_arguments + \ cmake_path \ cmake_policy \ configure_file \ continue @@ -3258,8 +3973,10 @@ hi def link cmakeKWadd_subdirectory ModeMsg hi def link cmakeKWadd_test ModeMsg hi def link cmakeKWbuild_command ModeMsg hi def link cmakeKWcmake_host_system_information ModeMsg +hi def link cmakeKWcmake_language ModeMsg hi def link cmakeKWcmake_minimum_required ModeMsg hi def link cmakeKWcmake_parse_arguments ModeMsg +hi def link cmakeKWcmake_path ModeMsg hi def link cmakeKWcmake_policy ModeMsg hi def link cmakeKWconfigure_file ModeMsg hi def link cmakeKWcreate_test_sourcelist ModeMsg @@ -3274,6 +3991,7 @@ hi def link cmakeKWctest_test ModeMsg hi def link cmakeKWctest_update ModeMsg hi def link cmakeKWctest_upload ModeMsg hi def link cmakeKWdefine_property ModeMsg +hi def link cmakeKWdoxygen_add_docs ModeMsg hi def link cmakeKWenable_language ModeMsg hi def link cmakeKWenable_testing ModeMsg hi def link cmakeKWexec_program ModeMsg @@ -3318,6 +4036,7 @@ hi def link cmakeKWproject ModeMsg hi def link cmakeKWqt_wrap_cpp ModeMsg hi def link cmakeKWqt_wrap_ui ModeMsg hi def link cmakeKWremove ModeMsg +hi def link cmakeKWreturn ModeMsg hi def link cmakeKWseparate_arguments ModeMsg hi def link cmakeKWset ModeMsg hi def link cmakeKWset_directory_properties ModeMsg @@ -3325,6 +4044,7 @@ hi def link cmakeKWset_property ModeMsg hi def link cmakeKWset_source_files_properties ModeMsg hi def link cmakeKWset_target_properties ModeMsg hi def link cmakeKWset_tests_properties ModeMsg +hi def link cmakeKWsite_name ModeMsg hi def link cmakeKWsource_group ModeMsg hi def link cmakeKWstring ModeMsg hi def link cmakeKWsubdirs ModeMsg diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d860d4..a2fcf2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -cmake_minimum_required(VERSION 3.1...3.15 FATAL_ERROR) +cmake_minimum_required(VERSION 3.1...3.18 FATAL_ERROR) set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake) set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake) project(CMake) diff --git a/Help/command/DEVICE_LINK_OPTIONS.txt b/Help/command/DEVICE_LINK_OPTIONS.txt index 3f0226f..1297cd0 100644 --- a/Help/command/DEVICE_LINK_OPTIONS.txt +++ b/Help/command/DEVICE_LINK_OPTIONS.txt @@ -1,11 +1,12 @@ -When a device link step is involved, which is controlled by -:prop_tgt:`CUDA_SEPARABLE_COMPILATION` and -:prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`, -the raw options will be delivered to the host and device link steps (wrapped in -``-Xcompiler`` or equivalent for device link). Options wrapped with -``$<DEVICE_LINK:...>`` -:manual:`generator expression <cmake-generator-expressions(7)>` will be used -only for the device link step. Options wrapped with ``$<HOST_LINK:...>`` -:manual:`generator expression <cmake-generator-expressions(7)>` will be used -only for the host link step. +.. versionadded:: 3.18 + When a device link step is involved, which is controlled by + :prop_tgt:`CUDA_SEPARABLE_COMPILATION` and + :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`, + the raw options will be delivered to the host and device link steps (wrapped in + ``-Xcompiler`` or equivalent for device link). Options wrapped with + ``$<DEVICE_LINK:...>`` + :manual:`generator expression <cmake-generator-expressions(7)>` will be used + only for the device link step. Options wrapped with ``$<HOST_LINK:...>`` + :manual:`generator expression <cmake-generator-expressions(7)>` will be used + only for the host link step. diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 4a62c5b..97eecfc 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -33,9 +33,6 @@ of this command. If the |SEARCH_XXX| is found the result is stored in the variable and the search will not be repeated unless the variable is cleared. If nothing is found, the result will be ``<VAR>-NOTFOUND``. -The ``REQUIRED`` option stops processing with an error message if nothing -is found, otherwise the search will be attempted again the -next time |FIND_XXX| is invoked with the same variable. Options include: @@ -60,7 +57,11 @@ Options include: Specify the documentation string for the ``<VAR>`` cache entry. ``REQUIRED`` - Stop processing with an error message if nothing is found. + .. versionadded:: 3.18 + + Stop processing with an error message if nothing is found, otherwise + the search will be attempted again the next time |FIND_XXX| is invoked + with the same variable. If ``NO_DEFAULT_PATH`` is specified, then no additional paths are added to the search. @@ -84,20 +85,21 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: |prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_SYSTEM_PREFIX_PATH` -1. If called from within a find module or any other script loaded by a call to - :command:`find_package(<PackageName>)`, search prefixes unique to the - current package being found. Specifically, look in the - :variable:`<PackageName>_ROOT` CMake variable and the - :envvar:`<PackageName>_ROOT` environment variable. - The package root variables are maintained as a stack, so if called from - nested find modules or config packages, root paths from the parent's find - module or config package will be searched after paths from the current - module or package. In other words, the search order would be - ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``, - ``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc. - This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting - the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``. - See policy :policy:`CMP0074`. +1. .. versionadded:: 3.12 + If called from within a find module or any other script loaded by a call to + :command:`find_package(<PackageName>)`, search prefixes unique to the + current package being found. Specifically, look in the + :variable:`<PackageName>_ROOT` CMake variable and the + :envvar:`<PackageName>_ROOT` environment variable. + The package root variables are maintained as a stack, so if called from + nested find modules or config packages, root paths from the parent's find + module or config package will be searched after paths from the current + module or package. In other words, the search order would be + ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``, + ``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc. + This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting + the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``. + See policy :policy:`CMP0074`. * |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| @@ -151,6 +153,10 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: or in the short-hand version of the command. These are typically hard-coded guesses. +.. versionadded:: 3.16 + Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable + various search locations. + .. |FIND_ARGS_XXX| replace:: <VAR> NAMES name On macOS the :variable:`CMAKE_FIND_FRAMEWORK` and diff --git a/Help/command/OPTIONS_SHELL.txt b/Help/command/OPTIONS_SHELL.txt index 0f8ec32..4051ffe 100644 --- a/Help/command/OPTIONS_SHELL.txt +++ b/Help/command/OPTIONS_SHELL.txt @@ -1,9 +1,11 @@ The final set of compile or link options used for a target is constructed by accumulating options from the current target and the usage requirements of its dependencies. The set of options is de-duplicated to avoid repetition. -While beneficial for individual options, the de-duplication step can break -up option groups. For example, ``-D A -D B`` becomes ``-D A B``. One may -specify a group of options using shell-like quoting along with a ``SHELL:`` -prefix. The ``SHELL:`` prefix is dropped, and the rest of the option string -is parsed using the :command:`separate_arguments` ``UNIX_COMMAND`` mode. -For example, ``"SHELL:-D A" "SHELL:-D B"`` becomes ``-D A -D B``. + +.. versionadded:: 3.12 + While beneficial for individual options, the de-duplication step can break + up option groups. For example, ``-D A -D B`` becomes ``-D A B``. One may + specify a group of options using shell-like quoting along with a ``SHELL:`` + prefix. The ``SHELL:`` prefix is dropped, and the rest of the option string + is parsed using the :command:`separate_arguments` ``UNIX_COMMAND`` mode. + For example, ``"SHELL:-D A" "SHELL:-D B"`` becomes ``-D A -D B``. diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 231f9da..45e4e3e 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -51,6 +51,8 @@ The options are: used in the future. ``BYPRODUCTS`` + .. versionadded:: 3.2 + Specify the files the command is expected to produce but whose modification time may or may not be newer than the dependencies. If a byproduct name is a relative path it will be interpreted @@ -88,10 +90,11 @@ The options are: * The target is not being cross-compiled (i.e. the :variable:`CMAKE_CROSSCOMPILING` variable is not set to true). - * The target is being cross-compiled and an emulator is provided (i.e. - its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set). - In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be - prepended to the command before the location of the target executable. + * .. versionadded:: 3.6 + The target is being cross-compiled and an emulator is provided (i.e. + its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set). + In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be + prepended to the command before the location of the target executable. If neither of the above conditions are met, it is assumed that the command name is a program to be found on the ``PATH`` at build time. @@ -153,18 +156,23 @@ The options are: If any dependency is an ``OUTPUT`` of another custom command in the same directory (``CMakeLists.txt`` file), CMake automatically brings the other custom command into the target in which this command is built. - A target-level dependency is added if any dependency is listed as - ``BYPRODUCTS`` of a target or any of its build events in the same - directory to ensure the byproducts will be available. + + .. versionadded:: 3.16 + A target-level dependency is added if any dependency is listed as + ``BYPRODUCTS`` of a target or any of its build events in the same + directory to ensure the byproducts will be available. If ``DEPENDS`` is not specified, the command will run whenever the ``OUTPUT`` is missing; if the command does not actually create the ``OUTPUT``, the rule will always run. - Arguments to ``DEPENDS`` may use - :manual:`generator expressions <cmake-generator-expressions(7)>`. + .. versionadded:: 3.1 + Arguments to ``DEPENDS`` may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. ``COMMAND_EXPAND_LISTS`` + .. versionadded:: 3.8 + Lists in ``COMMAND`` arguments will be expanded, including those created with :manual:`generator expressions <cmake-generator-expressions(7)>`, @@ -184,6 +192,8 @@ The options are: only for Makefile generators and will be ignored by other generators. ``JOB_POOL`` + .. versionadded:: 3.15 + Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja` generator. Incompatible with ``USES_TERMINAL``, which implies the ``console`` pool. @@ -211,6 +221,8 @@ The options are: source file property. ``USES_TERMINAL`` + .. versionadded:: 3.2 + The command will be given direct access to the terminal if possible. With the :generator:`Ninja` generator, this places the command in the ``console`` :prop_gbl:`pool <JOB_POOLS>`. @@ -230,15 +242,23 @@ The options are: If it is a relative path it will be interpreted relative to the build tree directory corresponding to the current source directory. - Arguments to ``WORKING_DIRECTORY`` may use - :manual:`generator expressions <cmake-generator-expressions(7)>`. + .. versionadded:: 3.13 + Arguments to ``WORKING_DIRECTORY`` may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. ``DEPFILE`` + .. versionadded:: 3.7 + Specify a ``.d`` depfile for the :generator:`Ninja` generator. A ``.d`` file holds dependencies usually emitted by the custom command itself. Using ``DEPFILE`` with other generators than Ninja is an error. + If the ``DEPFILE`` argument is relative, it should be relative to + :variable:`CMAKE_CURRENT_BINARY_DIR`, and any relative paths inside the + ``DEPFILE`` should also be relative to :variable:`CMAKE_CURRENT_BINARY_DIR` + (see policy :policy:`CMP0116`.) + Build Events ^^^^^^^^^^^^ diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index 2eb0c88..7c29dda 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -32,6 +32,8 @@ The options are: called ``ALL``). ``BYPRODUCTS`` + .. versionadded:: 3.2 + Specify the files the command is expected to produce but whose modification time may or may not be updated on subsequent builds. If a byproduct name is a relative path it will be interpreted @@ -67,10 +69,11 @@ The options are: * The target is not being cross-compiled (i.e. the :variable:`CMAKE_CROSSCOMPILING` variable is not set to true). - * The target is being cross-compiled and an emulator is provided (i.e. - its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set). - In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be - prepended to the command before the location of the target executable. + * .. versionadded:: 3.6 + The target is being cross-compiled and an emulator is provided (i.e. + its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set). + In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be + prepended to the command before the location of the target executable. If neither of the above conditions are met, it is assumed that the command name is a program to be found on the ``PATH`` at build time. @@ -103,14 +106,18 @@ The options are: :command:`add_custom_command` command calls in the same directory (``CMakeLists.txt`` file). They will be brought up to date when the target is built. - A target-level dependency is added if any dependency is a byproduct - of a target or any of its build events in the same directory to ensure - the byproducts will be available before this target is built. + + .. versionchanged:: 3.16 + A target-level dependency is added if any dependency is a byproduct + of a target or any of its build events in the same directory to ensure + the byproducts will be available before this target is built. Use the :command:`add_dependencies` command to add dependencies on other targets. ``COMMAND_EXPAND_LISTS`` + .. versionadded:: 3.8 + Lists in ``COMMAND`` arguments will be expanded, including those created with :manual:`generator expressions <cmake-generator-expressions(7)>`, @@ -119,6 +126,8 @@ The options are: to be properly expanded. ``JOB_POOL`` + .. versionadded:: 3.15 + Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja` generator. Incompatible with ``USES_TERMINAL``, which implies the ``console`` pool. @@ -141,6 +150,8 @@ The options are: tool-specific special characters. ``USES_TERMINAL`` + .. versionadded:: 3.2 + The command will be given direct access to the terminal if possible. With the :generator:`Ninja` generator, this places the command in the ``console`` :prop_gbl:`pool <JOB_POOLS>`. @@ -150,5 +161,6 @@ The options are: If it is a relative path it will be interpreted relative to the build tree directory corresponding to the current source directory. - Arguments to ``WORKING_DIRECTORY`` may use - :manual:`generator expressions <cmake-generator-expressions(7)>`. + .. versionadded:: 3.13 + Arguments to ``WORKING_DIRECTORY`` may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index de219a5..14c0183 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -17,6 +17,9 @@ Dependencies added to an :ref:`imported target <Imported Targets>` or an :ref:`interface library <Interface Libraries>` are followed transitively in its place since the target itself does not build. +.. versionadded:: 3.3 + Allow adding dependencies to interface libraries. + See the ``DEPENDS`` option of :command:`add_custom_target` and :command:`add_custom_command` commands for adding file-level dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS` diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst index e073228..dde9429 100644 --- a/Help/command/add_executable.rst +++ b/Help/command/add_executable.rst @@ -17,13 +17,21 @@ Normal Executables [source1] [source2 ...]) Adds an executable target called ``<name>`` to be built from the source -files listed in the command invocation. (The source files can be omitted -here if they are added later using :command:`target_sources`.) The +files listed in the command invocation. The ``<name>`` corresponds to the logical target name and must be globally unique within a project. The actual file name of the executable built is constructed based on conventions of the native platform (such as ``<name>.exe`` or just ``<name>``). +.. versionadded:: 3.1 + Source arguments to ``add_executable`` may use "generator expressions" with + the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` + manual for available expressions. + +.. versionadded:: 3.11 + The source files can be omitted if they are added later using + :command:`target_sources`. + By default the executable file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked. See documentation of the @@ -43,10 +51,8 @@ If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL` target property for details. -Source arguments to ``add_executable`` may use "generator expressions" with -the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` -manual for available expressions. See the :manual:`cmake-buildsystem(7)` -manual for more on defining buildsystem properties. +See the :manual:`cmake-buildsystem(7)` manual for more on defining +buildsystem properties. See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are pre-processed, and you want to have the original sources reachable from @@ -85,10 +91,14 @@ be used to refer to ``<target>`` in subsequent commands. The ``<name>`` does not appear in the generated buildsystem as a make target. The ``<target>`` may not be an ``ALIAS``. -An ``ALIAS`` to a non-``GLOBAL`` :ref:`Imported Target <Imported Targets>` -has scope in the directory in which the alias is created and below. -The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the -alias is global or not. +.. versionadded:: 3.11 + An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>` + +.. versionadded:: 3.18 + An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is + scoped to the directory in which it is created and subdirectories. + The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the + alias is global or not. ``ALIAS`` targets can be used as targets to read properties from, executables for custom commands and custom targets. They can also be diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index b7dfabc..d3fbdcf 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -17,13 +17,21 @@ Normal Libraries [<source>...]) Adds a library target called ``<name>`` to be built from the source files -listed in the command invocation. (The source files can be omitted here -if they are added later using :command:`target_sources`.) The ``<name>`` +listed in the command invocation. The ``<name>`` corresponds to the logical target name and must be globally unique within a project. The actual file name of the library built is constructed based on conventions of the native platform (such as ``lib<name>.a`` or ``<name>.lib``). +.. versionadded:: 3.1 + Source arguments to ``add_library`` may use "generator expressions" with + the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` + manual for available expressions. + +.. versionadded:: 3.11 + The source files can be omitted if they are added later using + :command:`target_sources`. + ``STATIC``, ``SHARED``, or ``MODULE`` may be given to specify the type of library to be created. ``STATIC`` libraries are archives of object files for use when linking other targets. ``SHARED`` libraries are linked @@ -34,9 +42,13 @@ type is ``STATIC`` or ``SHARED`` based on whether the current value of the variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and ``MODULE`` libraries the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property is set to ``ON`` automatically. -A ``SHARED`` or ``STATIC`` library may be marked with the :prop_tgt:`FRAMEWORK` +A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` target property to create an macOS Framework. +.. versionadded:: 3.8 + A ``STATIC`` library may be marked with the :prop_tgt:`FRAMEWORK` + target property to create a static Framework. + If a library does not export any symbols, it must not be declared as a ``SHARED`` library. For example, a Windows resource DLL or a managed C++/CLI DLL that exports no unmanaged symbols would need to be a ``MODULE`` library. @@ -55,10 +67,8 @@ If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL` target property for details. -Source arguments to ``add_library`` may use "generator expressions" with -the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` -manual for available expressions. See the :manual:`cmake-buildsystem(7)` -manual for more on defining buildsystem properties. +See the :manual:`cmake-buildsystem(7)` manual for more on defining +buildsystem properties. See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are pre-processed, and you want to have the original sources reachable from @@ -93,6 +103,9 @@ systems (such as Xcode) may not like targets that have only object files, so consider adding at least one real source file to any target that references ``$<TARGET_OBJECTS:objlib>``. +.. versionadded:: 3.12 + Object libraries can be linked to with :command:`target_link_libraries`. + Interface Libraries ^^^^^^^^^^^^^^^^^^^ @@ -121,23 +134,28 @@ like any other target. An interface library created with the above signature has no source files itself and is not included as a target in the generated buildsystem. -Since CMake 3.19, an interface library target may be created with -source files: +.. versionadded:: 3.15 + An interface library can have :prop_tgt:`PUBLIC_HEADER` and + :prop_tgt:`PRIVATE_HEADER` properties. The headers specified by those + properties can be installed using the :command:`install(TARGETS)` command. -.. code-block:: cmake +.. versionadded:: 3.19 + An interface library target may be created with source files: + + .. code-block:: cmake - add_library(<name> INTERFACE [<source>...] [EXCLUDE_FROM_ALL]) + add_library(<name> INTERFACE [<source>...] [EXCLUDE_FROM_ALL]) -Source files may be listed directly in the ``add_library`` call or added -later by calls to :command:`target_sources` with the ``PRIVATE`` or -``PUBLIC`` keywords. + Source files may be listed directly in the ``add_library`` call or added + later by calls to :command:`target_sources` with the ``PRIVATE`` or + ``PUBLIC`` keywords. -If an interface library has source files (i.e. the :prop_tgt:`SOURCES` -target property is set), it will appear in the generated buildsystem -as a build target much like a target defined by the -:command:`add_custom_target` command. It does not compile any sources, -but does contain build rules for custom commands created by the -:command:`add_custom_command` command. + If an interface library has source files (i.e. the :prop_tgt:`SOURCES` + target property is set), it will appear in the generated buildsystem + as a build target much like a target defined by the + :command:`add_custom_target` command. It does not compile any sources, + but does contain build rules for custom commands created by the + :command:`add_custom_command` command. .. note:: In most command signatures where the ``INTERFACE`` keyword appears, @@ -211,10 +229,14 @@ used to refer to ``<target>`` in subsequent commands. The ``<name>`` does not appear in the generated buildsystem as a make target. The ``<target>`` may not be an ``ALIAS``. -An ``ALIAS`` to a non-``GLOBAL`` :ref:`Imported Target <Imported Targets>` -has scope in the directory in which the alias is created and below. -The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the -alias is global or not. +.. versionadded:: 3.11 + An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>` + +.. versionadded:: 3.18 + An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is + scoped to the directory in which it is created and below. + The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the + alias is global or not. ``ALIAS`` targets can be used as linkable targets and as targets to read properties from. They can also be tested for existence with the diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst index 2b4d082..832d8db 100644 --- a/Help/command/add_test.rst +++ b/Help/command/add_test.rst @@ -31,6 +31,8 @@ if necessary. See policy :policy:`CMP0110`. The options are: current source directory. ``COMMAND_EXPAND_LISTS`` + .. versionadded:: 3.16 + Lists in ``COMMAND`` arguments will be expanded, including those created with :manual:`generator expressions <cmake-generator-expressions(7)>`. @@ -43,6 +45,9 @@ unless the :prop_test:`PASS_REGULAR_EXPRESSION`, :prop_test:`FAIL_REGULAR_EXPRESSION` or :prop_test:`SKIP_REGULAR_EXPRESSION` test property is used. +.. versionadded:: 3.16 + Added :prop_test:`SKIP_REGULAR_EXPRESSION` property. + The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst index 2e9563a..2b902a9 100644 --- a/Help/command/cmake_host_system_information.rst +++ b/Help/command/cmake_host_system_information.rst @@ -24,6 +24,14 @@ Key Description ``AVAILABLE_VIRTUAL_MEMORY`` Available virtual memory in MiB [#mebibytes]_ ``TOTAL_PHYSICAL_MEMORY`` Total physical memory in MiB [#mebibytes]_ ``AVAILABLE_PHYSICAL_MEMORY`` Available physical memory in MiB [#mebibytes]_ +============================= ================================================ + +.. versionadded:: 3.10 + Additional ``<key>`` values are available: + +============================= ================================================ +Key Description +============================= ================================================ ``IS_64BIT`` One if processor is 64Bit ``HAS_FPU`` One if processor has floating point unit ``HAS_MMX`` One if processor supports MMX instructions diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index f3326b8..c3b3e73 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -7,6 +7,9 @@ Require a minimum version of cmake. cmake_minimum_required(VERSION <min>[...<max>] [FATAL_ERROR]) +.. versionadded:: 3.12 + The optional ``<max>`` version. + Sets the minimum required version of cmake for a project. Also updates the policy settings as explained below. diff --git a/Help/command/cmake_parse_arguments.rst b/Help/command/cmake_parse_arguments.rst index 8803ec8..7c85da6 100644 --- a/Help/command/cmake_parse_arguments.rst +++ b/Help/command/cmake_parse_arguments.rst @@ -1,8 +1,6 @@ cmake_parse_arguments --------------------- -.. versionadded:: 3.5 - Parse function or macro arguments. .. code-block:: cmake @@ -13,6 +11,10 @@ Parse function or macro arguments. cmake_parse_arguments(PARSE_ARGV <N> <prefix> <options> <one_value_keywords> <multi_value_keywords>) +.. versionadded:: 3.5 + This command is implemented natively. Previously, it has been defined in the + module :module:`CMakeParseArguments`. + This command is for use in macros or functions. It processes the arguments given to that macro or function, and defines a set of variables which hold the values of the @@ -21,11 +23,12 @@ respective options. The first signature reads processes arguments passed in the ``<args>...``. This may be used in either a :command:`macro` or a :command:`function`. -The ``PARSE_ARGV`` signature is only for use in a :command:`function` -body. In this case the arguments that are parsed come from the -``ARGV#`` variables of the calling function. The parsing starts with -the ``<N>``-th argument, where ``<N>`` is an unsigned integer. This allows for -the values to have special characters like ``;`` in them. +.. versionadded:: 3.7 + The ``PARSE_ARGV`` signature is only for use in a :command:`function` + body. In this case the arguments that are parsed come from the + ``ARGV#`` variables of the calling function. The parsing starts with + the ``<N>``-th argument, where ``<N>`` is an unsigned integer. + This allows for the values to have special characters like ``;`` in them. The ``<options>`` argument contains all options for the respective macro, i.e. keywords which can be used when calling the macro without any value @@ -40,12 +43,11 @@ The ``<multi_value_keywords>`` argument contains all keywords for this macro which can be followed by more than one value, like e.g. the ``TARGETS`` or ``FILES`` keywords of the :command:`install` command. -.. note:: - - All keywords shall be unique. I.e. every keyword shall only be specified - once in either ``<options>``, ``<one_value_keywords>`` or - ``<multi_value_keywords>``. A warning will be emitted if uniqueness is - violated. +.. versionchanged:: 3.5 + All keywords shall be unique. I.e. every keyword shall only be specified + once in either ``<options>``, ``<one_value_keywords>`` or + ``<multi_value_keywords>``. A warning will be emitted if uniqueness is + violated. When done, ``cmake_parse_arguments`` will consider for each of the keywords listed in ``<options>``, ``<one_value_keywords>`` and @@ -61,10 +63,12 @@ All remaining arguments are collected in a variable were recognized. This can be checked afterwards to see whether your macro was called with unrecognized parameters. -``<one_value_keywords>`` and ``<multi_value_keywords>`` that were given no -values at all are collected in a variable ``<prefix>_KEYWORDS_MISSING_VALUES`` -that will be undefined if all keywords received values. This can be checked -to see if there were keywords without any values given. +.. versionadded:: 3.15 + ``<one_value_keywords>`` and ``<multi_value_keywords>`` that were given no + values at all are collected in a variable + ``<prefix>_KEYWORDS_MISSING_VALUES`` that will be undefined if all keywords + received values. This can be checked to see if there were keywords without + any values given. Consider the following example macro, ``my_install()``, which takes similar arguments to the real :command:`install` command: diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst new file mode 100644 index 0000000..2d37ae0 --- /dev/null +++ b/Help/command/cmake_path.rst @@ -0,0 +1,817 @@ +cmake_path +---------- + +.. versionadded:: 3.20 + +Filesystem path manipulation command. + +This command is dedicated to the manipulation of objects of type path which +represent paths on a filesystem. Only syntactic aspects of paths are handled: +the pathname may represent a non-existing path or even one that is not allowed +to exist on the current file system or OS. + +For operations involving the filesystem, have a look at the :command:`file` +command. + +The path name has the following syntax: + +1. ``root-name`` (optional): identifies the root on a filesystem with multiple + roots (such as ``"C:"`` or ``"//myserver"``). + +2. ``root-directory`` (optional): a directory separator that, if present, marks + this path as absolute. If it is missing (and the first element other than + the ``root-name`` is a ``item-name``), then the path is relative. + +Zero or more of the following: + +3. ``item-name``: sequence of characters that aren't directory separators. This + name may identify a file, a hard link, a symbolic link, or a directory. Two + special ``item-names`` are recognized: + + * ``dot``: the item name consisting of a single dot character ``.`` is a + directory name that refers to the current directory. + + * ``dot-dot``: the item name consisting of two dot characters ``..`` is a + directory name that refers to the parent directory. + +4. ``directory-separator``: the forward slash character ``/``. If this + character is repeated, it is treated as a single directory separator: + ``/usr///////lib`` is the same as ``/usr/lib``. + +.. _FILENAME_DEF: + +A path has a filename if it does not ends with a ``directory-separator``. The +filename is the last ``item-name`` of the path. + +.. _EXTENSION_DEF: + +A :ref:`filename <FILENAME_DEF>` can have an extension. By default, the +extension is defined as the sub-string beginning at the leftmost period +(including the period) and until the end of the pathname. When the option +``LAST_ONLY`` is specified, the extension is the sub-string beginning at the +rightmost period. + +The following exceptions apply: + + * If the first character in the :ref:`filename <FILENAME_DEF>` is a period, + that period is ignored (a filename like ``".profile"`` is not treated as an + extension). + + * If the pathname is either ``.`` or ``..``. + +.. note:: + + ``cmake_path`` command handles paths in the format of the build system, not + the target system. So this is not generally applicable to the target system + in cross-compiling environment. + +For all commands, ``<path-var>`` placeholder expect a variable name. An error +will be raised if the variable does not exist, except for `SET`_ and `APPEND`_ +sub-commands. ``<input>`` placeholder expect a string literal. +``[<input>...]`` placeholder expect zero or more arguments. ``<out-var>`` +placeholder expect a variable name. + +.. note:: + + ``cmake_path`` command does not support list of paths. The ``<path-var>`` + placeholder must store only one path name. + +To initialize a path variable, three possibilities can be used: + +1. :command:`set` command. +2. :ref:`cmake_path(SET) <SET>` command. Mainly used to build a + path variable from a native path. +3. :ref:`cmake_path(APPEND) <APPEND>` command. Can be used to build a path from + already available path fragments. + + .. code-block:: cmake + + # To build the path "${CMAKE_CURRENT_SOURCE_DIR}/data" + + set (path1 "${CMAKE_CURRENT_SOURCE_DIR}/data") + + cmake_path(SET path2 "${CMAKE_CURRENT_SOURCE_DIR}/data") + + cmake_path(APPEND path3 "${CMAKE_CURRENT_SOURCE_DIR}" "data") + +`Modification`_ and `Generation`_ sub-commands store the result in-place or in +the variable specified by ``OUTPUT_VARIABLE`` option. All other sub-commands +store the result in the required ``<out-var>`` variable. + +Sub-commands supporting ``NORMALIZE`` option will :ref:`normalize <NORMAL_PATH>` +the path. + +Synopsis +^^^^^^^^ + +.. parsed-literal:: + + `Decomposition`_ + cmake_path(`GET`_ <path-var> :ref:`ROOT_NAME <GET_ROOT_NAME>` <out-var>) + cmake_path(`GET`_ <path-var> :ref:`ROOT_DIRECTORY <GET_ROOT_DIRECTORY>` <out-var>) + cmake_path(`GET`_ <path-var> :ref:`ROOT_PATH <GET_ROOT_PATH>` <out-var>) + cmake_path(`GET`_ <path-var> :ref:`FILENAME <GET_FILENAME>` <out-var>) + cmake_path(`GET`_ <path-var> :ref:`EXTENSION <GET_EXTENSION>` [LAST_ONLY] <out-var>) + cmake_path(`GET`_ <path-var> :ref:`STEM <GET_STEM>` [LAST_ONLY] <out-var>) + cmake_path(`GET`_ <path-var> :ref:`RELATIVE_PATH <GET_RELATIVE_PATH>` <out-var>) + cmake_path(`GET`_ <path-var> :ref:`PARENT_PATH <GET_PARENT_PATH>` <out-var>) + + `Modification`_ + cmake_path(`SET`_ <path-var> [NORMALIZE] <input>) + cmake_path(`APPEND`_ <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>]) + cmake_path(`APPEND_STRING`_ <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>]) + cmake_path(`REMOVE_FILENAME`_ <path-var> [OUTPUT_VARIABLE <out-var>]) + cmake_path(`REPLACE_FILENAME`_ <path-var> <input> [OUTPUT_VARIABLE <out-var>]) + cmake_path(`REMOVE_EXTENSION`_ <path-var> [LAST_ONLY] + [OUTPUT_VARIABLE <out-var>]) + cmake_path(`REPLACE_EXTENSION`_ <path-var> [LAST_ONLY] <input> + [OUTPUT_VARIABLE <out-var>]) + + `Generation`_ + cmake_path(`NORMAL_PATH`_ <path-var> [OUTPUT_VARIABLE <out-var>]) + cmake_path(`RELATIVE_PATH`_ <path-var> [BASE_DIRECTORY <input>] + [OUTPUT_VARIABLE <out-var>]) + cmake_path(`ABSOLUTE_PATH`_ <path-var> [BASE_DIRECTORY <input>] [NORMALIZE] + [OUTPUT_VARIABLE <out-var>]) + + `Conversion`_ + cmake_path(`NATIVE_PATH`_ <path-var> [NORMALIZE] <out-var>) + cmake_path(`CONVERT`_ <input> `TO_CMAKE_PATH_LIST`_ <out-var>) + cmake_path(`CONVERT`_ <input> `TO_NATIVE_PATH_LIST`_ <out-var>) + + `Comparison`_ + cmake_path(`COMPARE`_ <input1> <OP> <input2> <out-var>) + + `Query`_ + cmake_path(`HAS_ROOT_NAME`_ <path-var> <out-var>) + cmake_path(`HAS_ROOT_DIRECTORY`_ <path-var> <out-var>) + cmake_path(`HAS_ROOT_PATH`_ <path-var> <out-var>) + cmake_path(`HAS_FILENAME`_ <path-var> <out-var>) + cmake_path(`HAS_EXTENSION`_ <path-var> <out-var>) + cmake_path(`HAS_STEM`_ <path-var> <out-var>) + cmake_path(`HAS_RELATIVE_PATH`_ <path-var> <out-var>) + cmake_path(`HAS_PARENT_PATH`_ <path-var> <out-var>) + cmake_path(`IS_ABSOLUTE`_ <path-var> <out-var>) + cmake_path(`IS_RELATIVE`_ <path-var> <out-var>) + cmake_path(`IS_PREFIX`_ <path-var> <input> [NORMALIZE] <out-var>) + + `Hashing`_ + cmake_path(`HASH`_ <path-var> [NORMALIZE] <out-var>) + +Decomposition +^^^^^^^^^^^^^ + +.. _GET: +.. _GET_ROOT_NAME: + +.. code-block:: cmake + + cmake_path(GET <path-var> ROOT_NAME <out-var>) + +Returns the root name of the path. If the path does not include a root name, +returns an empty path. + +.. note:: + + Only ``Windows`` system has the concept of ``root-name``, so on all other + systems, it is always an empty path. + +For example: + + .. code-block:: cmake + + set (path "c:/a") + cmake_path (GET path ROOT_NAME output) + message ("Root name is \"${output}\"") + + Will display:: + + Root name is "c:" + +.. _GET_ROOT_DIRECTORY: + +.. code-block:: cmake + + cmake_path(GET <path-var> ROOT_DIRECTORY <out-var>) + +Returns the root directory of the path. If the path does not include a root +directory, returns an empty path. + +For example: + + .. code-block:: cmake + + set (path "c:/a") + cmake_path (GET path ROOT_DIRECTORY output) + message ("Root directory is \"${output}\"") + + Will display:: + + Root directory is "/" + +.. _GET_ROOT_PATH: + +.. code-block:: cmake + + cmake_path(GET <path-var> ROOT_PATH <out-var>) + +Returns the root path of the path. If the path does not include a root path, +returns an empty path. + +Effectively, returns the following: ``root-name root-directory``. + +For example: + + .. code-block:: cmake + + set (path "c:/a") + cmake_path (GET path ROOT_PATH output) + message ("Root path is \"${output}\"") + + Will display:: + + Root path is "c:/" + +.. _GET_FILENAME: + +.. code-block:: cmake + + cmake_path(GET <path-var> FILENAME <out-var>) + +Returns the :ref:`filename <FILENAME_DEF>` component of the path. If the path +ends with a ``directory-separator``, there is no filename, so returns an empty +path. + +For example: + + .. code-block:: cmake + + set (path "/a") + cmake_path (GET path FILENAME output) + message ("First filename is \"${output}\"") + + set (path "/a/") + cmake_path (GET path FILENAME output) + message ("Second filename is \"${output}\"") + + Will display:: + + First filename is "a" + Second filename is "" + +.. _GET_EXTENSION: + +.. code-block:: cmake + + cmake_path(GET <path-var> EXTENSION [LAST_ONLY] <out-var>) + +Returns the :ref:`extension <EXTENSION_DEF>` of the filename component. + +If the :ref:`filename <FILENAME_DEF>` component of the path contains a period +(``.``), and is not one of the special filesystem elements ``dot`` or +``dot-dot``, then the :ref:`extension <EXTENSION_DEF>` is returned. + +For example: + + .. code-block:: cmake + + set (path "name.ext1.ext2") + cmake_path (GET path EXTENSION result) + message ("Full extension is \"${result}\"") + cmake_path (GET path EXTENSION LAST_ONLY result) + message ("Last extension is \"${result}\"") + + Will display:: + + Full extension is ".ext1.ext2" + Last extension is ".ext2" + +The following exceptions apply: + + * If the first character in the filename is a period, that period is ignored + (a filename like ``".profile"`` is not treated as an extension). + + * If the pathname is either ``.`` or ``..``, or if + :ref:`filename <FILENAME_DEF>` component does not contain the ``.`` + character, then an empty path is returned. + +.. _GET_STEM: + +.. code-block:: cmake + + cmake_path(GET <path-var> STEM [LAST_ONLY] <out-var>) + +Returns the :ref:`filename <FILENAME_DEF>` component of the path stripped of +its :ref:`extension <EXTENSION_DEF>`. + +For Example: + + .. code-block:: cmake + + set (path "name.ext1.ext2") + cmake_path (GET path STEM result) + message ("Filename without the extension is \"${result}\"") + cmake_path (GET path STEM LAST_ONLY result) + message ("Filename whiteout the last extension is \"${result}\"") + + Will display:: + + Filename without the extension is "name" + Filename without the last extension is "name.ext1" + +The following exceptions apply: + + * If the first character in the filename is a period, that period is ignored + (a filename like ``".profile"`` is not treated as an extension). + + * If the filename is one of the special filesystem components ``dot`` or + ``dot-dot``, or if it has no periods, the function returns the entire + :ref:`filename <FILENAME_DEF>` component. + +.. _GET_RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(GET <path-var> RELATIVE_PATH <out-var>) + +Returns path relative to ``root-path``, that is, a pathname composed of +every component of ``<path-var>`` after ``root-path``. If ``<path-var>`` is +an empty path, returns an empty path. + +For Example: + + .. code-block:: cmake + + set (path "/a/b") + cmake_path (GET path RELATIVE_PATH result) + message ("Relative path is \"${result}\"") + + set (path "/") + cmake_path (GET path RELATIVE_PATH result) + message ("Relative path is \"${result}\"") + + Will display:: + + Relative path is "a/b" + Relative path is "" + +.. _GET_PARENT_PATH: + +.. code-block:: cmake + + cmake_path(GET <path-var> PARENT_PATH <out-var>) + +Returns the path to the parent directory. + +If `HAS_RELATIVE_PATH`_ sub-command returns false, the result is a copy of +``<path-var>``. Otherwise, the result is ``<path-var>`` with one fewer element. + +For Example: + + .. code-block:: cmake + + set (path "c:/a/b") + cmake_path (GET path PARENT_PATH result) + message ("Parent path is \"${result}\"") + + set (path "c:/") + cmake_path (GET path PARENT_PATH result) + message ("Parent path is \"${result}\"") + + Will display:: + + Parent path is "c:/a" + Relative path is "c:/" + +Modification +^^^^^^^^^^^^ + +.. _cmake_path-SET: +.. _SET: + +.. code-block:: cmake + + cmake_path(SET <path-var> [NORMALIZE] <input>) + +Assign the ``<input>`` path to ``<path-var>``. Moreover, if ``<input>`` is a +native path, it is converted into cmake-style path with forward-slashes +(``/``). On Windows, the long filename marker is taken into account. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +For Example: + + .. code-block:: cmake + + set (native_path "c:\\a\\b/..\\c") + cmake_path (SET path "${native_path}") + message ("CMake path is \"${path}\"") + + cmake_path (SET path NORMALIZE "${native_path}") + message ("Normalized CMake path is \"${path}\"") + + Will display:: + + CMake path is "c:/a/b/../c" + Normalized CMake path is "c:/a/c" + +.. _APPEND: + +.. code-block:: cmake + + cmake_path(APPEND <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>]) + +Append all the ``<input>`` arguments to the ``<path-var>`` using ``/`` as +``directory-separator``. + +For each ``<input>`` argument, the following algorithm (pseudo-code) applies: + + .. code-block:: cmake + + # <path> is the contents of <path-var> + + IF (<input>.is_absolute() OR + (<input>.has_root_name() AND + NOT <input>.root_name() STREQUAL <path>.root_name())) + replaces <path> with <input> + RETURN() + ENDIF() + + IF (<input>.has_root_directory()) + remove any root-directory and the entire relative path from <path> + ELSEIF (<path>.has_filename() OR + (NOT <path-var>.has_root_directory() OR <path>.is_absolute())) + appends directory-separator to <path> + ENDIF() + + appends <input> omitting any root-name to <path> + +.. _APPEND_STRING: + +.. code-block:: cmake + + cmake_path(APPEND_STRING <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>]) + +Append all the ``<input>`` arguments to the ``<path-var>`` without +``directory-separator``. + +.. _REMOVE_FILENAME: + +.. code-block:: cmake + + cmake_path(REMOVE_FILENAME <path-var> [OUTPUT_VARIABLE <out-var>]) + +Removes the :ref:`filename <FILENAME_DEF>` component (as returned by +:ref:`GET ... FILENAME <GET_FILENAME>`) from ``<path-var>``. + +After this function returns, if change is done in-place, `HAS_FILENAME`_ +returns false for ``<path-var>``. + +For Example: + + .. code-block:: cmake + + set (path "/a/b") + cmake_path (REMOVE_FILENAME path) + message ("First path is \"${path}\"") + + cmake_path (REMOVE_FILENAME path) + message ("Second path is \"${result}\"") + + Will display:: + + First path is "/a/" + Second path is "/a/" + +.. _REPLACE_FILENAME: + +.. code-block:: cmake + + cmake_path(REPLACE_FILENAME <path-var> <input> [OUTPUT_VARIABLE <out-var>]) + +Replaces the :ref:`filename <FILENAME_DEF>` component from ``<path-var>`` with +``<input>``. + +If ``<path-var>`` has no filename component (`HAS_FILENAME`_ returns false), +the path is unchanged. + +Equivalent to the following: + + .. code-block:: cmake + + cmake_path(HAS_FILENAME path has_filename) + if (has_filename) + cmake_path(REMOVE_FILENAME path) + cmake_path(APPEND path "replacement"); + endif() + +.. _REMOVE_EXTENSION: + +.. code-block:: cmake + + cmake_path(REMOVE_EXTENSION <path-var> [LAST_ONLY] + [OUTPUT_VARIABLE <out-var>]) + +Removes the :ref:`extension <EXTENSION_DEF>`, if any, from ``<path-var>``. + +.. _REPLACE_EXTENSION: + +.. code-block:: cmake + + cmake_path(REPLACE_EXTENSION <path-var> [LAST_ONLY] <input> + [OUTPUT_VARIABLE <out-var>]) + +Replaces the :ref:`extension <EXTENSION_DEF>` with ``<input>``. + + 1. If ``<path-var>`` has an :ref:`extension <EXTENSION_DEF>` + (`HAS_EXTENSION`_ is true), it is removed. + 2. A ``dot`` character is appended to ``<path-var>``, if ``<input>`` is not + empty or does not begin with a ``dot`` character. + 3. ``<input>`` is appended as if `APPEND_STRING`_ was used. + + +Equivalent to the following: + + .. code-block:: cmake + + cmake_path(REMOVE_EXTENSION path) + if (NOT "input" MATCHES "^\\.") + cmake_path(APPEND_STRING path ".") + endif() + cmake_path(APPEND_STRING path "input"); + +Generation +^^^^^^^^^^ + +.. _NORMAL_PATH: + +.. code-block:: cmake + + cmake_path(NORMAL_PATH <path-var> [OUTPUT_VARIABLE <out-var>]) + +Normalize ``<path-var>``. + +A path can be normalized by following this algorithm: + + 1. If the path is empty, stop (normal form of an empty path is an empty + path). + 2. Replace each ``directory-separator`` (which may consist of multiple + separators) with a single ``/``. + 3. Replace each ``directory-separator`` character in the ``root-name`` with + ``/``. + 4. Remove each ``dot`` and any immediately following ``directory-separator``. + 5. Remove each non-dot-dot filename immediately followed by a + ``directory-separator`` and a ``dot-dot``, along with any immediately + following ``directory-separator``. + 6. If there is ``root-directory``, remove all ``dot-dots`` and any + ``directory-separators`` immediately following them. + 7. If the last filename is ``dot-dot``, remove any trailing + ``directory-separator``. + 8. If the path is empty, add a ``dot`` (normal form of ``./`` is ``.``). + +.. _cmake_path-RELATIVE_PATH: +.. _RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(RELATIVE_PATH <path-var> [BASE_DIRECTORY <input>] + [OUTPUT_VARIABLE <out-var>]) + +Returns ``<path-var>`` made relative to ``BASE_DIRECTORY`` argument. If +``BASE_DIRECTORY`` is not specified, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +For reference, the algorithm used to compute the relative path is described +`here <https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal>`_. + +.. _ABSOLUTE_PATH: + +.. code-block:: cmake + + cmake_path(ABSOLUTE_PATH <path-var> [BASE_DIRECTORY <input>] [NORMALIZE] + [OUTPUT_VARIABLE <out-var>]) + +If ``<path-var>`` is a relative path (`IS_RELATIVE`_ is true), it is evaluated +relative to the given base directory specified by ``BASE_DIRECTORY`` option. + +If ``BASE_DIRECTORY`` is not specifired, the default base directory will be +:variable:`CMAKE_CURRENT_SOURCE_DIR`. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` after the path computation. + +Because ``cmake_path`` does not access to the filesystem, symbolic links are +not resolved. To compute a real path, use :command:`file(REAL_PATH)` +command. + +Conversion +^^^^^^^^^^ + +.. _cmake_path-NATIVE_PATH: +.. _NATIVE_PATH: + +.. code-block:: cmake + + cmake_path(NATIVE_PATH <path-var> [NORMALIZE] <out-var>) + +Converts a cmake-style ``<path-var>`` into a native +path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere). + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +.. _CONVERT: +.. _cmake_path-TO_CMAKE_PATH_LIST: +.. _TO_CMAKE_PATH_LIST: + +.. code-block:: cmake + + cmake_path(CONVERT <input> TO_CMAKE_PATH_LIST <out-var> [NORMALIZE]) + +Converts a native ``<input>`` path into cmake-style path with forward-slashes +(``/``). On Windows, the long filename marker is taken into account. The input +can be a single path or a system search path like ``$ENV{PATH}``. A search +path will be converted to a cmake-style list separated by ``;`` characters. The +result of the conversion is stored in the ``<out-var>`` variable. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +.. _cmake_path-TO_NATIVE_PATH_LIST: +.. _TO_NATIVE_PATH_LIST: + +.. code-block:: cmake + + cmake_path(CONVERT <input> TO_NATIVE_PATH_LIST <out-var> [NORMALIZE]) + +Converts a cmake-style ``<input>`` path into a native path with +platform-specific slashes (``\`` on Windows and ``/`` elsewhere). The input can +be a single path or a cmake-style list. A list will be converted into a native +search path. The result of the conversion is stored in the ``<out-var>`` +variable. + +When ``NORMALIZE`` option is specified, the path is :ref:`normalized +<NORMAL_PATH>` before the conversion. + +For Example: + + .. code-block:: cmake + + set (paths "/a/b/c" "/x/y/z") + cmake_path (CONVERT "${paths}" TO_NATIVE_PATH_LIST native_paths) + message ("Native path list is \"${native_paths}\"") + + Will display, on Windows:: + + Native path list is "\a\b\c;\x\y\z" + + And on the all other systems:: + + Native path list is "/a/b/c:/x/y/z" + +Comparison +^^^^^^^^^^ + +.. _COMPARE: + +.. code-block:: cmake + + cmake_path(COMPARE <input1> EQUAL <input2> <out-var>) + cmake_path(COMPARE <input1> NOT_EQUAL <input2> <out-var>) + +Compares the lexical representations of the path and another path. + +For testing equality, the following algorithm (pseudo-code) apply: + + .. code-block:: cmake + + IF (NOT <input1>.root_name() STREQUAL <input2>.root_name()) + returns FALSE + ELSEIF (<input1>.has_root_directory() XOR <input2>.has_root_directory()) + returns FALSE + ENDIF() + + returns TRUE or FALSE if the relative portion of <input1> is + lexicographically equal or not to the relative portion of <input2>. + Comparison is performed path component-wise + +Query +^^^^^ + +.. _HAS_ROOT_NAME: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_NAME <path-var> <out-var>) + +Checks if ``<path-var>`` has ``root-name``. + +.. _HAS_ROOT_DIRECTORY: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_DIRECTORY <path-var> <out-var>) + +Checks if ``<path-var>`` has ``root-directory``. + +.. _HAS_ROOT_PATH: + +.. code-block:: cmake + + cmake_path(HAS_ROOT_PATH <path-var> <out-var>) + +Checks if ``<path-var>`` has root path. + +Effectively, checks if ``<path-var>`` has ``root-name`` and ``root-directory``. + +.. _HAS_FILENAME: + +.. code-block:: cmake + + cmake_path(HAS_FILENAME <path-var> <out-var>) + +Checks if ``<path-var>`` has a :ref:`filename <FILENAME_DEF>`. + +.. _HAS_EXTENSION: + +.. code-block:: cmake + + cmake_path(HAS_EXTENSION <path-var> <out-var>) + +Checks if ``<path-var>`` has an :ref:`extension <EXTENSION_DEF>`. If the first +character in the filename is a period, it is not treated as an extension (for +example ".profile"). + +.. _HAS_STEM: + +.. code-block:: cmake + + cmake_path(HAS_STEM <path-var> <out-var>) + +Checks if ``<path-var>`` has stem (:ref:`GET ... STEM <GET_STEM>` returns a non +empty path). + +.. _HAS_RELATIVE_PATH: + +.. code-block:: cmake + + cmake_path(HAS_RELATIVE_PATH <path-var> <out-var>) + +Checks if ``<path-var>`` has relative path (`GET_RELATIVE_PATH`_ returns a +non-empty path). + +.. _HAS_PARENT_PATH: + +.. code-block:: cmake + + cmake_path(HAS_PARENT_PATH <path-var> <out-var>) + +Checks if ``<path-var>`` has parent path. The result is true except if the path +is only composed of a :ref:`filename <FILENAME_DEF>`. + +.. _IS_ABSOLUTE: + +.. code-block:: cmake + + cmake_path(IS_ABSOLUTE <path-var> <out-var>) + +Checks if ``<path-var>`` is absolute. + +An absolute path is a path that unambiguously identifies the location of a file +without reference to an additional starting location. + +.. _IS_RELATIVE: + +.. code-block:: cmake + + cmake_path(IS_RELATIVE <path-var> <out-var>) + +Checks if path is relative (i.e. not :ref:`absolute <IS_ABSOLUTE>`). + +.. _IS_PREFIX: + +.. code-block:: cmake + + cmake_path(IS_PREFIX <path-var> <input> [NORMALIZE] <out-var>) + +Checks if ``<path-var>`` is the prefix of ``<input>``. + +When ``NORMALIZE`` option is specified, the paths are :ref:`normalized +<NORMAL_PATH>` before the check. + +Hashing +^^^^^^^ + +.. _HASH: + +.. code-block:: cmake + + cmake_path(HASH <path-var> [NORMALIZE] <out-var>) + +Compute hash value of ``<path-var>`` such that if for two paths (``p1`` and +``p2``) are equal (:ref:`COMPARE ... EQUAL <COMPARE>`) then hash value of p1 is +equal to hash value of p2. + +When ``NORMALIZE`` option is specified, the paths are :ref:`normalized +<NORMAL_PATH>` before the check. diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index 4bc7807..94060d9 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -28,6 +28,9 @@ encourage projects to set policies based on CMake versions: cmake_policy(VERSION <min>[...<max>]) +.. versionadded:: 3.12 + The optional ``<max>`` version. + ``<min>`` and the optional ``<max>`` are each CMake versions of the form ``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ``<min>`` version must be at least ``2.4`` and at most the running version of CMake. diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst index c59995a..63ea84d 100644 --- a/Help/command/configure_file.rst +++ b/Help/command/configure_file.rst @@ -6,8 +6,9 @@ Copy a file to another location and modify its contents. .. code-block:: cmake configure_file(<input> <output> + [FILE_PERMISSIONS <permissions>...] [COPYONLY] [ESCAPE_QUOTES] [@ONLY] - [NO_SOURCE_PERMISSIONS] + [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) Copies an ``<input>`` file to an ``<output>`` file and substitutes @@ -37,22 +38,24 @@ a false constant by the :command:`if` command. The "..." content on the line after the variable name, if any, is processed as above. Input file lines of the form ``#cmakedefine01 VAR`` will be replaced with either ``#define VAR 1`` or ``#define VAR 0`` similarly. -The result lines (with the exception of the ``#undef`` comments) can be -indented using spaces and/or tabs between the ``#`` character -and the ``cmakedefine`` or ``cmakedefine01`` words. This whitespace -indentation will be preserved in the output lines: -.. code-block:: c +.. versionadded:: 3.10 + The result lines (with the exception of the ``#undef`` comments) can be + indented using spaces and/or tabs between the ``#`` character + and the ``cmakedefine`` or ``cmakedefine01`` words. This whitespace + indentation will be preserved in the output lines: - # cmakedefine VAR - # cmakedefine01 VAR + .. code-block:: c -will be replaced, if ``VAR`` is defined, with + # cmakedefine VAR + # cmakedefine01 VAR -.. code-block:: c + will be replaced, if ``VAR`` is defined, with - # define VAR - # define VAR 1 + .. code-block:: c + + # define VAR + # define VAR 1 If the input file is modified the build system will re-run CMake to re-configure the file and generate the build system again. @@ -72,6 +75,9 @@ The arguments are: If the path names an existing directory the output file is placed in that directory with the same file name as the input file. +``FILE_PERMISSIONS <permissions>...`` + Use user provided permissions for the output file. + ``COPYONLY`` Copy the file without replacing any variable references or other content. This option may not be used with ``NEWLINE_STYLE``. @@ -84,10 +90,17 @@ The arguments are: This is useful for configuring scripts that use ``${VAR}`` syntax. ``NO_SOURCE_PERMISSIONS`` + .. versionadded:: 3.19 + Does not transfer the file permissions of the original file to the copy. The copied file permissions default to the standard 644 value (-rw-r--r--). +``USE_SOURCE_PERMISSIONS`` + .. versionadded:: 3.20 + + Transfer the file permissions of the original file to the output file. + ``NEWLINE_STYLE <style>`` Specify the newline style for the output file. Specify ``UNIX`` or ``LF`` for ``\n`` newlines, or specify diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 66e1844..4d6dc5a 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -50,7 +50,10 @@ The options are: for an example. ``PROJECT_NAME <project-name>`` - Ignored. This was once used but is no longer needed. + Ignored since CMake 3.0. + + .. versionchanged:: 3.14 + This value is no longer required. ``TARGET <target-name>`` Specify the name of a target to build. If not specified the @@ -68,10 +71,14 @@ The options are: Store the return value of the native build tool in the given variable. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.7 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Suppress any CTest-specific non-error output that would have been printed to the console otherwise. The summary of warnings / errors, as well as the output from the native build tool is unaffected by diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 2dea07b..95712aa 100644 --- a/Help/command/ctest_configure.rst +++ b/Help/command/ctest_configure.rst @@ -37,10 +37,14 @@ The options are: configuration tool. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.7 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Suppress any CTest-specific non-error messages that would have otherwise been printed to the console. Output from the underlying configure command is not affected. diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst index d50f634..a6c643b 100644 --- a/Help/command/ctest_coverage.rst +++ b/Help/command/ctest_coverage.rst @@ -37,10 +37,14 @@ The options are: ran without error and non-zero otherwise. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.7 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Suppress any CTest-specific non-error output that would have been printed to the console otherwise. The summary indicating how many lines of code were covered is unaffected by this option. diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst index 288b65a..f655c2e 100644 --- a/Help/command/ctest_memcheck.rst +++ b/Help/command/ctest_memcheck.rst @@ -35,4 +35,6 @@ Most options are the same as those for the :command:`ctest_test` command. The options unique to this command are: ``DEFECT_COUNT <defect-count-var>`` + .. versionadded:: 3.8 + Store in the ``<defect-count-var>`` the number of defects found. diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index f0704ac..c0f3c6d 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -29,8 +29,11 @@ The parameters are as follows: ``GROUP <group>`` If ``GROUP`` is used, the submissions will go to the specified group on the CDash server. If no ``GROUP`` is specified, the name of the model is used by - default. This replaces the deprecated option ``TRACK``. Despite the name - change its behavior is unchanged. + default. + + .. versionchanged:: 3.16 + This replaces the deprecated option ``TRACK``. Despite the name + change its behavior is unchanged. ``APPEND`` If ``APPEND`` is used, the existing ``TAG`` is used rather than creating a new @@ -56,6 +59,8 @@ The parameters are as follows: new model and group will be used. ``QUIET`` + .. versionadded:: 3.3 + If ``QUIET`` is used, CTest will suppress any non-error messages that it otherwise would have printed to the console. diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst index 983fc20..e6d277f 100644 --- a/Help/command/ctest_submit.rst +++ b/Help/command/ctest_submit.rst @@ -42,14 +42,20 @@ The options are: Each individual file must exist at the time of the call. ``SUBMIT_URL <url>`` + .. versionadded:: 3.14 + The ``http`` or ``https`` URL of the dashboard server to send the submission to. If not given, the :variable:`CTEST_SUBMIT_URL` variable is used. ``BUILD_ID <result-var>`` + .. versionadded:: 3.15 + Store in the ``<result-var>`` variable the ID assigned to this build by CDash. ``HTTPHEADER <HTTP-header>`` + .. versionadded:: 3.9 + Specify HTTP header to be included in the request to CDash during submission. For example, CDash can be configured to only accept submissions from authenticated clients. In this case, you should provide a bearer token in your @@ -73,20 +79,27 @@ The options are: non-zero on failure. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.13 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Suppress all non-error messages that would have otherwise been printed to the console. Submit to CDash Upload API ^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.2 + :: ctest_submit(CDASH_UPLOAD <file> [CDASH_UPLOAD_TYPE <type>] [SUBMIT_URL <url>] + [BUILD_ID <result-var>] [HTTPHEADER <header>] [RETRY_COUNT <count>] [RETRY_DELAY <delay>] @@ -99,6 +112,19 @@ with a content hash of the file. If CDash does not already have the file, then it is uploaded. Along with the file, a CDash type string is specified to tell CDash which handler to use to process the data. -This signature accepts the ``SUBMIT_URL``, ``BUILD_ID``, ``HTTPHEADER``, -``RETRY_COUNT``, ``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options -as described above. +This signature interprets options in the same way as the first one. + +.. versionadded:: 3.8 + Added the ``RETRY_COUNT``, ``RETRY_DELAY``, ``QUIET`` options. + +.. versionadded:: 3.9 + Added the ``HTTPHEADER`` option. + +.. versionadded:: 3.13 + Added the ``RETURN_VALUE`` option. + +.. versionadded:: 3.14 + Added the ``SUBMIT_URL`` option. + +.. versionadded:: 3.15 + Added the ``BUILD_ID`` option. diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 3589296..b4493a0 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -68,6 +68,8 @@ The options are: Tests not matching this expression are excluded. ``EXCLUDE_FIXTURE <regex>`` + .. versionadded:: 3.7 + If a test in the set of tests to be executed requires a particular fixture, that fixture's setup and cleanup tests would normally be added to the test set automatically. This option prevents adding setup or cleanup tests for @@ -76,9 +78,13 @@ The options are: setup tests that fail. ``EXCLUDE_FIXTURE_SETUP <regex>`` + .. versionadded:: 3.7 + Same as ``EXCLUDE_FIXTURE`` except only matching setup tests are excluded. ``EXCLUDE_FIXTURE_CLEANUP <regex>`` + .. versionadded:: 3.7 + Same as ``EXCLUDE_FIXTURE`` except only matching cleanup tests are excluded. ``PARALLEL_LEVEL <level>`` @@ -86,11 +92,15 @@ The options are: be run in parallel. ``RESOURCE_SPEC_FILE <file>`` + .. versionadded:: 3.16 + Specify a :ref:`resource specification file <ctest-resource-specification-file>`. See :ref:`ctest-resource-allocation` for more information. ``TEST_LOAD <threshold>`` + .. versionadded:: 3.4 + While running tests in parallel, try not to start tests when they may cause the CPU load to pass above a given threshold. If not specified the :variable:`CTEST_TEST_LOAD` variable will be checked, @@ -98,6 +108,8 @@ The options are: See also the ``TestLoad`` setting in the :ref:`CTest Test Step`. ``REPEAT <mode>:<n>`` + .. versionadded:: 3.17 + Run tests repeatedly based on the given ``<mode>`` up to ``<n>`` times. The modes are: @@ -121,6 +133,8 @@ The options are: implicit test dependencies. ``STOP_ON_FAILURE`` + .. versionadded:: 3.18 + Stop the execution of the tests once one has failed. ``STOP_TIME <time-of-day>`` @@ -131,10 +145,14 @@ The options are: Store non-zero if anything went wrong. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.7 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Suppress any CTest-specific non-error messages that would have otherwise been printed to the console. Output from the underlying test command is not affected. Summary info detailing the percentage of passing tests is also diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst index 96a11c9..63f991b 100644 --- a/Help/command/ctest_update.rst +++ b/Help/command/ctest_update.rst @@ -24,10 +24,14 @@ The options are: updated or ``-1`` on error. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.13 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. ``QUIET`` + .. versionadded:: 3.3 + Tell CTest to suppress most non-error messages that it would have otherwise printed to the console. CTest will still report the new revision of the repository and any conflicting files diff --git a/Help/command/ctest_upload.rst b/Help/command/ctest_upload.rst index 39d9de1..ffddd0a 100644 --- a/Help/command/ctest_upload.rst +++ b/Help/command/ctest_upload.rst @@ -14,9 +14,13 @@ The options are: dashboard server. ``QUIET`` + .. versionadded:: 3.3 + Suppress any CTest-specific non-error output that would have been printed to the console otherwise. ``CAPTURE_CMAKE_ERROR <result-var>`` + .. versionadded:: 3.7 + Store in the ``<result-var>`` variable -1 if there are any errors running the command and prevent ctest from returning non-zero if an error occurs. diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst index e8640ea..ce765de 100644 --- a/Help/command/enable_language.rst +++ b/Help/command/enable_language.rst @@ -12,6 +12,15 @@ variables that are created by the project command. Example languages are ``CXX``, ``C``, ``CUDA``, ``OBJC``, ``OBJCXX``, ``Fortran``, ``ISPC``, and ``ASM``. +.. versionadded:: 3.8 + Added ``CUDA`` support. + +.. versionadded:: 3.16 + Added ``OBJC`` and ``OBJCXX`` support. + +.. versionadded:: 3.18 + Added ``ISPC`` support. + If enabling ``ASM``, enable it last so that CMake can check whether compilers for other languages like ``C`` work for assembly too. diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index 268c307..82fcd46 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -62,6 +62,8 @@ Options: describing an error condition. ``RESULTS_VARIABLE <variable>`` + .. versionadded:: 3.10 + The variable will be set to contain the result of all processes as a :ref:`semicolon-separated list <CMake Language Lists>`, in order of the given ``COMMAND`` arguments. Each entry will be an integer return code @@ -75,19 +77,26 @@ Options: ``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE`` The file named will be attached to the standard input of the first process, standard output of the last process, or standard error of - all processes, respectively. If the same file is named for both - output and error then it will be used for both. + all processes, respectively. + + .. versionadded:: 3.3 + If the same file is named for both output and error then it will be used + for both. ``OUTPUT_QUIET``, ``ERROR_QUIET`` The standard output or standard error results will be quietly ignored. ``COMMAND_ECHO <where>`` + .. versionadded:: 3.15 + The command being run will be echo'ed to ``<where>`` with ``<where>`` being set to one of ``STDERR``, ``STDOUT`` or ``NONE``. See the :variable:`CMAKE_EXECUTE_PROCESS_COMMAND_ECHO` variable for a way to control the default behavior when this option is not present. ``ENCODING <name>`` + .. versionadded:: 3.8 + On Windows, the encoding that is used to decode output from the process. Ignored on other platforms. Valid encoding names are: @@ -104,11 +113,15 @@ Options: ``OEM`` Use the original equipment manufacturer (OEM) code page. ``UTF8`` or ``UTF-8`` - Use the UTF-8 codepage. Prior to CMake 3.11.0, only ``UTF8`` was accepted - for this encoding. In CMake 3.11.0, ``UTF-8`` was added for consistency with - the `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention. + Use the UTF-8 codepage. + + .. versionadded:: 3.11 + Accept ``UTF-8`` spelling for consistency with the + `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention. ``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE`` + .. versionadded:: 3.18 + The standard output or standard error will not be exclusively redirected to the configured variables. @@ -118,6 +131,8 @@ Options: This is analogous to the ``tee`` Unix command. ``COMMAND_ERROR_IS_FATAL <ANY|LAST>`` + .. versionadded:: 3.19 + The option following ``COMMAND_ERROR_IS_FATAL`` determines the behavior when an error is encountered: diff --git a/Help/command/export.rst b/Help/command/export.rst index 2ca7056..e8a1fa7 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -64,16 +64,23 @@ build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. -By default the ``export(PACKAGE)`` command does nothing (see policy -:policy:`CMP0090`) because populating the user package registry has effects -outside the source and build trees. Set the -:variable:`CMAKE_EXPORT_PACKAGE_REGISTRY` variable to add build directories to -the CMake user package registry. +.. versionchanged:: 3.1 + If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable + is enabled, the ``export(PACKAGE)`` command will do nothing. + +.. versionchanged:: 3.15 + By default the ``export(PACKAGE)`` command does nothing (see policy + :policy:`CMP0090`) because populating the user package registry has effects + outside the source and build trees. Set the + :variable:`CMAKE_EXPORT_PACKAGE_REGISTRY` variable to add build directories + to the CMake user package registry. .. code-block:: cmake export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>]) +.. versionadded:: 3.7 + This signature exports cmake built targets to the android ndk build system by creating an Android.mk file that references the prebuilt targets. The Android NDK supports the use of prebuilt libraries, both static and shared. diff --git a/Help/command/file.rst b/Help/command/file.rst index e963be0..6837672 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -3,6 +3,21 @@ file File manipulation command. +This command is dedicated to file and path manipulation requiring access to the +filesystem. + +For other path manipulation, handling only syntactic aspects, have a look at +:command:`cmake_path` command. + +.. note:: + + The sub-commands `RELATIVE_PATH`_, `TO_CMAKE_PATH`_ and `TO_NATIVE_PATH`_ has + been superseded, respectively, by sub-commands + :ref:`RELATIVE_PATH <cmake_path-RELATIVE_PATH>`, + :ref:`CONVERT ... TO_CMAKE_PATH_LIST <cmake_path-TO_CMAKE_PATH_LIST>` and + :ref:`CONVERT ... TO_NATIVE_PATH_LIST <cmake_path-TO_NATIVE_PATH_LIST>` of + :command:`cmake_path` command. + Synopsis ^^^^^^^^ @@ -103,10 +118,15 @@ Parse a list of ASCII strings from ``<filename>`` and store it in Consider only strings that match the given regular expression. ``ENCODING <encoding-type>`` + .. versionadded:: 3.1 + Consider strings of a given encoding. Currently supported encodings are: - UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. If the ENCODING option - is not provided and the file has a Byte Order Mark, the ENCODING option - will be defaulted to respect the Byte Order Mark. + ``UTF-8``, ``UTF-16LE``, ``UTF-16BE``, ``UTF-32LE``, ``UTF-32BE``. + If the ``ENCODING`` option is not provided and the file has a Byte Order Mark, + the ``ENCODING`` option will be defaulted to respect the Byte Order Mark. + + .. versionadded:: 3.2 + Added the ``UTF-16LE``, ``UTF-16BE``, ``UTF-32LE``, ``UTF-32BE`` encodings. For example, the code @@ -160,6 +180,8 @@ the ``<format>`` and ``UTC`` options. [POST_EXCLUDE_REGEXES [<regexes>...]] ) +.. versionadded:: 3.16 + Recursively get the list of libraries depended on by the given files. Please note that this sub-command is not intended to be used in project mode. @@ -408,6 +430,9 @@ dependency resolution: If this variable is not specified, it is determined by the value of ``CMAKE_OBJDUMP`` if set, else by system introspection. + .. versionadded:: 3.18 + Use ``CMAKE_OBJDUMP`` if set. + Writing ^^^^^^^ @@ -436,6 +461,8 @@ to update the file only when its content changes. file(TOUCH [<files>...]) file(TOUCH_NOCREATE [<files>...]) +.. versionadded:: 3.12 + Create a file with no content if it does not yet exist. If the file already exists, its access and/or modification will be updated to the time when the function call is executed. @@ -469,8 +496,10 @@ from the input content to produce the output content. The options are: ``INPUT <input-file>`` Use the content from a given file as input. - A relative path is treated with respect to the value of - :variable:`CMAKE_CURRENT_SOURCE_DIR`. See policy :policy:`CMP0070`. + + .. versionchanged:: 3.10 + A relative path is treated with respect to the value of + :variable:`CMAKE_CURRENT_SOURCE_DIR`. See policy :policy:`CMP0070`. ``OUTPUT <output-file>`` Specify the output file name to generate. Use generator expressions @@ -478,11 +507,15 @@ from the input content to produce the output content. The options are: name. Multiple configurations may generate the same output file only if the generated content is identical. Otherwise, the ``<output-file>`` must evaluate to an unique name for each configuration. - A relative path (after evaluating generator expressions) is treated - with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. - See policy :policy:`CMP0070`. + + .. versionchanged:: 3.10 + A relative path (after evaluating generator expressions) is treated + with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. + See policy :policy:`CMP0070`. ``TARGET <target>`` + .. versionadded:: 3.19 + Specify which target to use when evaluating generator expressions that require a target for evaluation (e.g. ``$<COMPILE_FEATURES:...>``, ``$<TARGET_PROPERTY:prop>``). @@ -506,6 +539,8 @@ of a project's ``CMakeLists.txt`` files. [ESCAPE_QUOTES] [@ONLY] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) +.. versionadded:: 3.18 + Generate an output file using the input given by ``CONTENT`` and substitute variable values referenced as ``@VAR@`` or ``${VAR}`` contained therein. The substitution rules behave the same as the :command:`configure_file` command. @@ -554,20 +589,25 @@ Generate a list of files that match the ``<globbing-expressions>`` and store it into the ``<variable>``. Globbing expressions are similar to regular expressions, but much simpler. If ``RELATIVE`` flag is specified, the results will be returned as relative paths to the given -path. The results will be ordered lexicographically. +path. + +.. versionchanged:: 3.6 + The results will be ordered lexicographically. On Windows and macOS, globbing is case-insensitive even if the underlying filesystem is case-sensitive (both filenames and globbing expressions are converted to lowercase before matching). On other platforms, globbing is case-sensitive. -If the ``CONFIGURE_DEPENDS`` flag is specified, CMake will add logic -to the main build system check target to rerun the flagged ``GLOB`` commands -at build time. If any of the outputs change, CMake will regenerate the build -system. +.. versionadded:: 3.3 + By default ``GLOB`` lists directories - directories are omitted in result if + ``LIST_DIRECTORIES`` is set to false. -By default ``GLOB`` lists directories - directories are omitted in result if -``LIST_DIRECTORIES`` is set to false. +.. versionadded:: 3.12 + If the ``CONFIGURE_DEPENDS`` flag is specified, CMake will add logic + to the main build system check target to rerun the flagged ``GLOB`` commands + at build time. If any of the outputs change, CMake will regenerate the build + system. .. note:: We do not recommend using GLOB to collect a list of source files from @@ -590,10 +630,11 @@ matched directory and match the files. Subdirectories that are symlinks are only traversed if ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to ``NEW``. -By default ``GLOB_RECURSE`` omits directories from result list - setting -``LIST_DIRECTORIES`` to true adds directories to result list. -If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to -``NEW`` then ``LIST_DIRECTORIES`` treats symlinks as directories. +.. versionadded:: 3.3 + By default ``GLOB_RECURSE`` omits directories from result list - setting + ``LIST_DIRECTORIES`` to true adds directories to result list. + If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to + ``NEW`` then ``LIST_DIRECTORIES`` treats symlinks as directories. Examples of recursive globbing include:: @@ -619,7 +660,12 @@ Move a file or directory within a filesystem from ``<oldname>`` to Remove the given files. The ``REMOVE_RECURSE`` mode will remove the given files and directories, also non-empty directories. No error is emitted if a given file does not exist. Relative input paths are evaluated with respect -to the current source directory. Empty input paths are ignored with a warning. +to the current source directory. + +.. versionchanged:: 3.15 + Empty input paths are ignored with a warning. Previous versions of CMake + interpreted empty string as a relative path with respect to the current + directory and removed its contents. .. _MAKE_DIRECTORY: @@ -652,17 +698,18 @@ at the destination with the same timestamp. Copying preserves input permissions unless explicit permissions or ``NO_SOURCE_PERMISSIONS`` are given (default is ``USE_SOURCE_PERMISSIONS``). -If ``FOLLOW_SYMLINK_CHAIN`` is specified, ``COPY`` will recursively resolve -the symlinks at the paths given until a real file is found, and install -a corresponding symlink in the destination for each symlink encountered. For -each symlink that is installed, the resolution is stripped of the directory, -leaving only the filename, meaning that the new symlink points to a file in -the same directory as the symlink. This feature is useful on some Unix systems, -where libraries are installed as a chain of symlinks with version numbers, with -less specific versions pointing to more specific versions. -``FOLLOW_SYMLINK_CHAIN`` will install all of these symlinks and the library -itself into the destination directory. For example, if you have the following -directory structure: +.. versionadded:: 3.15 + If ``FOLLOW_SYMLINK_CHAIN`` is specified, ``COPY`` will recursively resolve + the symlinks at the paths given until a real file is found, and install + a corresponding symlink in the destination for each symlink encountered. For + each symlink that is installed, the resolution is stripped of the directory, + leaving only the filename, meaning that the new symlink points to a file in + the same directory as the symlink. This feature is useful on some Unix systems, + where libraries are installed as a chain of symlinks with version numbers, with + less specific versions pointing to more specific versions. + ``FOLLOW_SYMLINK_CHAIN`` will install all of these symlinks and the library + itself into the destination directory. For example, if you have the following + directory structure: * ``/opt/foo/lib/libfoo.so.1.2.3`` * ``/opt/foo/lib/libfoo.so.1.2 -> libfoo.so.1.2.3`` @@ -696,6 +743,8 @@ use this signature (with some undocumented options for internal use). file(SIZE <filename> <variable>) +.. versionadded:: 3.14 + Determine the file size of the ``<filename>`` and put the result in ``<variable>`` variable. Requires that ``<filename>`` is a valid path pointing to a file and is readable. @@ -706,6 +755,8 @@ pointing to a file and is readable. file(READ_SYMLINK <linkname> <variable>) +.. versionadded:: 3.14 + This subcommand queries the symlink ``<linkname>`` and stores the path it points to in the result ``<variable>``. If ``<linkname>`` does not exist or is not a symlink, CMake issues a fatal error. @@ -730,6 +781,8 @@ absolute path is obtained: file(CREATE_LINK <original> <linkname> [RESULT <result>] [COPY_ON_ERROR] [SYMBOLIC]) +.. versionadded:: 3.14 + Create a link ``<linkname>`` that points to ``<original>``. It will be a hard link by default, but providing the ``SYMBOLIC`` option results in a symbolic link instead. Hard links require that ``original`` @@ -754,6 +807,8 @@ which would make them unable to support a hard link. [FILE_PERMISSIONS <permissions>...] [DIRECTORY_PERMISSIONS <permissions>...]) +.. versionadded:: 3.19 + Set the permissions for the ``<files>...`` and ``<directories>...`` specified. Valid permissions are ``OWNER_READ``, ``OWNER_WRITE``, ``OWNER_EXECUTE``, ``GROUP_READ``, ``GROUP_WRITE``, ``GROUP_EXECUTE``, ``WORLD_READ``, @@ -790,6 +845,8 @@ Valid combination of keywords are: [FILE_PERMISSIONS <permissions>...] [DIRECTORY_PERMISSIONS <permissions>...]) +.. versionadded:: 3.19 + Same as `CHMOD`_, but change the permissions of files and directories present in the ``<directories>...`` recursively. @@ -802,6 +859,8 @@ Path Conversion file(REAL_PATH <path> <out-var> [BASE_DIRECTORY <dir>]) +.. versionadded:: 3.19 + Compute the absolute path to an existing file or directory with symlinks resolved. @@ -849,10 +908,12 @@ Transfer file(UPLOAD <file> <url> [<options>...]) The ``DOWNLOAD`` subcommand downloads the given ``<url>`` to a local ``<file>``. -If ``<file>`` is not specified for ``file(DOWNLOAD)``, the file is not saved. -This can be useful if you want to know if a file can be downloaded (for example, -to check that it exists) without actually saving it anywhere. The ``UPLOAD`` -mode uploads a local ``<file>`` to a given ``<url>``. +The ``UPLOAD`` mode uploads a local ``<file>`` to a given ``<url>``. + +.. versionadded:: 3.19 + If ``<file>`` is not specified for ``file(DOWNLOAD)``, the file is not saved. + This can be useful if you want to know if a file can be downloaded (for example, + to check that it exists) without actually saving it anywhere. Options to both ``DOWNLOAD`` and ``UPLOAD`` are: @@ -877,12 +938,18 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are: Terminate the operation after a given total time has elapsed. ``USERPWD <username>:<password>`` + .. versionadded:: 3.7 + Set username and password for operation. ``HTTPHEADER <HTTP-header>`` + .. versionadded:: 3.7 + HTTP header for operation. Suboption can be repeated several times. ``NETRC <level>`` + .. versionadded:: 3.11 + Specify whether the .netrc file is to be used for operation. If this option is not specified, the value of the ``CMAKE_NETRC`` variable will be used instead. @@ -899,6 +966,8 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are: The .netrc file is required, and information in the URL is ignored. ``NETRC_FILE <file>`` + .. versionadded:: 3.11 + Specify an alternative .netrc file to the one in your home directory, if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will @@ -911,9 +980,15 @@ If neither ``NETRC`` option is given CMake will check variables Specify whether to verify the server certificate for ``https://`` URLs. The default is to *not* verify. + .. versionadded:: 3.18 + Added support to ``file(UPLOAD)``. + ``TLS_CAINFO <file>`` Specify a custom Certificate Authority file for ``https://`` URLs. + .. versionadded:: 3.18 + Added support to ``file(UPLOAD)``. + For ``https://`` URLs CMake must be built with OpenSSL support. ``TLS/SSL`` certificates are not checked by default. Set ``TLS_VERIFY`` to ``ON`` to check certificates. If neither ``TLS`` option is given CMake will check @@ -944,6 +1019,8 @@ Locking [RESULT_VARIABLE <variable>] [TIMEOUT <seconds>]) +.. versionadded:: 3.2 + Lock a file specified by ``<path>`` if no ``DIRECTORY`` option present and file ``<path>/cmake.lock`` otherwise. File will be locked for scope defined by ``GUARD`` option (default value is ``PROCESS``). ``RELEASE`` option can be used @@ -979,6 +1056,8 @@ Archiving [MTIME <mtime>] [VERBOSE]) +.. versionadded:: 3.18 + Creates the specified ``<archive>`` file with the files and directories listed in ``<paths>``. Note that ``<paths>`` must list actual files or directories, wildcards are not supported. @@ -993,9 +1072,10 @@ compression. The other formats use no compression by default, but can be directed to do so with the ``COMPRESSION`` option. Valid values for ``<compression>`` are ``None``, ``BZip2``, ``GZip``, ``XZ``, and ``Zstd``. -The compression level can be specified with the ``COMPRESSION_LEVEL`` option. -The ``<compression-level>`` should be between 0-9, with the default being 0. -The ``COMPRESSION`` option must be present when ``COMPRESSION_LEVEL`` is given. +.. versionadded:: 3.19 + The compression level can be specified with the ``COMPRESSION_LEVEL`` option. + The ``<compression-level>`` should be between 0-9, with the default being 0. + The ``COMPRESSION`` option must be present when ``COMPRESSION_LEVEL`` is given. .. note:: With ``FORMAT`` set to ``raw`` only one file will be compressed with the @@ -1016,6 +1096,8 @@ the ``MTIME`` option. [LIST_ONLY] [VERBOSE]) +.. versionadded:: 3.18 + Extracts or lists the content of the specified ``<archive>``. The directory where the content of the archive will be extracted to can diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 1be2e09..3dfd62f 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -351,15 +351,16 @@ The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are enabled. -1. Search paths specified in the :variable:`<PackageName>_ROOT` CMake - variable and the :envvar:`<PackageName>_ROOT` environment variable, - where ``<PackageName>`` is the package to be found. - The package root variables are maintained as a stack so if - called from within a find module, root paths from the parent's find - module will also be searched after paths for the current package. - This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting - the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``. - See policy :policy:`CMP0074`. +1. .. versionadded:: 3.12 + Search paths specified in the :variable:`<PackageName>_ROOT` CMake + variable and the :envvar:`<PackageName>_ROOT` environment variable, + where ``<PackageName>`` is the package to be found. + The package root variables are maintained as a stack so if + called from within a find module, root paths from the parent's find + module will also be searched after paths for the current package. + This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting + the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``. + See policy :policy:`CMP0074`. 2. Search paths specified in cmake-specific cache variables. These are intended to be used on the command line with a ``-DVAR=value``. @@ -430,6 +431,10 @@ enabled. 9. Search paths specified by the ``PATHS`` option. These are typically hard-coded guesses. +.. versionadded:: 3.16 + Added the ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable + various search locations. + .. |FIND_XXX| replace:: find_package .. |FIND_ARGS_XXX| replace:: <PackageName> .. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace:: diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst index a01a104..8de6deb 100644 --- a/Help/command/foreach.rst +++ b/Help/command/foreach.rst @@ -88,6 +88,8 @@ yields foreach(<loop_var>... IN ZIP_LISTS <lists>) +.. versionadded:: 3.17 + In this variant, ``<lists>`` is a whitespace or semicolon separated list of list-valued variables. The ``foreach`` command iterates over each list simultaneously setting the diff --git a/Help/command/function.rst b/Help/command/function.rst index 7a9b907..3d25aa4 100644 --- a/Help/command/function.rst +++ b/Help/command/function.rst @@ -50,8 +50,9 @@ and so on. However, it is strongly recommended to stay with the case chosen in the function definition. Typically functions use all-lowercase names. -The :command:`cmake_language(CALL ...)` command can also be used to -invoke the function. +.. versionadded:: 3.18 + The :command:`cmake_language(CALL ...)` command can also be used to + invoke the function. Arguments ^^^^^^^^^ diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst index 39015cc..0ccbfb0 100644 --- a/Help/command/get_directory_property.rst +++ b/Help/command/get_directory_property.rst @@ -11,12 +11,14 @@ Stores a property of directory scope in the named ``<variable>``. The ``DIRECTORY`` argument specifies another directory from which to retrieve the property value instead of the current directory. -It may reference either a source directory, or since CMake 3.19, -a binary directory. Relative paths are treated as relative to the +Relative paths are treated as relative to the current source directory. CMake must already know about the directory, either by having added it through a call to :command:`add_subdirectory` or being the top level directory. +.. versionadded:: 3.19 + ``<dir>`` may reference a binary directory. + If the property is not defined for the nominated directory scope, an empty string is returned. In the case of ``INHERITED`` properties, if the property is not found for the nominated directory scope, diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst index ea2dedb..be9d00a 100644 --- a/Help/command/get_filename_component.rst +++ b/Help/command/get_filename_component.rst @@ -3,6 +3,11 @@ get_filename_component Get a specific component of a full filename. +.. versionchanged:: 3.19 + This command been superseded by :command:`cmake_path` command, except + ``REALPATH`` now offered by :ref:`file(REAL_PATH) <REAL_PATH>` command and + ``PROGRAM`` now available in :command:`separate_arguments(PROGRAM)` command. + .. code-block:: cmake get_filename_component(<var> <FileName> <mode> [CACHE]) @@ -19,6 +24,9 @@ Sets ``<var>`` to a component of ``<FileName>``, where ``<mode>`` is one of: NAME_WLE = File name with neither the directory nor the last extension PATH = Legacy alias for DIRECTORY (use for CMake <= 2.8.11) +.. versionadded:: 3.14 + Added the ``LAST_EXT`` and ``NAME_WLE`` modes. + Paths are returned with forward slashes and have no trailing slashes. If the optional ``CACHE`` argument is specified, the result variable is added to the cache. @@ -27,6 +35,8 @@ added to the cache. get_filename_component(<var> <FileName> <mode> [BASE_DIR <dir>] [CACHE]) +.. versionadded:: 3.4 + Sets ``<var>`` to the absolute path of ``<FileName>``, where ``<mode>`` is one of: @@ -53,9 +63,3 @@ left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then any command-line arguments present in the ``<FileName>`` string are split from the program name and stored in ``<arg_var>``. This is used to separate a program name from its arguments in a command line string. - -.. note:: - - The ``REALPATH`` and ``PROGRAM`` subcommands had been superseded, - respectively, by :ref:`file(REAL_PATH) <REAL_PATH>` and - :command:`separate_arguments(PROGRAM)` commands. diff --git a/Help/command/get_property.rst b/Help/command/get_property.rst index 870c934..f77d8af 100644 --- a/Help/command/get_property.rst +++ b/Help/command/get_property.rst @@ -30,35 +30,43 @@ It must be one of the following: ``DIRECTORY`` Scope defaults to the current directory but another directory (already processed by CMake) may be named by the - full or relative path ``<dir>``. The ``<dir>`` may reference either a - source directory, or since CMake 3.19, a binary directory. + full or relative path ``<dir>``. Relative paths are treated as relative to the current source directory. See also the :command:`get_directory_property` command. + .. versionadded:: 3.19 + ``<dir>`` may reference a binary directory. + ``TARGET`` Scope must name one existing target. See also the :command:`get_target_property` command. ``SOURCE`` Scope must name one source file. By default, the source file's property - will be read from the current source directory's scope, but this can be - overridden with one of the following sub-options: + will be read from the current source directory's scope. + + .. versionadded:: 3.18 + Directory scope can be overridden with one of the following sub-options: + + ``DIRECTORY <dir>`` + The source file property will be read from the ``<dir>`` directory's + scope. CMake must already know about + the directory, either by having added it through a call + to :command:`add_subdirectory` or ``<dir>`` being the top level directory. + Relative paths are treated as relative to the current source directory. - ``DIRECTORY <dir>`` - The source file property will be read from the ``<dir>`` directory's - scope. The ``<dir>`` may reference either a source directory, or - since CMake 3.19, a binary directory. CMake must already know about - the directory, either by having added it through a call - to :command:`add_subdirectory` or ``<dir>`` being the top level directory. - Relative paths are treated as relative to the current source directory. + .. versionadded:: 3.19 + ``<dir>`` may reference a binary directory. - ``TARGET_DIRECTORY <target>`` - The source file property will be read from the directory scope in which - ``<target>`` was created (``<target>`` must therefore already exist). + ``TARGET_DIRECTORY <target>`` + The source file property will be read from the directory scope in which + ``<target>`` was created (``<target>`` must therefore already exist). See also the :command:`get_source_file_property` command. ``INSTALL`` + .. versionadded:: 3.1 + Scope must name one installed file path. ``TEST`` @@ -86,3 +94,8 @@ If ``BRIEF_DOCS`` or ``FULL_DOCS`` is given then the variable is set to a string containing documentation for the requested property. If documentation is requested for a property that has not been defined ``NOTFOUND`` is returned. + +.. note:: + + The :prop_sf:`GENERATED` source file property may be globally visible. + See its documentation for details. diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst index 76ed776..ae41565 100644 --- a/Help/command/get_source_file_property.rst +++ b/Help/command/get_source_file_property.rst @@ -19,22 +19,29 @@ command and if still unable to find the property, ``variable`` will be set to an empty string. By default, the source file's property will be read from the current source -directory's scope, but this can be overridden with one of the following -sub-options: +directory's scope. -``DIRECTORY <dir>`` - The source file property will be read from the ``<dir>`` directory's - scope. CMake must already know about that source directory, either by - having added it through a call to :command:`add_subdirectory` or ``<dir>`` - being the top level source directory. Relative paths are treated as - relative to the current source directory. +.. versionadded:: 3.18 + Directory scope can be overridden with one of the following sub-options: -``TARGET_DIRECTORY <target>`` - The source file property will be read from the directory scope in which - ``<target>`` was created (``<target>`` must therefore already exist). + ``DIRECTORY <dir>`` + The source file property will be read from the ``<dir>`` directory's + scope. CMake must already know about that source directory, either by + having added it through a call to :command:`add_subdirectory` or ``<dir>`` + being the top level source directory. Relative paths are treated as + relative to the current source directory. + + ``TARGET_DIRECTORY <target>`` + The source file property will be read from the directory scope in which + ``<target>`` was created (``<target>`` must therefore already exist). Use :command:`set_source_files_properties` to set property values. Source file properties usually control how the file is built. One property that is always there is :prop_sf:`LOCATION`. See also the more general :command:`get_property` command. + +.. note:: + + The :prop_sf:`GENERATED` source file property may be globally visible. + See its documentation for details. diff --git a/Help/command/if.rst b/Help/command/if.rst index be992df..72d328d 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -85,8 +85,9 @@ Possible conditions are: (in any directory). ``if(TEST test-name)`` - True if the given name is an existing test name created by the - :command:`add_test` command. + .. versionadded:: 3.3 + True if the given name is an existing test name created by the + :command:`add_test` command. ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined @@ -116,7 +117,9 @@ Possible conditions are: ``if(<variable|string> MATCHES regex)`` True if the given string or variable's value matches the given regular condition. See :ref:`Regex Specification` for regex format. - ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. + + .. versionadded:: 3.9 + ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. ``if(<variable|string> LESS <variable|string>)`` True if the given string or variable's value is a valid number and less @@ -131,12 +134,14 @@ Possible conditions are: to that on the right. ``if(<variable|string> LESS_EQUAL <variable|string>)`` - True if the given string or variable's value is a valid number and less - than or equal to that on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is a valid number and less + than or equal to that on the right. ``if(<variable|string> GREATER_EQUAL <variable|string>)`` - True if the given string or variable's value is a valid number and greater - than or equal to that on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is a valid number and greater + than or equal to that on the right. ``if(<variable|string> STRLESS <variable|string>)`` True if the given string or variable's value is lexicographically less @@ -151,12 +156,14 @@ Possible conditions are: to the string or variable on the right. ``if(<variable|string> STRLESS_EQUAL <variable|string>)`` - True if the given string or variable's value is lexicographically less - than or equal to the string or variable on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is lexicographically less + than or equal to the string or variable on the right. ``if(<variable|string> STRGREATER_EQUAL <variable|string>)`` - True if the given string or variable's value is lexicographically greater - than or equal to the string or variable on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is lexicographically greater + than or equal to the string or variable on the right. ``if(<variable|string> VERSION_LESS <variable|string>)`` Component-wise integer version number comparison (version format is @@ -177,25 +184,31 @@ Possible conditions are: component effectively truncates the string at that point. ``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + .. versionadded:: 3.7 + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. ``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + .. versionadded:: 3.7 + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. ``if(<variable|string> IN_LIST <variable>)`` - True if the given element is contained in the named list variable. + .. versionadded:: 3.3 + True if the given element is contained in the named list variable. ``if(DEFINED <name>|CACHE{<name>}|ENV{<name>})`` True if a variable, cache variable or environment variable with given ``<name>`` is defined. The value of the variable does not matter. Note that macro arguments are not variables. + .. versionadded:: 3.14 + Added support for ``CACHE{<name>}`` variables. + ``if((condition) AND (condition OR (condition)))`` The conditions inside the parenthesis are evaluated first and then the remaining condition is evaluated as in the previous examples. @@ -268,11 +281,12 @@ above-documented condition syntax accepts ``<variable|string>``: tested to see if they are boolean constants, if so they are used as such, otherwise they are assumed to be variables and are dereferenced. -To prevent ambiguity, potential variable or keyword names can be -specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`. -A quoted or bracketed variable or keyword will be interpreted as a -string and not dereferenced or interpreted. -See policy :policy:`CMP0054`. +.. versionchanged:: 3.1 + To prevent ambiguity, potential variable or keyword names can be + specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`. + A quoted or bracketed variable or keyword will be interpreted as a + string and not dereferenced or interpreted. + See policy :policy:`CMP0054`. There is no automatic evaluation for environment or cache :ref:`Variable References`. Their values must be referenced as diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst index 540a13a..4354654 100644 --- a/Help/command/include_external_msproject.rst +++ b/Help/command/include_external_msproject.rst @@ -21,6 +21,7 @@ specify the type of project, id (``GUID``) of the project and the name of the target platform. This is useful for projects requiring values other than the default (e.g. WIX projects). -If the imported project has different configuration names than the -current project, set the :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` -target property to specify the mapping. +.. versionadded:: 3.9 + If the imported project has different configuration names than the + current project, set the :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` + target property to specify the mapping. diff --git a/Help/command/install.rst b/Help/command/install.rst index c11eaf4..bd8da39 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -20,10 +20,13 @@ Introduction This command generates installation rules for a project. Install rules specified by calls to the ``install()`` command within a source directory -are executed in order during installation. Install rules in subdirectories -added by calls to the :command:`add_subdirectory` command are interleaved -with those in the parent directory to run in the order declared (see -policy :policy:`CMP0082`). +are executed in order during installation. + +.. versionchanged:: 3.14 + Install rules in subdirectories + added by calls to the :command:`add_subdirectory` command are interleaved + with those in the parent directory to run in the order declared (see + policy :policy:`CMP0082`). There are multiple signatures for this command. Some of them define installation options for files and targets. Options common to @@ -85,6 +88,8 @@ signatures that specify them. The common options are: :variable:`CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` variable. ``EXCLUDE_FROM_ALL`` + .. versionadded:: 3.6 + Specify that the file is excluded from a full installation and only installed as part of a component-specific installation @@ -97,16 +102,18 @@ signatures that specify them. The common options are: Specify that it is not an error if the file to be installed does not exist. -Command signatures that install files may print messages during -installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable -to control which messages are printed. +.. versionadded:: 3.1 + Command signatures that install files may print messages during + installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable + to control which messages are printed. -Many of the ``install()`` variants implicitly create the directories -containing the installed files. If -:variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` is set, these -directories will be created with the permissions specified. Otherwise, -they will be created according to the uname rules on Unix-like platforms. -Windows platforms are unaffected. +.. versionadded:: 3.11 + Many of the ``install()`` variants implicitly create the directories + containing the installed files. If + :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` is set, these + directories will be created with the permissions specified. Otherwise, + they will be created according to the uname rules on Unix-like platforms. + Windows platforms are unaffected. Installing Targets ^^^^^^^^^^^^^^^^^^ @@ -162,6 +169,8 @@ that may be installed: accompanying import libraries are of kind ``ARCHIVE``). ``OBJECTS`` + .. versionadded:: 3.9 + Object files associated with *object libraries*. ``FRAMEWORK`` @@ -246,6 +255,8 @@ In addition to the common options listed above, each target can accept the following additional arguments: ``NAMELINK_COMPONENT`` + .. versionadded:: 3.12 + On some platforms a versioned shared library has a symbolic link such as:: @@ -357,17 +368,19 @@ targets that link to the object libraries in their implementation. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. -`install(TARGETS)`_ can install targets that were created in -other directories. When using such cross-directory install rules, running -``make install`` (or similar) from a subdirectory will not guarantee that -targets from other directories are up-to-date. You can use -:command:`target_link_libraries` or :command:`add_dependencies` -to ensure that such out-of-directory targets are built before the -subdirectory-specific install rules are run. +.. versionadded:: 3.3 + An install destination given as a ``DESTINATION`` argument may + use "generator expressions" with the syntax ``$<...>``. See the + :manual:`cmake-generator-expressions(7)` manual for available expressions. -An install destination given as a ``DESTINATION`` argument may -use "generator expressions" with the syntax ``$<...>``. See the -:manual:`cmake-generator-expressions(7)` manual for available expressions. +.. versionadded:: 3.13 + `install(TARGETS)`_ can install targets that were created in + other directories. When using such cross-directory install rules, running + ``make install`` (or similar) from a subdirectory will not guarantee that + targets from other directories are up-to-date. You can use + :command:`target_link_libraries` or :command:`add_dependencies` + to ensure that such out-of-directory targets are built before the + subdirectory-specific install rules are run. Installing Files ^^^^^^^^^^^^^^^^ @@ -455,9 +468,10 @@ this advice while installing headers to a project-specific subdirectory: DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/myproj ) -An install destination given as a ``DESTINATION`` argument may -use "generator expressions" with the syntax ``$<...>``. See the -:manual:`cmake-generator-expressions(7)` manual for available expressions. +.. versionadded:: 3.4 + An install destination given as a ``DESTINATION`` argument may + use "generator expressions" with the syntax ``$<...>``. See the + :manual:`cmake-generator-expressions(7)` manual for available expressions. Installing Directories ^^^^^^^^^^^^^^^^^^^^^^ @@ -495,7 +509,8 @@ permissions specified in the ``FILES`` form of the command, and the directories will be given the default permissions specified in the ``PROGRAMS`` form of the command. -The ``MESSAGE_NEVER`` option disables file installation status output. +.. versionadded:: 3.1 + The ``MESSAGE_NEVER`` option disables file installation status output. Installation of directories may be controlled with fine granularity using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a @@ -579,10 +594,14 @@ path that begins with the appropriate :module:`GNUInstallDirs` variable. This allows package maintainers to control the install destination by setting the appropriate cache variables. -The list of ``dirs...`` given to ``DIRECTORY`` and an install destination -given as a ``DESTINATION`` argument may use "generator expressions" -with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` -manual for available expressions. +.. versionadded:: 3.4 + An install destination given as a ``DESTINATION`` argument may + use "generator expressions" with the syntax ``$<...>``. See the + :manual:`cmake-generator-expressions(7)` manual for available expressions. + +.. versionadded:: 3.5 + The list of ``dirs...`` given to ``DIRECTORY`` may use + "generator expressions" too. Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -610,10 +629,11 @@ example, the code will print a message during installation. -``<file>`` or ``<code>`` may use "generator expressions" with the syntax -``$<...>`` (in the case of ``<file>``, this refers to their use in the file -name, not the file's contents). See the -:manual:`cmake-generator-expressions(7)` manual for available expressions. +.. versionadded:: 3.14 + ``<file>`` or ``<code>`` may use "generator expressions" with the syntax + ``$<...>`` (in the case of ``<file>``, this refers to their use in the file + name, not the file's contents). See the + :manual:`cmake-generator-expressions(7)` manual for available expressions. Installing Exports ^^^^^^^^^^^^^^^^^^ @@ -673,13 +693,14 @@ RPM, typically handle this by listing the ``Runtime`` component as a dependency of the ``Development`` component in the package metadata, ensuring that the library is always installed if the headers and CMake export file are present. -In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode maybe -used to specify an export to the android ndk build system. This mode -accepts the same options as the normal export mode. The Android -NDK supports the use of prebuilt libraries, both static and shared. This -allows cmake to build the libraries of a project and make them available -to an ndk build system complete with transitive dependencies, include flags -and defines required to use the libraries. +.. versionadded:: 3.7 + In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode maybe + used to specify an export to the android ndk build system. This mode + accepts the same options as the normal export mode. The Android + NDK supports the use of prebuilt libraries, both static and shared. This + allows cmake to build the libraries of a project and make them available + to an ndk build system complete with transitive dependencies, include flags + and defines required to use the libraries. The ``EXPORT`` form is useful to help outside projects use targets built and installed by the current project. For example, the code diff --git a/Help/command/link_directories.rst b/Help/command/link_directories.rst index 9cb8faa..6732402 100644 --- a/Help/command/link_directories.rst +++ b/Help/command/link_directories.rst @@ -11,21 +11,25 @@ Adds the paths in which the linker should search for libraries. Relative paths given to this command are interpreted as relative to the current source directory, see :policy:`CMP0015`. -The directories are added to the :prop_dir:`LINK_DIRECTORIES` directory -property for the current ``CMakeLists.txt`` file, converting relative -paths to absolute as needed. The command will apply only to targets created after it is called. -By default the directories specified are appended onto the current list of -directories. This default behavior can be changed by setting -:variable:`CMAKE_LINK_DIRECTORIES_BEFORE` to ``ON``. By using -``AFTER`` or ``BEFORE`` explicitly, you can select between appending and -prepending, independent of the default. - -Arguments to ``link_directories`` may use "generator expressions" with -the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)` -manual for available expressions. See the :manual:`cmake-buildsystem(7)` -manual for more on defining buildsystem properties. +.. versionadded:: 3.13 + The directories are added to the :prop_dir:`LINK_DIRECTORIES` directory + property for the current ``CMakeLists.txt`` file, converting relative + paths to absolute as needed. See the :manual:`cmake-buildsystem(7)` + manual for more on defining buildsystem properties. + +.. versionadded:: 3.13 + By default the directories specified are appended onto the current list of + directories. This default behavior can be changed by setting + :variable:`CMAKE_LINK_DIRECTORIES_BEFORE` to ``ON``. By using + ``AFTER`` or ``BEFORE`` explicitly, you can select between appending and + prepending, independent of the default. + +.. versionadded:: 3.13 + Arguments to ``link_directories`` may use "generator expressions" with + the syntax "$<...>". See the :manual:`cmake-generator-expressions(7)` + manual for available expressions. .. note:: diff --git a/Help/command/list.rst b/Help/command/list.rst index 4d339a0..7accc5a 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -88,6 +88,8 @@ Returns the list of elements specified by indices from the list. list(JOIN <list> <glue> <output variable>) +.. versionadded:: 3.12 + Returns a string joining all list's elements using the glue string. To join multiple strings, which are not part of a list, use ``JOIN`` operator from :command:`string` command. @@ -98,6 +100,8 @@ from :command:`string` command. list(SUBLIST <list> <begin> <length> <output variable>) +.. versionadded:: 3.12 + Returns a sublist of the given list. If ``<length>`` is 0, an empty list will be returned. If ``<length>`` is -1 or the list is smaller than ``<begin>+<length>`` then @@ -132,6 +136,8 @@ Appends elements to the list. list(FILTER <list> <INCLUDE|EXCLUDE> REGEX <regular_expression>) +.. versionadded:: 3.6 + Includes or removes items from the list that match the mode's pattern. In ``REGEX`` mode, items will be matched against the given regular expression. @@ -152,6 +158,8 @@ Inserts elements to the list to the specified location. list(POP_BACK <list> [<out-var>...]) +.. versionadded:: 3.15 + If no variable name is given, removes exactly one element. Otherwise, assign the last element's value to the given variable and removes it, up to the last variable name given. @@ -162,6 +170,8 @@ up to the last variable name given. list(POP_FRONT <list> [<out-var>...]) +.. versionadded:: 3.15 + If no variable name is given, removes exactly one element. Otherwise, assign the first element's value to the given variable and removes it, up to the last variable name given. @@ -172,6 +182,8 @@ up to the last variable name given. list(PREPEND <list> [<element> ...]) +.. versionadded:: 3.15 + Insert elements to the 0th position in the list. .. _REMOVE_ITEM: @@ -206,6 +218,8 @@ but if duplicates are encountered, only the first instance is preserved. list(TRANSFORM <list> <ACTION> [<SELECTOR>] [OUTPUT_VARIABLE <output variable>]) +.. versionadded:: 3.12 + Transforms the list by applying an action to all or, by specifying a ``<SELECTOR>``, to the selected elements of the list, storing the result in-place or in the specified output variable. @@ -302,6 +316,13 @@ Reverses the contents of the list in-place. list(SORT <list> [COMPARE <compare>] [CASE <case>] [ORDER <order>]) Sorts the list in-place alphabetically. + +.. versionadded:: 3.13 + Added the ``COMPARE``, ``CASE``, and ``ORDER`` options. + +.. versionadded:: 3.18 + Added the ``COMPARE NATURAL`` option. + Use the ``COMPARE`` keyword to select the comparison method for sorting. The ``<compare>`` option should be one of: diff --git a/Help/command/macro.rst b/Help/command/macro.rst index 797a90d..5fe4c00 100644 --- a/Help/command/macro.rst +++ b/Help/command/macro.rst @@ -48,8 +48,9 @@ and so on. However, it is strongly recommended to stay with the case chosen in the macro definition. Typically macros use all-lowercase names. -The :command:`cmake_language(CALL ...)` command can also be used to -invoke the macro. +.. versionadded:: 3.18 + The :command:`cmake_language(CALL ...)` command can also be used to + invoke the macro. Arguments ^^^^^^^^^ diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index e52e623..201363f 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -23,8 +23,6 @@ new values will be marked as advanced, but if a variable already has an advanced/non-advanced state, it will not be changed. -.. note:: - - Policy :policy:`CMP0102` affects the behavior of the ``mark_as_advanced`` - call. When set to ``NEW``, variables passed to this command which are not - already in the cache are ignored. See policy :policy:`CMP0102`. +.. versionchanged:: 3.17 + Variables passed to this command which are not already in the cache + are ignored. See policy :policy:`CMP0102`. diff --git a/Help/command/math.rst b/Help/command/math.rst index ddb1ec6..8386aab 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -17,17 +17,18 @@ Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``, ``^``, ``~``, ``<<``, ``>>``, and ``(...)``; they have the same meaning as in C code. -Hexadecimal numbers are recognized when prefixed with ``0x``, as in C code. - -The result is formatted according to the option ``OUTPUT_FORMAT``, -where ``<format>`` is one of - -``HEXADECIMAL`` - Hexadecimal notation as in C code, i. e. starting with "0x". -``DECIMAL`` - Decimal notation. Which is also used if no ``OUTPUT_FORMAT`` option - is specified. - +.. versionadded:: 3.13 + Hexadecimal numbers are recognized when prefixed with ``0x``, as in C code. + +.. versionadded:: 3.13 + The result is formatted according to the option ``OUTPUT_FORMAT``, + where ``<format>`` is one of + + ``HEXADECIMAL`` + Hexadecimal notation as in C code, i. e. starting with "0x". + ``DECIMAL`` + Decimal notation. Which is also used if no ``OUTPUT_FORMAT`` option + is specified. For example diff --git a/Help/command/message.rst b/Help/command/message.rst index 6bc0e4c..e44803e 100644 --- a/Help/command/message.rst +++ b/Help/command/message.rst @@ -71,6 +71,9 @@ influences the way the message is handled: using this log level would normally only be temporary and would expect to be removed before releasing the project, packaging up the files, etc. +.. versionadded:: 3.15 + Added the ``NOTICE``, ``VERBOSE``, ``DEBUG``, and ``TRACE`` levels. + The CMake command-line tool displays ``STATUS`` to ``TRACE`` messages on stdout with the message preceded by two hyphens and a space. All other message types are sent to stderr and are not prefixed with hyphens. The @@ -79,25 +82,29 @@ The :manual:`curses interface <ccmake(1)>` shows ``STATUS`` to ``TRACE`` messages one at a time on a status line and other messages in an interactive pop-up box. The ``--log-level`` command-line option to each of these tools can be used to control which messages will be shown. -To make a log level persist between CMake runs, the -:variable:`CMAKE_MESSAGE_LOG_LEVEL` variable can be set instead. -Note that the command line option takes precedence over the cache variable. - -Messages of log levels ``NOTICE`` and below will have each line preceded -by the content of the :variable:`CMAKE_MESSAGE_INDENT` variable (converted to -a single string by concatenating its list items). For ``STATUS`` to ``TRACE`` -messages, this indenting content will be inserted after the hyphens. - -Messages of log levels ``NOTICE`` and below can also have each line preceded -with context of the form ``[some.context.example]``. The content between the -square brackets is obtained by converting the :variable:`CMAKE_MESSAGE_CONTEXT` -list variable to a dot-separated string. The message context will always -appear before any indenting content but after any automatically added leading -hyphens. By default, message context is not shown, it has to be explicitly -enabled by giving the :manual:`cmake <cmake(1)>` ``--log-context`` -command-line option or by setting the :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` -variable to true. See the :variable:`CMAKE_MESSAGE_CONTEXT` documentation for -usage examples. + +.. versionadded:: 3.17 + To make a log level persist between CMake runs, the + :variable:`CMAKE_MESSAGE_LOG_LEVEL` variable can be set instead. + Note that the command line option takes precedence over the cache variable. + +.. versionadded:: 3.16 + Messages of log levels ``NOTICE`` and below will have each line preceded + by the content of the :variable:`CMAKE_MESSAGE_INDENT` variable (converted to + a single string by concatenating its list items). For ``STATUS`` to ``TRACE`` + messages, this indenting content will be inserted after the hyphens. + +.. versionadded:: 3.17 + Messages of log levels ``NOTICE`` and below can also have each line preceded + with context of the form ``[some.context.example]``. The content between the + square brackets is obtained by converting the :variable:`CMAKE_MESSAGE_CONTEXT` + list variable to a dot-separated string. The message context will always + appear before any indenting content but after any automatically added leading + hyphens. By default, message context is not shown, it has to be explicitly + enabled by giving the :manual:`cmake <cmake(1)>` ``--log-context`` + command-line option or by setting the :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` + variable to true. See the :variable:`CMAKE_MESSAGE_CONTEXT` documentation for + usage examples. CMake Warning and Error message text displays using a simple markup language. Non-indented text is formatted in line-wrapped paragraphs @@ -107,6 +114,8 @@ delimited by newlines. Indented text is considered pre-formatted. Reporting checks ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.17 + A common pattern in CMake output is a message indicating the start of some sort of check, followed by another message reporting the result of that check. For example: diff --git a/Help/command/project.rst b/Help/command/project.rst index c325050..6c931b6 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -55,10 +55,14 @@ The options are: * :variable:`PROJECT_VERSION_TWEAK`, :variable:`<PROJECT-NAME>_VERSION_TWEAK`. - When the ``project()`` command is called from the top-level ``CMakeLists.txt``, - then the version is also stored in the variable :variable:`CMAKE_PROJECT_VERSION`. + .. versionadded:: 3.12 + When the ``project()`` command is called from the top-level + ``CMakeLists.txt``, then the version is also stored in the variable + :variable:`CMAKE_PROJECT_VERSION`. ``DESCRIPTION <project-description-string>`` + .. versionadded:: 3.9 + Optional. Sets the variables @@ -71,7 +75,12 @@ The options are: When the ``project()`` command is called from the top-level ``CMakeLists.txt``, then the description is also stored in the variable :variable:`CMAKE_PROJECT_DESCRIPTION`. + .. versionadded:: 3.12 + Added the ``<PROJECT-NAME>_DESCRIPTION`` variable. + ``HOMEPAGE_URL <url-string>`` + .. versionadded:: 3.12 + Optional. Sets the variables @@ -93,6 +102,15 @@ The options are: Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages, to skip enabling any languages. + .. versionadded:: 3.8 + Added ``CUDA`` support. + + .. versionadded:: 3.16 + Added ``OBJC`` and ``OBJCXX`` support. + + .. versionadded:: 3.18 + Added ``ISPC`` support. + If enabling ``ASM``, list it last so that CMake can check whether compilers for other languages like ``C`` work for assembly too. @@ -115,6 +133,13 @@ they point to will be included as the last step of the ``project()`` command. If both are set, then :variable:`CMAKE_PROJECT_INCLUDE` will be included before :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`. +.. versionadded:: 3.15 + Added the ``CMAKE_PROJECT_INCLUDE`` and ``CMAKE_PROJECT_INCLUDE_BEFORE`` + variables. + +.. versionadded:: 3.17 + Added the ``CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`` variable. + Usage ^^^^^ diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index 69fb726..f66af35 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -32,10 +32,14 @@ be one of the following keywords: MSDN article `Parsing C Command-Line Arguments`_ for details. ``NATIVE_COMMAND`` + .. versionadded:: 3.9 + Proceeds as in ``WINDOWS_COMMAND`` mode if the host system is Windows. Otherwise proceeds as in ``UNIX_COMMAND`` mode. ``PROGRAM`` + .. versionadded:: 3.19 + The first item in ``<args>`` is assumed to be an executable and will be searched in the system search path or left as a full path. If not found, ``<variable>`` will be empty. Otherwise, ``<variable>`` is a list of 2 diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index b5c1613..bf437b4 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -28,11 +28,12 @@ It must be one of the following: ``DIRECTORY`` Scope defaults to the current directory but other directories (already processed by CMake) may be named by full or relative path. - Each path may reference either a source directory, or since CMake 3.19, - a binary directory. Relative paths are treated as relative to the current source directory. See also the :command:`set_directory_properties` command. + .. versionadded:: 3.19 + ``<dir>`` may reference a binary directory. + ``TARGET`` Scope may name zero or more existing targets. See also the :command:`set_target_properties` command. @@ -40,25 +41,31 @@ It must be one of the following: ``SOURCE`` Scope may name zero or more source files. By default, source file properties are only visible to targets added in the same directory (``CMakeLists.txt``). - Visibility can be set in other directory scopes using one or both of the - following sub-options: - - ``DIRECTORY <dirs>...`` - The source file property will be set in each of the ``<dirs>`` - directories' scopes. Each path may reference either a source directory, - or since CMake 3.19, a binary directory. CMake must already know about - each of these directories, either by having added them through a call to - :command:`add_subdirectory` or it being the top level source directory. - Relative paths are treated as relative to the current source directory. - - ``TARGET_DIRECTORY <targets>...`` - The source file property will be set in each of the directory scopes - where any of the specified ``<targets>`` were created (the ``<targets>`` - must therefore already exist). + + .. versionadded:: 3.18 + Visibility can be set in other directory scopes using one or both of the + following sub-options: + + ``DIRECTORY <dirs>...`` + The source file property will be set in each of the ``<dirs>`` + directories' scopes. CMake must already know about + each of these directories, either by having added them through a call to + :command:`add_subdirectory` or it being the top level source directory. + Relative paths are treated as relative to the current source directory. + + .. versionadded:: 3.19 + ``<dirs>`` may reference a binary directory. + + ``TARGET_DIRECTORY <targets>...`` + The source file property will be set in each of the directory scopes + where any of the specified ``<targets>`` were created (the ``<targets>`` + must therefore already exist). See also the :command:`set_source_files_properties` command. ``INSTALL`` + .. versionadded:: 3.1 + Scope may name zero or more installed file paths. These are made available to CPack to influence deployment. @@ -98,3 +105,8 @@ directly set in the nominated scope, the command will behave as though See the :manual:`cmake-properties(7)` manual for a list of properties in each scope. + +.. note:: + + The :prop_sf:`GENERATED` source file property may be globally visible. + See its documentation for details. diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst index 9558b40..61c69a2 100644 --- a/Help/command/set_source_files_properties.rst +++ b/Help/command/set_source_files_properties.rst @@ -14,9 +14,10 @@ Source files can have properties that affect how they are built. Sets properties associated with source files using a key/value paired list. -By default, source file properties are only visible to targets added in the -same directory (``CMakeLists.txt``). Visibility can be set in other directory -scopes using one or both of the following options: +.. versionadded:: 3.18 + By default, source file properties are only visible to targets added in the + same directory (``CMakeLists.txt``). Visibility can be set in other directory + scopes using one or both of the following options: ``DIRECTORY <dirs>...`` The source file properties will be set in each of the ``<dirs>`` @@ -35,3 +36,8 @@ See also the :command:`set_property(SOURCE)` command. See :ref:`Source File Properties` for the list of properties known to CMake. + +.. note:: + + The :prop_sf:`GENERATED` source file property may be globally visible. + See its documentation for details. diff --git a/Help/command/site_name.rst b/Help/command/site_name.rst index 1bcaead..09b5a9f 100644 --- a/Help/command/site_name.rst +++ b/Help/command/site_name.rst @@ -6,3 +6,7 @@ Set the given variable to the name of the computer. .. code-block:: cmake site_name(variable) + +On UNIX-like platforms, if the variable ``HOSTNAME`` is set, its value +will be executed as a command expected to print out the host name, +much like the ``hostname`` command-line tool. diff --git a/Help/command/source_group.rst b/Help/command/source_group.rst index 5ae9e51..5db1ec8 100644 --- a/Help/command/source_group.rst +++ b/Help/command/source_group.rst @@ -14,12 +14,16 @@ This is intended to set up file tabs in Visual Studio. The options are: ``TREE`` + .. versionadded:: 3.8 + CMake will automatically detect, from ``<src>`` files paths, source groups it needs to create, to keep structure of source groups analogically to the actual files and directories structure in the project. Paths of ``<src>`` files will be cut to be relative to ``<root>``. ``PREFIX`` + .. versionadded:: 3.8 + Source group and files located directly in ``<root>`` path, will be placed in ``<prefix>`` source groups. @@ -47,6 +51,9 @@ appropriately: source_group(outer\\inner ...) source_group(TREE <root> PREFIX sources\\inc ...) +.. versionadded:: 3.18 + Allow using forward slashes (``/``) to specify subgroups. + For backwards compatibility, the short-hand signature .. code-block:: cmake diff --git a/Help/command/string.rst b/Help/command/string.rst index 51f8d82..8ad0089 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -170,10 +170,12 @@ The following characters have special meaning in regular expressions: Matches a pattern on either side of the ``|`` ``()`` Saves a matched subexpression, which can be referenced - in the ``REGEX REPLACE`` operation. Additionally it is saved - by all regular expression-related commands, including - e.g. :command:`if(MATCHES)`, in the variables - :variable:`CMAKE_MATCH_<n>` for ``<n>`` 0..9. + in the ``REGEX REPLACE`` operation. + + .. versionadded:: 3.9 + All regular expression-related commands, including e.g. + :command:`if(MATCHES)`, save subgroup matches in the variables + :variable:`CMAKE_MATCH_<n>` for ``<n>`` 0..9. ``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|`` has lower precedence than concatenation. This means that the regular @@ -205,6 +207,8 @@ Manipulation string(APPEND <string_variable> [<input>...]) +.. versionadded:: 3.4 + Append all the ``<input>`` arguments to the string. .. _PREPEND: @@ -213,6 +217,8 @@ Append all the ``<input>`` arguments to the string. string(PREPEND <string_variable> [<input>...]) +.. versionadded:: 3.10 + Prepend all the ``<input>`` arguments to the string. .. _CONCAT: @@ -230,6 +236,8 @@ the result in the named ``<output_variable>``. string(JOIN <glue> <output_variable> [<input>...]) +.. versionadded:: 3.12 + Join all the ``<input>`` arguments together using the ``<glue>`` string and store the result in the named ``<output_variable>``. @@ -271,16 +279,15 @@ result stored in ``<output_variable>`` will *not* be the number of characters. Store in an ``<output_variable>`` a substring of a given ``<string>``. If ``<length>`` is ``-1`` the remainder of the string starting at ``<begin>`` -will be returned. If ``<string>`` is shorter than ``<length>`` then the -end of the string is used instead. +will be returned. + +.. versionchanged:: 3.2 + If ``<string>`` is shorter than ``<length>`` then the end of the string + is used instead. Previous versions of CMake reported an error in this case. Both ``<begin>`` and ``<length>`` are counted in bytes, so care must be exercised if ``<string>`` could contain multi-byte characters. -.. note:: - CMake 3.1 and below reported an error if ``<length>`` pointed past - the end of ``<string>``. - .. _STRIP: .. code-block:: cmake @@ -296,6 +303,8 @@ leading and trailing spaces removed. string(GENEX_STRIP <string> <output_variable>) +.. versionadded:: 3.1 + Strip any :manual:`generator expressions <cmake-generator-expressions(7)>` from the input ``<string>`` and store the result in the ``<output_variable>``. @@ -305,6 +314,8 @@ from the input ``<string>`` and store the result in the ``<output_variable>``. string(REPEAT <string> <count> <output_variable>) +.. versionadded:: 3.15 + Produce the output string as the input ``<string>`` repeated ``<count>`` times. Comparison @@ -323,6 +334,9 @@ Comparison Compare the strings and store true or false in the ``<output_variable>``. +.. versionadded:: 3.7 + Added the ``LESS_EQUAL`` and ``GREATER_EQUAL`` options. + .. _`Supported Hash Algorithms`: Hashing @@ -358,6 +372,9 @@ The supported ``<HASH>`` algorithm names are: ``SHA3_512`` Keccak SHA-3. +.. versionadded:: 3.8 + Added the ``SHA3_*`` hash algorithms. + Generation ^^^^^^^^^^ @@ -375,6 +392,8 @@ Convert all numbers into corresponding ASCII characters. string(HEX <string> <output_variable>) +.. versionadded:: 3.18 + Convert each byte in the input ``<string>`` to its hexadecimal representation and store the concatenated hex digits in the ``<output_variable>``. Letters in the output (``a`` through ``f``) are in lowercase. @@ -451,6 +470,18 @@ specifiers: %y The last two digits of the current year (00-99) %Y The current year. +.. versionadded:: 3.6 + ``%s`` format specifier (UNIX time). + +.. versionadded:: 3.7 + ``%a`` and ``%b`` format specifiers (abbreviated month and weekday names). + +.. versionadded:: 3.8 + ``%%`` specifier (literal ``%``). + +.. versionadded:: 3.7 + ``%A`` and ``%B`` format specifiers (full month and weekday names). + Unknown format specifiers will be ignored and copied to the output as-is. @@ -461,8 +492,7 @@ If no explicit ``<format_string>`` is given, it will default to: %Y-%m-%dT%H:%M:%S for local time. %Y-%m-%dT%H:%M:%SZ for UTC. -.. note:: - +.. versionadded:: 3.8 If the ``SOURCE_DATE_EPOCH`` environment variable is set, its value will be used instead of the current time. See https://reproducible-builds.org/specs/source-date-epoch/ for details. @@ -474,6 +504,8 @@ If no explicit ``<format_string>`` is given, it will default to: string(UUID <output_variable> NAMESPACE <namespace> NAME <name> TYPE <MD5|SHA1> [UPPER]) +.. versionadded:: 3.1 + Create a universally unique identifier (aka GUID) as per RFC4122 based on the hash of the combined values of ``<namespace>`` (which itself has to be a valid UUID) and ``<name>``. @@ -489,6 +521,8 @@ with the optional ``UPPER`` flag. JSON ^^^^ +.. versionadded:: 3.19 + Functionality for querying a JSON string. .. note:: diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 9e9c690..3fb113a 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -19,10 +19,12 @@ specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_DEFINITIONS` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property of ``<target>``. -(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) The following arguments specify compile definitions. Repeated calls for the same ``<target>`` append items in the order called. +.. versionadded:: 3.11 + Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`. + Arguments to ``target_compile_definitions`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` @@ -37,3 +39,12 @@ For example, the following are all equivalent: target_compile_definitions(foo PUBLIC -DFOO) # -D removed target_compile_definitions(foo PUBLIC "" FOO) # "" ignored target_compile_definitions(foo PUBLIC -D FOO) # -D becomes "", then ignored + +Definitions may optionally have values: + +.. code-block:: cmake + + target_compile_definitions(foo PUBLIC FOO=1) + +Note that many compilers treat ``-DFOO`` as equivalent to ``-DFOO=1``, but +other tools may not recognize this in all circumstances (e.g. IntelliSense). diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst index b50be34..58502bf 100644 --- a/Help/command/target_compile_features.rst +++ b/Help/command/target_compile_features.rst @@ -21,9 +21,11 @@ specify the scope of the features. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_FEATURES` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_COMPILE_FEATURES` property of ``<target>``. -(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) Repeated calls for the same ``<target>`` append items. +.. versionadded:: 3.11 + Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`. + The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an :ref:`ALIAS target <Alias Targets>`. diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 3c733c5..e45b209 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -26,10 +26,12 @@ specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_OPTIONS` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_COMPILE_OPTIONS` property of ``<target>``. -(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) The following arguments specify compile options. Repeated calls for the same ``<target>`` append items in the order called. +.. versionadded:: 3.11 + Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`. + Arguments to ``target_compile_options`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst index 660e15c..a8a5c83 100644 --- a/Help/command/target_include_directories.rst +++ b/Help/command/target_include_directories.rst @@ -22,9 +22,11 @@ the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`INCLUDE_DIRECTORIES` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` property of ``<target>``. -(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) The following arguments specify include directories. +.. versionadded:: 3.11 + Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`. + Specified include directories may be absolute paths or relative paths. Repeated calls for the same <target> append items in the order called. If ``SYSTEM`` is specified, the compiler will be told the diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index c2e7e8a..872e264 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -27,6 +27,10 @@ set to ``NEW`` then the target must have been created in the current directory. Repeated calls for the same ``<target>`` append items in the order called. +.. versionadded:: 3.13 + The ``<target>`` doesn't have to be defined in the same directory as the + ``target_link_libraries`` call. + Each ``<item>`` may be: * **A library target name**: The generated link line will have the @@ -62,10 +66,11 @@ Each ``<item>`` may be: :ref:`usage requirement <Target Usage Requirements>`. This has the same effect as passing the framework directory as an include directory. - On :ref:`Visual Studio Generators` for VS 2010 and above, library files - ending in ``.targets`` will be treated as MSBuild targets files and - imported into generated project files. This is not supported by other - generators. + .. versionadded:: 3.8 + On :ref:`Visual Studio Generators` for VS 2010 and above, library files + ending in ``.targets`` will be treated as MSBuild targets files and + imported into generated project files. This is not supported by other + generators. The full path to the library file will be quoted/escaped for the shell automatically. @@ -89,6 +94,11 @@ Each ``<item>`` may be: flags explicitly. The flags will then be placed at the toolchain-defined flag position in the link command. + .. versionadded:: 3.13 + :prop_tgt:`LINK_OPTIONS` target property and :command:`target_link_options` + command. For earlier versions of CMake, use :prop_tgt:`LINK_FLAGS` + property instead. + The link flag is treated as a command-line string fragment and will be used with no extra quoting or escaping. @@ -216,6 +226,8 @@ is not ``NEW``, they are also appended to the Linking Object Libraries ^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + :ref:`Object Libraries` may be used as the ``<target>`` (first) argument of ``target_link_libraries`` to specify dependencies of their sources on other libraries. For example, the code diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst index e59e0e1..87dff39 100644 --- a/Help/command/target_link_options.rst +++ b/Help/command/target_link_options.rst @@ -36,10 +36,12 @@ specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`LINK_OPTIONS` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_LINK_OPTIONS` property of ``<target>``. -(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) The following arguments specify link options. Repeated calls for the same ``<target>`` append items in the order called. +.. note:: + :ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items. + Arguments to ``target_link_options`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 653b8d7..520614a 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -12,27 +12,37 @@ Add sources to a target. [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) Specifies sources to use when building a target and/or its dependents. -Relative source file paths are interpreted as being relative to the current -source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The -named ``<target>`` must have been created by a command such as -:command:`add_executable` or :command:`add_library` and must not be an +The named ``<target>`` must have been created by a command such as +:command:`add_executable` or :command:`add_library` or +:command:`add_custom_target` and must not be an :ref:`ALIAS target <Alias Targets>`. +.. versionchanged:: 3.13 + Relative source file paths are interpreted as being relative to the current + source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). + See policy :policy:`CMP0076`. + +.. versionadded:: 3.20 + ``<target>`` can be a custom target. + The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the items following them. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`SOURCES` property of ``<target>``, which are used when building the target itself. ``PUBLIC`` and ``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_SOURCES` property of ``<target>``, which are used -when building dependents. (:ref:`IMPORTED targets <Imported Targets>` -only support ``INTERFACE`` items because they are not build targets.) +when building dependents. The following arguments specify sources. Repeated calls for the same -``<target>`` append items in the order called. +``<target>`` append items in the order called. The targets created by +:command:`add_custom_target` can only have ``PRIVATE`` scope. + +.. versionadded:: 3.3 + Allow exporting targets with :prop_tgt:`INTERFACE_SOURCES`. + +.. versionadded:: 3.11 + Allow setting ``INTERFACE`` items on :ref:`IMPORTED targets <Imported Targets>`. Arguments to ``target_sources`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. - -See also the :policy:`CMP0076` policy for older behavior related to the -handling of relative source file paths. diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 323077a..06da910 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -19,6 +19,10 @@ Try Compiling Whole Projects Try building a project. The success or failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``. +.. versionadded:: 3.14 + The name of the ``<resultVar>`` is defined by the user. Previously, it had + a fixed name ``RESULT_VAR``. + In this form, ``<srcdir>`` should contain a complete CMake project with a ``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>`` will not be deleted after this command is run. Specify ``<targetName>`` to @@ -47,6 +51,10 @@ Try building an executable or static library from one or more source files variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``. +.. versionadded:: 3.14 + The name of the ``<resultVar>`` is defined by the user. Previously, it had + a fixed name ``RESULT_VAR``. + In this form, one or more source files must be provided. If :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` is unset or is set to ``EXECUTABLE``, the sources must include a definition for ``main`` and CMake will create a @@ -94,6 +102,8 @@ The options are: given to the ``CMAKE_FLAGS`` option will be ignored. ``LINK_OPTIONS <options>...`` + .. versionadded:: 3.14 + Specify link step options to pass to :command:`target_link_options` or to set the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated project, depending on the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable. @@ -102,17 +112,23 @@ The options are: Store the output from the build process in the given variable. ``<LANG>_STANDARD <std>`` + .. versionadded:: 3.8 + Specify the :prop_tgt:`C_STANDARD`, :prop_tgt:`CXX_STANDARD`, :prop_tgt:`OBJC_STANDARD`, :prop_tgt:`OBJCXX_STANDARD`, or :prop_tgt:`CUDA_STANDARD` target property of the generated project. ``<LANG>_STANDARD_REQUIRED <bool>`` + .. versionadded:: 3.8 + Specify the :prop_tgt:`C_STANDARD_REQUIRED`, :prop_tgt:`CXX_STANDARD_REQUIRED`, :prop_tgt:`OBJC_STANDARD_REQUIRED`, :prop_tgt:`OBJCXX_STANDARD_REQUIRED`,or :prop_tgt:`CUDA_STANDARD_REQUIRED` target property of the generated project. ``<LANG>_EXTENSIONS <bool>`` + .. versionadded:: 3.8 + Specify the :prop_tgt:`C_EXTENSIONS`, :prop_tgt:`CXX_EXTENSIONS`, :prop_tgt:`OBJC_EXTENSIONS`, :prop_tgt:`OBJCXX_EXTENSIONS`, or :prop_tgt:`CUDA_EXTENSIONS` target property of the generated project. @@ -131,24 +147,26 @@ the try_compile call of interest, and then re-run cmake again with Other Behavior Settings ^^^^^^^^^^^^^^^^^^^^^^^ -If set, the following variables are passed in to the generated -try_compile CMakeLists.txt to initialize compile target properties with -default values: +.. versionadded:: 3.4 + If set, the following variables are passed in to the generated + try_compile CMakeLists.txt to initialize compile target properties with + default values: -* :variable:`CMAKE_CUDA_RUNTIME_LIBRARY` -* :variable:`CMAKE_ENABLE_EXPORTS` -* :variable:`CMAKE_LINK_SEARCH_START_STATIC` -* :variable:`CMAKE_LINK_SEARCH_END_STATIC` -* :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` -* :variable:`CMAKE_POSITION_INDEPENDENT_CODE` + * :variable:`CMAKE_CUDA_RUNTIME_LIBRARY` + * :variable:`CMAKE_ENABLE_EXPORTS` + * :variable:`CMAKE_LINK_SEARCH_START_STATIC` + * :variable:`CMAKE_LINK_SEARCH_END_STATIC` + * :variable:`CMAKE_MSVC_RUNTIME_LIBRARY` + * :variable:`CMAKE_POSITION_INDEPENDENT_CODE` -If :policy:`CMP0056` is set to ``NEW``, then -:variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well. + If :policy:`CMP0056` is set to ``NEW``, then + :variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well. -If :policy:`CMP0083` is set to ``NEW``, then in order to obtain correct -behavior at link time, the ``check_pie_supported()`` command from the -:module:`CheckPIESupported` module must be called before using the -:command:`try_compile` command. +.. versionchanged:: 3.14 + If :policy:`CMP0083` is set to ``NEW``, then in order to obtain correct + behavior at link time, the ``check_pie_supported()`` command from the + :module:`CheckPIESupported` module must be called before using the + :command:`try_compile` command. The current settings of :policy:`CMP0065` and :policy:`CMP0083` are propagated through to the generated test project. @@ -156,37 +174,41 @@ through to the generated test project. Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose a build configuration. -Set the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to specify -the type of target used for the source file signature. - -Set the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify -variables that must be propagated into the test project. This variable is -meant for use only in toolchain files and is only honored by the -``try_compile()`` command for the source files form, not when given a whole -project. - -If :policy:`CMP0067` is set to ``NEW``, or any of the ``<LANG>_STANDARD``, -``<LANG>_STANDARD_REQUIRED``, or ``<LANG>_EXTENSIONS`` options are used, -then the language standard variables are honored: - -* :variable:`CMAKE_C_STANDARD` -* :variable:`CMAKE_C_STANDARD_REQUIRED` -* :variable:`CMAKE_C_EXTENSIONS` -* :variable:`CMAKE_CXX_STANDARD` -* :variable:`CMAKE_CXX_STANDARD_REQUIRED` -* :variable:`CMAKE_CXX_EXTENSIONS` -* :variable:`CMAKE_OBJC_STANDARD` -* :variable:`CMAKE_OBJC_STANDARD_REQUIRED` -* :variable:`CMAKE_OBJC_EXTENSIONS` -* :variable:`CMAKE_OBJCXX_STANDARD` -* :variable:`CMAKE_OBJCXX_STANDARD_REQUIRED` -* :variable:`CMAKE_OBJCXX_EXTENSIONS` -* :variable:`CMAKE_CUDA_STANDARD` -* :variable:`CMAKE_CUDA_STANDARD_REQUIRED` -* :variable:`CMAKE_CUDA_EXTENSIONS` - -Their values are used to set the corresponding target properties in -the generated project (unless overridden by an explicit option). - -For the :generator:`Green Hills MULTI` generator the GHS toolset and target -system customization cache variables are also propagated into the test project. +.. versionadded:: 3.6 + Set the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to specify + the type of target used for the source file signature. + +.. versionadded:: 3.6 + Set the :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable to specify + variables that must be propagated into the test project. This variable is + meant for use only in toolchain files and is only honored by the + ``try_compile()`` command for the source files form, not when given a whole + project. + +.. versionchanged:: 3.8 + If :policy:`CMP0067` is set to ``NEW``, or any of the ``<LANG>_STANDARD``, + ``<LANG>_STANDARD_REQUIRED``, or ``<LANG>_EXTENSIONS`` options are used, + then the language standard variables are honored: + + * :variable:`CMAKE_C_STANDARD` + * :variable:`CMAKE_C_STANDARD_REQUIRED` + * :variable:`CMAKE_C_EXTENSIONS` + * :variable:`CMAKE_CXX_STANDARD` + * :variable:`CMAKE_CXX_STANDARD_REQUIRED` + * :variable:`CMAKE_CXX_EXTENSIONS` + * :variable:`CMAKE_OBJC_STANDARD` + * :variable:`CMAKE_OBJC_STANDARD_REQUIRED` + * :variable:`CMAKE_OBJC_EXTENSIONS` + * :variable:`CMAKE_OBJCXX_STANDARD` + * :variable:`CMAKE_OBJCXX_STANDARD_REQUIRED` + * :variable:`CMAKE_OBJCXX_EXTENSIONS` + * :variable:`CMAKE_CUDA_STANDARD` + * :variable:`CMAKE_CUDA_STANDARD_REQUIRED` + * :variable:`CMAKE_CUDA_EXTENSIONS` + + Their values are used to set the corresponding target properties in + the generated project (unless overridden by an explicit option). + +.. versionchanged:: 3.14 + For the :generator:`Green Hills MULTI` generator the GHS toolset and target + system customization cache variables are also propagated into the test project. diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index d401ebe..272c8bd 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -29,6 +29,11 @@ executable was built, but failed to run, then ``<runResultVar>`` will be set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for information on how the test project is constructed to build the source file. +.. versionadded:: 3.14 + The names of the result variables ``<runResultVar>`` and + ``<compileResultVar>`` are defined by the user. Previously, they had + fixed names ``RUN_RESULT_VAR`` and ``COMPILE_RESULT_VAR``. + The options are: ``CMAKE_FLAGS <flags>...`` @@ -46,6 +51,8 @@ The options are: Report the compile step build output in a given variable. ``LINK_LIBRARIES <libs>...`` + .. versionadded:: 3.2 + Specify libraries to be linked in the generated project. The list of libraries may refer to system libraries and to :ref:`Imported Targets <Imported Targets>` from the calling project. @@ -54,6 +61,8 @@ The options are: given to the ``CMAKE_FLAGS`` option will be ignored. ``LINK_OPTIONS <options>...`` + .. versionadded:: 3.14 + Specify link step options to pass to :command:`target_link_options` in the generated project. @@ -74,6 +83,10 @@ a build configuration. Behavior when Cross Compiling ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.3 + Use ``CMAKE_CROSSCOMPILING_EMULATOR`` when running cross-compiled + binaries. + When cross compiling, the executable compiled in the first step usually cannot be run on the build host. The ``try_run`` command checks the :variable:`CMAKE_CROSSCOMPILING` variable to detect whether CMake is in diff --git a/Help/cpack_gen/archive.rst b/Help/cpack_gen/archive.rst index 3656aa2..98b24ea 100644 --- a/Help/cpack_gen/archive.rst +++ b/Help/cpack_gen/archive.rst @@ -12,6 +12,12 @@ any of the following formats: - TZST (.tar.zst) - ZIP (.zip) +.. versionadded:: 3.1 + ``7Z`` and ``TXZ`` formats support. + +.. versionadded:: 3.16 + ``TZST`` format support. + When this generator is called from ``CPackSourceConfig.cmake`` (or through the ``package_source`` target), then the generated archive will contain all files in the project directory, except those specified in @@ -46,6 +52,9 @@ Variables specific to CPack Archive generator The default is ``<CPACK_PACKAGE_FILE_NAME>[-<component>]``, with spaces replaced by '-'. + .. versionadded:: 3.9 + Per-component ``CPACK_ARCHIVE_<component>_FILE_NAME`` variables. + .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL Enable component packaging. If enabled (ON), then the archive generator @@ -63,6 +72,8 @@ CPack generators which are essentially archives at their core. These include: .. variable:: CPACK_ARCHIVE_THREADS + .. versionadded:: 3.18 + The number of threads to use when performing the compression. If set to ``0``, the number of available cores on the machine will be used instead. The default is ``1`` which limits compression to a single thread. Note that diff --git a/Help/cpack_gen/bundle.rst b/Help/cpack_gen/bundle.rst index b16dbda..5e335c0 100644 --- a/Help/cpack_gen/bundle.rst +++ b/Help/cpack_gen/bundle.rst @@ -36,6 +36,8 @@ Bundle-specific parameters (``CPACK_BUNDLE_xxx``). .. variable:: CPACK_BUNDLE_APPLE_CERT_APP + .. versionadded:: 3.2 + The name of your Apple supplied code signing certificate for the application. The name usually takes the form ``Developer ID Application: [Name]`` or ``3rd Party Mac Developer Application: [Name]``. If this variable is not set @@ -43,23 +45,31 @@ Bundle-specific parameters (``CPACK_BUNDLE_xxx``). .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS + .. versionadded:: 3.2 + The name of the Property List (``.plist``) file that contains your Apple entitlements for sandboxing your application. This file is required for submission to the macOS App Store. .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES + .. versionadded:: 3.2 + A list of additional files that you wish to be signed. You do not need to list the main application folder, or the main executable. You should list any frameworks and plugins that are included in your app bundle. .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER + .. versionadded:: 3.3 + Additional parameter that will passed to ``codesign``. Default value: ``--deep -f`` .. variable:: CPACK_COMMAND_CODESIGN + .. versionadded:: 3.2 + Path to the ``codesign(1)`` command used to sign applications with an Apple cert. This variable can be used to override the automatically detected command (or specify its location if the auto-detection fails diff --git a/Help/cpack_gen/cygwin.rst b/Help/cpack_gen/cygwin.rst index c65653e..c537a79 100644 --- a/Help/cpack_gen/cygwin.rst +++ b/Help/cpack_gen/cygwin.rst @@ -6,7 +6,9 @@ Cygwin CPack generator (Cygwin). Variables affecting the CPack Cygwin generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - :variable:`CPACK_ARCHIVE_THREADS` +- .. versionadded:: 3.18 + :variable:`CPACK_ARCHIVE_THREADS` + Variables specific to CPack Cygwin generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst index bf50c55..7cae613 100644 --- a/Help/cpack_gen/deb.rst +++ b/Help/cpack_gen/deb.rst @@ -54,11 +54,16 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> for component-based installations. + .. versionadded:: 3.5 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME`` variables. + See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source .. variable:: CPACK_DEBIAN_FILE_NAME CPACK_DEBIAN_<COMPONENT>_FILE_NAME + .. versionadded:: 3.6 + Package file name. * Mandatory : YES @@ -72,6 +77,9 @@ List of CPack DEB generator specific variables: Alternatively provided package file name must end with either ``.deb`` or ``.ipk`` suffix. + .. versionadded:: 3.10 + ``.ipk`` suffix used by OPKG packaging system. + .. note:: Preferred setting of this variable is ``DEB-DEFAULT`` but for backward @@ -86,6 +94,8 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH + .. versionadded:: 3.10 + The Debian package epoch * Mandatory : No @@ -116,6 +126,8 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE + .. versionadded:: 3.6 + The Debian package release - Debian revision number. * Mandatory : No @@ -136,6 +148,9 @@ List of CPack DEB generator specific variables: * Default : Output of ``dpkg --print-architecture`` (or ``i386`` if ``dpkg`` is not found) + .. versionadded:: 3.6 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE`` variables. + .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS @@ -148,6 +163,10 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based installations. + + .. versionadded:: 3.3 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS`` variables. + .. note:: If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or @@ -165,7 +184,9 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS - Sets inter component dependencies if listed with + .. versionadded:: 3.6 + + Sets inter-component dependencies if listed with :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables. * Mandatory : NO @@ -196,6 +217,15 @@ List of CPack DEB generator specific variables: used if set. Otherwise, :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` will be added as the first line of description as defined in `Debian Policy Manual`_. + .. versionadded:: 3.3 + Per-component ``CPACK_COMPONENT_<compName>_DESCRIPTION`` variables. + + .. versionadded:: 3.16 + Per-component ``CPACK_DEBIAN_<COMPONENT>_DESCRIPTION`` variables. + + .. versionadded:: 3.16 + The ``CPACK_PACKAGE_DESCRIPTION_FILE`` variable. + .. _Debian Policy Manual: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description .. variable:: CPACK_DEBIAN_PACKAGE_SECTION @@ -206,10 +236,17 @@ List of CPack DEB generator specific variables: * Mandatory : YES * Default : "devel" + .. versionadded:: 3.5 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION`` variables. + See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE + .. versionadded:: 3.7 + + .. deprecated:: 3.14 + The archive format used for creating the Debian package. * Mandatory : YES @@ -228,6 +265,8 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE + .. versionadded:: 3.1 + The compression used for creating the Debian package. * Mandatory : YES @@ -249,6 +288,9 @@ List of CPack DEB generator specific variables: * Mandatory : YES * Default : "optional" + .. versionadded:: 3.5 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY`` varables. + See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE @@ -260,6 +302,9 @@ List of CPack DEB generator specific variables: * Mandatory : NO * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` + .. versionadded:: 3.12 + The ``CMAKE_PROJECT_HOMEPAGE_URL`` variable. + .. note:: The content of this field is a simple URL without any surrounding @@ -284,6 +329,12 @@ List of CPack DEB generator specific variables: may fail to find your own shared libs. See https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling + .. versionadded:: 3.3 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS`` variables. + + .. versionadded:: 3.6 + Correct handling of ``$ORIGIN`` in :variable:`CMAKE_INSTALL_RPATH`. + .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG May be set when invoking cpack in order to trace debug information @@ -308,6 +359,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS`` variables. + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES @@ -325,6 +379,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES`` variables. + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS @@ -345,6 +402,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS`` variables. + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS @@ -362,6 +422,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS`` variables. + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts .. note:: @@ -386,6 +449,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES`` variables. + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES @@ -402,6 +468,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES`` variables. + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS @@ -418,6 +487,9 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS`` variables. + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS @@ -433,10 +505,15 @@ List of CPack DEB generator specific variables: - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based installations. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS`` variables. + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS + .. versionadded:: 3.6 + * Mandatory : NO * Default : OFF @@ -451,6 +528,8 @@ List of CPack DEB generator specific variables: .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY + .. versionadded:: 3.6 + Compatibility policy for auto-generated shlibs control file. * Mandatory : NO @@ -476,17 +555,14 @@ List of CPack DEB generator specific variables: set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") - .. note:: - - The original permissions of the files will be used in the final - package unless the variable - :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set. - In particular, the scripts should have the proper executable - flag prior to the generation of the package. + .. versionadded:: 3.4 + Per-component ``CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA`` variables. .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION + .. versionadded:: 3.4 + This variable indicates if the Debian policy on control files should be strictly followed. @@ -497,15 +573,22 @@ List of CPack DEB generator specific variables: set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) + This overrides the permissions on the original files, following the rules + set by Debian policy + https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners + .. note:: - This overrides the permissions on the original files, following the rules - set by Debian policy - https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners + The original permissions of the files will be used in the final + package unless this variable is set to ``TRUE``. + In particular, the scripts should have the proper executable + flag prior to the generation of the package. .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE + .. versionadded:: 3.5 + Sets the ``Source`` field of the binary Debian package. When the binary package name is not the same as the source package name (in particular when several components/binaries are generated from one @@ -529,6 +612,8 @@ List of CPack DEB generator specific variables: Packaging of debug information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.13 + Dbgsym packages contain debug symbols for debugging packaged binaries. Dbgsym packaging has its own set of variables: @@ -549,6 +634,8 @@ Dbgsym packaging has its own set of variables: Building Debian packages on Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.10 + To communicate UNIX file permissions from the install stage to the CPack DEB generator the "cmake_mode_t" NTFS alternate data stream (ADT) is used. @@ -559,6 +646,8 @@ permissions can be preserved. Reproducible packages ^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.13 + The environment variable ``SOURCE_DATE_EPOCH`` may be set to a UNIX timestamp, defined as the number of seconds, excluding leap seconds, since 01 Jan 1970 00:00:00 UTC. If set, the CPack DEB generator will diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst index cede0f2..4c662a6 100644 --- a/Help/cpack_gen/dmg.rst +++ b/Help/cpack_gen/dmg.rst @@ -30,6 +30,8 @@ on macOS: .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT + .. versionadded:: 3.5 + Path to a custom AppleScript file. This AppleScript is used to generate a ``.DS_Store`` file which specifies the Finder window position/geometry and layout (such as hidden toolbars, placement of the icons etc.). @@ -47,11 +49,15 @@ on macOS: .. variable:: CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK + .. versionadded:: 3.6 + Default behaviour is to include a symlink to ``/Applications`` in the DMG. Set this option to ``ON`` to avoid adding the symlink. .. variable:: CPACK_DMG_SLA_DIR + .. versionadded:: 3.5 + Directory where license and menu files for different languages are stored. Setting this causes CPack to look for a ``<language>.menu.txt`` and ``<language>.license.txt`` or ``<language>.license.rtf`` file for every @@ -61,8 +67,13 @@ on macOS: ``<language>.license.txt`` and ``<language>.license.rtf`` exist, the ``.txt`` file will be used. + .. versionadded:: 3.17 + RTF support. + .. variable:: CPACK_DMG_SLA_LANGUAGES + .. versionadded:: 3.5 + Languages for which a license agreement is provided when mounting the generated DMG. A menu file consists of 9 lines of text. The first line is is the name of the language itself, uppercase, in English (e.g. German). @@ -85,6 +96,8 @@ on macOS: .. variable:: CPACK_DMG_<component>_FILE_NAME + .. versionadded:: 3.17 + File name when packaging ``<component>`` as its own DMG (``CPACK_COMPONENTS_GROUPING`` set to IGNORE). diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst index e54b356..4c083f0 100644 --- a/Help/cpack_gen/external.rst +++ b/Help/cpack_gen/external.rst @@ -1,6 +1,8 @@ CPack External Generator ------------------------ +.. versionadded:: 3.13 + CPack provides many generators to create packages for a variety of platforms and packaging systems. The intention is for CMake/CPack to be a complete end-to-end solution for building and packaging a software project. However, it @@ -284,6 +286,8 @@ Variables specific to CPack External generator .. variable:: CPACK_EXTERNAL_BUILT_PACKAGES + .. versionadded:: 3.19 + The ``CPACK_EXTERNAL_PACKAGE_SCRIPT`` script may set this list variable to the full paths of generated package files. CPack will copy these files from the staging directory back to the top build directory and possibly produce diff --git a/Help/cpack_gen/freebsd.rst b/Help/cpack_gen/freebsd.rst index 47a7784..2c93569 100644 --- a/Help/cpack_gen/freebsd.rst +++ b/Help/cpack_gen/freebsd.rst @@ -1,12 +1,15 @@ CPack FreeBSD Generator ----------------------- +.. versionadded:: 3.10 + The built in (binary) CPack FreeBSD (pkg) generator (Unix only) Variables affecting the CPack FreeBSD (pkg) generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - :variable:`CPACK_ARCHIVE_THREADS` +- .. versionadded:: 3.18 + :variable:`CPACK_ARCHIVE_THREADS` Variables specific to CPack FreeBSD (pkg) generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,6 +89,9 @@ the RPM information (e.g. package license). :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already for Debian packaging, so we may as well re-use it). + .. versionadded:: 3.12 + The ``CMAKE_PROJECT_HOMEPAGE_URL`` variable. + .. variable:: CPACK_FREEBSD_PACKAGE_LICENSE The license, or licenses, which apply to this software package. This must diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst index 5fbbfa2..a940a95 100644 --- a/Help/cpack_gen/ifw.rst +++ b/Help/cpack_gen/ifw.rst @@ -1,6 +1,8 @@ CPack IFW Generator ------------------- +.. versionadded:: 3.1 + Configure and run the Qt Installer Framework to generate a Qt installer. .. only:: html @@ -35,6 +37,8 @@ Debug .. variable:: CPACK_IFW_VERBOSE + .. versionadded:: 3.3 + Set to ``ON`` to enable addition debug output. By default is ``OFF``. @@ -71,41 +75,57 @@ Package .. variable:: CPACK_IFW_PACKAGE_WATERMARK + .. versionadded:: 3.8 + Filename for a watermark is used as QWizard::WatermarkPixmap. .. variable:: CPACK_IFW_PACKAGE_BANNER + .. versionadded:: 3.8 + Filename for a banner is used as QWizard::BannerPixmap. .. variable:: CPACK_IFW_PACKAGE_BACKGROUND + .. versionadded:: 3.8 + Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle). .. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE - Wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). - -.. variable:: CPACK_IFW_PACKAGE_STYLE_SHEET + .. versionadded:: 3.8 - Filename for a stylesheet. + Wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH + .. versionadded:: 3.8 + Default width of the wizard in pixels. Setting a banner image will override this. .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT + .. versionadded:: 3.8 + Default height of the wizard in pixels. Setting a watermark image will override this. +.. variable:: CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST + + Set to ``OFF`` if the widget listing installer pages on the left side of the wizard should not be shown. + + Is ``ON`` by default. + .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR + .. versionadded:: 3.8 + Color of the titles and subtitles (takes an HTML color code, such as "#88FF33"). -.. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY +.. variable:: CPACK_IFW_PACKAGE_STYLE_SHEET - Name of the default program group for the product in the Windows Start menu. + .. versionadded:: 3.15 - By default used :variable:`CPACK_IFW_PACKAGE_NAME`. + Filename for a stylesheet. .. variable:: CPACK_IFW_TARGET_DIRECTORY @@ -123,6 +143,14 @@ Package You can use predefined variables. +.. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR + + .. versionadded:: 3.11 + + Set to ``OFF`` if the target directory should not be deleted when uninstalling. + + Is ``ON`` by default + .. variable:: CPACK_IFW_PACKAGE_GROUP The group, which will be used to configure the root package @@ -132,43 +160,57 @@ Package The root package name, which will be used if configuration group is not specified +.. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY + + .. versionadded:: 3.3 + + Name of the default program group for the product in the Windows Start menu. + + By default used :variable:`CPACK_IFW_PACKAGE_NAME`. + .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME + .. versionadded:: 3.3 + Filename of the generated maintenance tool. The platform-specific executable file extension is appended. By default used QtIFW defaults (``maintenancetool``). -.. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR - - Set to ``OFF`` if the target directory should not be deleted when uninstalling. - - Is ``ON`` by default - .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE + .. versionadded:: 3.3 + Filename for the configuration of the generated maintenance tool. By default used QtIFW defaults (``maintenancetool.ini``). .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS + .. versionadded:: 3.3 + Set to ``ON`` if the installation path can contain non-ASCII characters. Is ``ON`` for QtIFW less 2.0 tools. .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH + .. versionadded:: 3.3 + Set to ``OFF`` if the installation path cannot contain space characters. Is ``ON`` for QtIFW less 2.0 tools. .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT + .. versionadded:: 3.3 + Filename for a custom installer control script. .. variable:: CPACK_IFW_PACKAGE_RESOURCES + .. versionadded:: 3.7 + List of additional resources ('.qrc' files) to include in the installer binary. @@ -177,6 +219,8 @@ Package .. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION + .. versionadded:: 3.10 + The target binary extension. On Linux, the name of the target binary is automatically extended with @@ -216,6 +260,8 @@ Components .. variable:: CPACK_IFW_REPOSITORIES_DIRECTORIES + .. versionadded:: 3.10 + Additional prepared repository dirs that will be used to resolve and repack dependent components. This feature available only since QtIFW 3.1. @@ -225,6 +271,8 @@ QtIFW Tools .. variable:: CPACK_IFW_FRAMEWORK_VERSION + .. versionadded:: 3.3 + The version of used QtIFW tools. The following variables provide the locations of the QtIFW @@ -233,6 +281,8 @@ These variables are cached, and may be configured if needed. .. variable:: CPACK_IFW_ARCHIVEGEN_EXECUTABLE + .. versionadded:: 3.19 + The path to ``archivegen``. .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE @@ -260,6 +310,8 @@ the path may be specified in either a CMake or an environment variable: .. variable:: CPACK_IFW_ROOT + .. versionadded:: 3.9 + An CMake variable which specifies the location of the QtIFW tool suite. The variable will be cached in the ``CPackConfig.cmake`` file and used at @@ -306,6 +358,8 @@ these files accessible from a download URL. Internationalization """""""""""""""""""" +.. versionadded:: 3.9 + Some variables and command arguments support internationalization via CMake script. This is an optional feature. diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index 0dd876e..33198e7 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -3,7 +3,8 @@ CPack NSIS Generator CPack Nullsoft Scriptable Install System (NSIS) generator specific options. -The NSIS generator requires NSIS 3.0 or newer. +.. versionchanged:: 3.17 + The NSIS generator requires NSIS 3.0 or newer. Variables specific to CPack NSIS generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,10 +34,14 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP + .. versionadded:: 3.5 + The filename of a bitmap to use as the NSIS ``MUI_WELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP + .. versionadded:: 3.5 + The filename of a bitmap to use as the NSIS ``MUI_UNWELCOMEFINISHPAGE_BITMAP``. .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS @@ -99,6 +104,8 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY + .. versionadded:: 3.7 + Custom install directory for the specified component ``<compName>`` instead of ``$INSTDIR``. @@ -133,29 +140,43 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_UNINSTALL_NAME + .. versionadded:: 3.17 + Specify the name of the program to uninstall the version. Default is ``Uninstall``. .. variable:: CPACK_NSIS_WELCOME_TITLE + .. versionadded:: 3.17 + The title to display on the top of the page for the welcome page. .. variable:: CPACK_NSIS_WELCOME_TITLE_3LINES + .. versionadded:: 3.17 + Display the title in the welcome page on 3 lines instead of 2. .. variable:: CPACK_NSIS_FINISH_TITLE + .. versionadded:: 3.17 + The title to display on the top of the page for the finish page. .. variable:: CPACK_NSIS_FINISH_TITLE_3LINES + .. versionadded:: 3.17 + Display the title in the finish page on 3 lines instead of 2. .. variable:: CPACK_NSIS_MUI_HEADERIMAGE + .. versionadded:: 3.17 + The image to display on the header of installers pages. .. variable:: CPACK_NSIS_MANIFEST_DPI_AWARE + .. versionadded:: 3.18 + If set, declares that the installer is DPI-aware. diff --git a/Help/cpack_gen/nuget.rst b/Help/cpack_gen/nuget.rst index f8aa626..c980dd6 100644 --- a/Help/cpack_gen/nuget.rst +++ b/Help/cpack_gen/nuget.rst @@ -1,9 +1,11 @@ CPack NuGet Generator --------------------- +.. versionadded:: 3.12 + When build a NuGet package there is no direct way to control an output filename due a lack of the corresponding CLI option of NuGet, so there -is no ``CPACK_NUGET_PACKAGE_FILENAME`` variable. To form the output filename +is no ``CPACK_NUGET_PACKAGE_FILE_NAME`` variable. To form the output filename NuGet uses the package name and the version according to its built-in rules. Also, be aware that including a top level directory @@ -35,7 +37,8 @@ List of CPack NuGet generator specific variables: .. variable:: CPACK_NUGET_PACKAGE_NAME CPACK_NUGET_<compName>_PACKAGE_NAME - The NUGET package name. + The NUGET package name. ``CPACK_NUGET_PACKAGE_NAME`` is used as the + package ``id`` on nuget.org_ * Mandatory : YES * Default : :variable:`CPACK_PACKAGE_NAME` @@ -95,7 +98,7 @@ List of CPack NuGet generator specific variables: .. variable:: CPACK_NUGET_PACKAGE_HOMEPAGE_URL CPACK_NUGET_<compName>_PACKAGE_HOMEPAGE_URL - A URL for the package's home page, often shown in UI displays as well + An URL for the package's home page, often shown in UI displays as well as nuget.org_. * Mandatory : NO @@ -104,8 +107,45 @@ List of CPack NuGet generator specific variables: .. variable:: CPACK_NUGET_PACKAGE_LICENSEURL CPACK_NUGET_<compName>_PACKAGE_LICENSEURL - A URL for the package's license, often shown in UI displays as well - as nuget.org_. + .. deprecated:: 3.20 + Use a local license file + (:variable:`CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME`) + or a `(SPDX) license identifier`_ + (:variable:`CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION`) instead. + + An URL for the package's license, often shown in UI displays as well + as on nuget.org_. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION + CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION + + .. versionadded:: 3.20 + + A Software Package Data Exchange `(SPDX) license identifier`_ such as + ``MIT``, ``BSD-3-Clause``, or ``LGPL-3.0-or-later``. In the case of a + choice of licenses or more complex restrictions, compound license + expressions may be formed using boolean operators, for example + ``MIT OR BSD-3-Clause``. See the `SPDX specification`_ for guidance + on forming complex license expressions. + + If ``CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME`` is specified, + ``CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION`` is ignored. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME + CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME + + The package's license file in :file:`.txt` or :file:`.md` format. + + If ``CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME`` is specified, + ``CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION`` is ignored. + + .. versionadded:: 3.20 * Mandatory : NO * Default : - @@ -113,7 +153,21 @@ List of CPack NuGet generator specific variables: .. variable:: CPACK_NUGET_PACKAGE_ICONURL CPACK_NUGET_<compName>_PACKAGE_ICONURL - A URL for a 64x64 image with transparency background to use as the + .. deprecated:: 3.20 + Use a local icon file (:variable:`CPACK_NUGET_PACKAGE_ICON`) instead. + + An URL for a 64x64 image with transparency background to use as the + icon for the package in UI display. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_ICON + CPACK_NUGET_<compName>_PACKAGE_ICON + + .. versionadded:: 3.20 + + The filename of a 64x64 image with transparency background to use as the icon for the package in UI display. * Mandatory : NO @@ -146,6 +200,16 @@ List of CPack NuGet generator specific variables: * Mandatory : NO * Default : - +.. variable:: CPACK_NUGET_PACKAGE_LANGUAGE + CPACK_NUGET_<compName>_PACKAGE_LANGUAGE + + .. versionadded:: 3.20 + + Locale specifier for the package, for example ``en_CA``. + + * Mandatory : NO + * Default : - + .. variable:: CPACK_NUGET_PACKAGE_TAGS CPACK_NUGET_<compName>_PACKAGE_TAGS @@ -185,5 +249,7 @@ List of CPack NuGet generator specific variables: .. _nuget.org: http://nuget.org .. _version specification: https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards +.. _(SPDX) license identifier: https://spdx.org/licenses/ +.. _SPDX specification: https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/ .. NuGet spec docs https://docs.microsoft.com/en-us/nuget/reference/nuspec diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst index 357eb73..256446d 100644 --- a/Help/cpack_gen/packagemaker.rst +++ b/Help/cpack_gen/packagemaker.rst @@ -27,6 +27,14 @@ macOS using PackageMaker: don't mind missing extra features available in the installer shipping with later versions of macOS. +Background Image +"""""""""""""""" + +.. versionadded:: 3.17 + +This group of variables controls the background image of the generated +installer. + .. variable:: CPACK_PACKAGEMAKER_BACKGROUND Adds a background to Distribution XML if specified. The value contains the diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst index fd99e5a..cf3041f 100644 --- a/Help/cpack_gen/productbuild.rst +++ b/Help/cpack_gen/productbuild.rst @@ -1,6 +1,8 @@ CPack productbuild Generator ---------------------------- +.. versionadded:: 3.7 + productbuild CPack generator (macOS). Variables specific to CPack productbuild generator @@ -18,11 +20,15 @@ macOS using ProductBuild: .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME + .. versionadded:: 3.8 + Adds a digital signature to the resulting package. .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH + .. versionadded:: 3.8 + Specify a specific keychain to search for the signing identity. @@ -35,11 +41,15 @@ macOS using ProductBuild: .. variable:: CPACK_PKGBUILD_IDENTITY_NAME + .. versionadded:: 3.8 + Adds a digital signature to the resulting package. .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH + .. versionadded:: 3.8 + Specify a specific keychain to search for the signing identity. @@ -60,12 +70,22 @@ macOS using ProductBuild: .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR + .. versionadded:: 3.9 + If specified the productbuild generator copies files from this directory (including subdirectories) to the ``Resources`` directory. This is done before the :variable:`CPACK_RESOURCE_FILE_WELCOME`, :variable:`CPACK_RESOURCE_FILE_README`, and :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied. +Background Image +"""""""""""""""" + +.. versionadded:: 3.17 + +This group of variables controls the background image of the generated +installer. + .. variable:: CPACK_PRODUCTBUILD_BACKGROUND Adds a background to Distribution XML if specified. The value contains the diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst index ccb7ebd..5260a1d 100644 --- a/Help/cpack_gen/rpm.rst +++ b/Help/cpack_gen/rpm.rst @@ -20,7 +20,7 @@ a component GROUP name. Usually those variables correspond to RPM spec file entities. One may find information about spec files here http://www.rpm.org/wiki/Docs -.. note:: +.. versionchanged:: 3.6 `<COMPONENT>` part of variables is preferred to be in upper case (e.g. if component is named ``foo`` then use ``CPACK_RPM_FOO_XXXX`` variable name format) @@ -59,6 +59,9 @@ List of CPack RPM generator specific variables: * Mandatory : YES * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` + .. versionadded:: 3.2 + Per-component ``CPACK_RPM_<component>_PACKAGE_SUMMARY`` variables. + .. variable:: CPACK_RPM_PACKAGE_NAME CPACK_RPM_<component>_PACKAGE_NAME @@ -67,9 +70,14 @@ List of CPack RPM generator specific variables: * Mandatory : YES * Default : :variable:`CPACK_PACKAGE_NAME` + .. versionadded:: 3.5 + Per-component ``CPACK_RPM_<component>_PACKAGE_NAME`` variables. + .. variable:: CPACK_RPM_FILE_NAME CPACK_RPM_<component>_FILE_NAME + .. versionadded:: 3.6 + Package file name. * Mandatory : YES @@ -93,6 +101,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_MAIN_COMPONENT + .. versionadded:: 3.8 + Main component that is packaged without component suffix. * Mandatory : NO @@ -104,6 +114,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_EPOCH + .. versionadded:: 3.10 + The RPM package epoch * Mandatory : No @@ -129,6 +141,9 @@ List of CPack RPM generator specific variables: This may be set to ``noarch`` if you know you are building a ``noarch`` package. + .. versionadded:: 3.3 + Per-component ``CPACK_RPM_<component>_PACKAGE_ARCHITECTURE`` variables. + .. variable:: CPACK_RPM_PACKAGE_RELEASE The RPM package release. @@ -150,6 +165,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST + .. versionadded:: 3.6 + The dist tag that is added RPM ``Release:`` field. * Mandatory : NO @@ -174,6 +191,9 @@ List of CPack RPM generator specific variables: * Mandatory : YES * Default : "unknown" + .. versionadded:: 3.5 + Per-component ``CPACK_RPM_<component>_PACKAGE_GROUP`` variables. + .. variable:: CPACK_RPM_PACKAGE_VENDOR The RPM package vendor. @@ -189,6 +209,9 @@ List of CPack RPM generator specific variables: * Mandatory : NO * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` + .. versionadded:: 3.12 + The ``CMAKE_PROJECT_HOMEPAGE_URL`` variable. + .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION CPACK_RPM_<component>_PACKAGE_DESCRIPTION @@ -199,6 +222,9 @@ List of CPack RPM generator specific variables: based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` if set or "no package description available" + .. versionadded:: 3.2 + Per-component ``CPACK_RPM_<component>_PACKAGE_DESCRIPTION`` variables. + .. variable:: CPACK_RPM_COMPRESSION_TYPE RPM compression type. @@ -302,6 +328,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE + .. versionadded:: 3.2 + RPM spec requires(pre) field. * Mandatory : NO @@ -315,6 +343,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST CPACK_RPM_<component>_PACKAGE_REQUIRES_POST + .. versionadded:: 3.2 + RPM spec requires(post) field. * Mandatory : NO @@ -328,6 +358,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN + .. versionadded:: 3.2 + RPM spec requires(postun) field. * Mandatory : NO @@ -342,6 +374,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN + .. versionadded:: 3.2 + RPM spec requires(preun) field. * Mandatory : NO @@ -492,6 +526,9 @@ List of CPack RPM generator specific variables: rpm -qp --scripts package.rpm + .. versionadded:: 3.18 + The ``CPACK_RPM_PRE_TRANS_SCRIPT_FILE`` variable. + .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE CPACK_RPM_POST_TRANS_SCRIPT_FILE @@ -513,6 +550,9 @@ List of CPack RPM generator specific variables: rpm -qp --scripts package.rpm + .. versionadded:: 3.18 + The ``CPACK_RPM_POST_TRANS_SCRIPT_FILE`` variable. + .. variable:: CPACK_RPM_USER_FILELIST CPACK_RPM_<COMPONENT>_USER_FILELIST @@ -521,13 +561,16 @@ List of CPack RPM generator specific variables: May be used to explicitly specify ``%(<directive>)`` file line in the spec file. Like ``%config(noreplace)`` or any other directive - that be found in the ``%files`` section. You can have multiple directives - per line, as in ``%attr(600,root,root) %config(noreplace)``. Since + that be found in the ``%files`` section. Since the CPack RPM generator is generating the list of files (and directories) the user specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will be removed from the generated list. If referring to directories do not add a trailing slash. + .. versionadded:: 3.8 + You can have multiple directives per line, as in + ``%attr(600,root,root) %config(noreplace)``. + .. variable:: CPACK_RPM_CHANGELOG_FILE RPM changelog file. @@ -555,6 +598,9 @@ List of CPack RPM generator specific variables: the default path. If you want to add some path to the default list then you can use :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable. + .. versionadded:: 3.10 + Added ``/usr/share/aclocal`` to the default list of excludes. + .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION additional list of path to be excluded. @@ -568,6 +614,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_RELOCATION_PATHS + .. versionadded:: 3.2 + Packages relocation paths list. * Mandatory : NO @@ -591,6 +639,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX + .. versionadded:: 3.2 + Per component relocation path install prefix. * Mandatory : NO @@ -602,6 +652,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION + .. versionadded:: 3.3 + Removal of default install prefix from relocation paths list. * Mandatory : NO @@ -613,6 +665,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS + .. versionadded:: 3.3 + * Mandatory : NO * Default : - @@ -641,6 +695,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_DEFAULT_USER CPACK_RPM_<compName>_DEFAULT_USER + .. versionadded:: 3.6 + default user ownership of RPM content * Mandatory : NO @@ -652,6 +708,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_DEFAULT_GROUP CPACK_RPM_<compName>_DEFAULT_GROUP + .. versionadded:: 3.6 + default group ownership of RPM content * Mandatory : NO @@ -663,6 +721,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS + .. versionadded:: 3.6 + default permissions used for packaged files * Mandatory : NO @@ -686,6 +746,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS + .. versionadded:: 3.6 + default permissions used for packaged directories * Mandatory : NO @@ -697,6 +759,8 @@ List of CPack RPM generator specific variables: .. variable:: CPACK_RPM_INSTALL_WITH_EXEC + .. versionadded:: 3.11 + force execute permissions on programs and shared libraries * Mandatory : NO @@ -714,6 +778,8 @@ List of CPack RPM generator specific variables: Packaging of Symbolic Links ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.3 + The CPack RPM generator supports packaging of symbolic links:: execute_process(COMMAND ${CMAKE_COMMAND} @@ -731,8 +797,10 @@ those locations will be treated as if they were a part of the package while determining if symlink should be either created or present in a post install script - depending on relocation paths. -Symbolic links that point to locations outside packaging path produce a -warning and are treated as non relocatable permanent symbolic links. +.. versionchanged:: 3.6 + Symbolic links that point to locations outside packaging path produce a + warning and are treated as non relocatable permanent symbolic links. + Previous versions of CMake produced an error in this case. Currently there are a few limitations though: @@ -750,6 +818,8 @@ Currently there are a few limitations though: Packaging of debug information ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.7 + Debuginfo packages contain debug symbols and sources for debugging packaged binaries. @@ -832,6 +902,8 @@ Debuginfo RPM packaging has its own set of variables: .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE + .. versionadded:: 3.8 + Create a single debuginfo package even if components packaging is set. * Mandatory : NO @@ -853,6 +925,8 @@ Debuginfo RPM packaging has its own set of variables: .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME CPACK_RPM_<component>_DEBUGINFO_FILE_NAME + .. versionadded:: 3.9 + Debuginfo package file name. * Mandatory : NO @@ -877,6 +951,8 @@ Debuginfo RPM packaging has its own set of variables: Packaging of sources (SRPM) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.7 + SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES` variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable to provide directory containing CMakeLists.txt and source files. diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst index 5b880ba..79f835e 100644 --- a/Help/cpack_gen/wix.rst +++ b/Help/cpack_gen/wix.rst @@ -3,6 +3,9 @@ CPack WIX Generator CPack WIX generator specific options +.. versionadded:: 3.7 + Support :variable:`CPACK_COMPONENT_<compName>_DISABLED` variable. + Variables specific to CPack WIX generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,9 +98,10 @@ Windows using WiX. If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME - If this variable is set to ``.``, then application shortcuts will be - created directly in the start menu and the uninstaller shortcut will be - omitted. + .. versionadded:: 3.16 + If this variable is set to ``.``, then application shortcuts will be + created directly in the start menu and the uninstaller shortcut will be + omitted. .. variable:: CPACK_WIX_CULTURES @@ -123,7 +127,10 @@ Windows using WiX. .. variable:: CPACK_WIX_PATCH_FILE Optional list of XML files with fragments to be inserted into - generated WiX sources + generated WiX sources. + + .. versionadded:: 3.5 + Support listing multiple patch files. This optional variable can be used to specify an XML file that the WIX generator will use to inject fragments into its generated @@ -152,10 +159,17 @@ Windows using WiX. Currently fragments can be injected into most Component, File, Directory and Feature elements. - The following additional special Ids can be used: + .. versionadded:: 3.3 + The following additional special Ids can be used: + + * ``#PRODUCT`` for the ``<Product>`` element. + * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element. - * ``#PRODUCT`` for the ``<Product>`` element. - * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element. + .. versionadded:: 3.7 + Support patching arbitrary ``<Feature>`` elements. + + .. versionadded:: 3.9 + Allow setting additional attributes. The following example illustrates how this works. @@ -227,6 +241,8 @@ Windows using WiX. .. variable:: CPACK_WIX_PROPERTY_<PROPERTY> + .. versionadded:: 3.1 + This variable can be used to provide a value for the Windows Installer property ``<PROPERTY>`` @@ -243,16 +259,22 @@ Windows using WiX. .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE + .. versionadded:: 3.7 + Sets the name of the root install feature in the WIX installer. Same as CPACK_COMPONENT_<compName>_DISPLAY_NAME for components. .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION + .. versionadded:: 3.7 + Sets the description of the root install feature in the WIX installer. Same as CPACK_COMPONENT_<compName>_DESCRIPTION for components. .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER + .. versionadded:: 3.7 + If this variable is set to true, the default install location of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly. The install location will not be located relatively below @@ -270,6 +292,8 @@ Windows using WiX. .. variable:: CPACK_WIX_ROOT_FOLDER_ID + .. versionadded:: 3.9 + This variable allows specification of a custom root folder ID. The generator specific ``<64>`` token can be used for folder IDs that come in 32-bit and 64-bit variants. @@ -289,6 +313,8 @@ Windows using WiX. .. variable:: CPACK_WIX_CUSTOM_XMLNS + .. versionadded:: 3.19 + This variable provides a list of custom namespace declarations that are necessary for using WiX extensions. Each declaration should be in the form name=url, where name is the plain namespace without the usual xmlns: prefix and url is an unquoted diff --git a/Help/dev/README.rst b/Help/dev/README.rst index 84da4f1..9c3878b 100644 --- a/Help/dev/README.rst +++ b/Help/dev/README.rst @@ -37,9 +37,11 @@ CMake developer documentation is provided by the following documents: * The `CMake Source Code Guide`_. * The `CMake Documentation Guide`_. +* The `CMake Experimental Features Guide`_. .. _`CMake Source Code Guide`: source.rst .. _`CMake Documentation Guide`: documentation.rst +.. _`CMake Experimental Features Guide`: experimental.rst Maintainer Documentation ======================== diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst new file mode 100644 index 0000000..4d2b076 --- /dev/null +++ b/Help/dev/experimental.rst @@ -0,0 +1,10 @@ +CMake Experimental Features Guide +********************************* + +The following is a guide to CMake experimental features that are +under development and not yet included in official documentation. +See documentation on `CMake Development`_ for more information. + +.. _`CMake Development`: README.rst + +No experimental features are under development in this version of CMake. diff --git a/Help/dev/maint.rst b/Help/dev/maint.rst index 75d685c..664b7a4 100644 --- a/Help/dev/maint.rst +++ b/Help/dev/maint.rst @@ -357,3 +357,13 @@ policies added for that version. Commit with a message such as:: The files generatd by `install(EXPORT)` and `export()` commands are known to work with policies as of CMake $prev, so enable them in sufficiently new CMake versions. + +Update the ``cmake_minimum_required`` version range in CMake itself: + +* ``CMakeLists.txt`` +* ``Utilities/Doxygen/CMakeLists.txt`` +* ``Utilities/Sphinx/CMakeLists.txt`` + +to end in the previous release. Commit with a message such as:: + + Configure CMake itself with policies through CMake $prev diff --git a/Help/envvar/CUDAARCHS.rst b/Help/envvar/CUDAARCHS.rst new file mode 100644 index 0000000..82369cd --- /dev/null +++ b/Help/envvar/CUDAARCHS.rst @@ -0,0 +1,13 @@ +CUDAARCHS +--------- + +.. versionadded:: 3.20 + +.. include:: ENV_VAR.txt + +Value used to initialize :variable:`CMAKE_CUDA_ARCHITECTURES` on the first +configuration if it's not already defined. Subsequent runs will use the value +stored in the cache. + +This is a semicolon-separated list of architectures as described in +:prop_tgt:`CUDA_ARCHITECTURES`. diff --git a/Help/envvar/CUDAHOSTCXX.rst b/Help/envvar/CUDAHOSTCXX.rst index 19b15e9..963f9d1 100644 --- a/Help/envvar/CUDAHOSTCXX.rst +++ b/Help/envvar/CUDAHOSTCXX.rst @@ -13,5 +13,8 @@ configuration run (including the first), the environment variable will be ignored if the :variable:`CMAKE_CUDA_HOST_COMPILER` variable is defined. This environment variable is primarily meant for use with projects that -enable ``CUDA`` as a first-class language. The :module:`FindCUDA` -module will also use it to initialize its ``CUDA_HOST_COMPILER`` setting. +enable ``CUDA`` as a first-class language. + +.. versionadded:: 3.13 + The :module:`FindCUDA` + module will use this variable to initialize its ``CUDA_HOST_COMPILER`` setting. diff --git a/Help/generator/CodeBlocks.rst b/Help/generator/CodeBlocks.rst index d830542..85da715 100644 --- a/Help/generator/CodeBlocks.rst +++ b/Help/generator/CodeBlocks.rst @@ -7,13 +7,15 @@ Project files for CodeBlocks will be created in the top directory and in every subdirectory which features a ``CMakeLists.txt`` file containing a :command:`project` call. Additionally a hierarchy of makefiles is generated into the build tree. -The :variable:`CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES` variable may -be set to ``ON`` to exclude any files which are located outside of -the project root directory. The appropriate make program can build the project through the default ``all`` target. An ``install`` target is also provided. +.. versionadded:: 3.10 + The :variable:`CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES` variable may + be set to ``ON`` to exclude any files which are located outside of + the project root directory. + This "extra" generator may be specified as: ``CodeBlocks - MinGW Makefiles`` @@ -23,7 +25,8 @@ This "extra" generator may be specified as: Generate with :generator:`NMake Makefiles`. ``CodeBlocks - NMake Makefiles JOM`` - Generate with :generator:`NMake Makefiles JOM`. + .. versionadded:: 3.8 + Generate with :generator:`NMake Makefiles JOM`. ``CodeBlocks - Ninja`` Generate with :generator:`Ninja`. diff --git a/Help/generator/CodeLite.rst b/Help/generator/CodeLite.rst index 46fa5be..4f276df 100644 --- a/Help/generator/CodeLite.rst +++ b/Help/generator/CodeLite.rst @@ -6,13 +6,15 @@ Generates CodeLite project files. Project files for CodeLite will be created in the top directory and in every subdirectory which features a CMakeLists.txt file containing a :command:`project` call. -The :variable:`CMAKE_CODELITE_USE_TARGETS` variable may be set to ``ON`` -to change the default behavior from projects to targets as the basis -for project files. The appropriate make program can build the project through the default ``all`` target. An ``install`` target is also provided. +.. versionadded:: 3.7 + The :variable:`CMAKE_CODELITE_USE_TARGETS` variable may be set to ``ON`` + to change the default behavior from projects to targets as the basis + for project files. + This "extra" generator may be specified as: ``CodeLite - MinGW Makefiles`` diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 2246699..5d2b1cd 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -3,22 +3,36 @@ Green Hills MULTI .. versionadded:: 3.3 +.. versionadded:: 3.15 + Linux support. + Generates Green Hills MULTI project files (experimental, work-in-progress). -The buildsystem has predetermined build-configuration settings that can be controlled -via the :variable:`CMAKE_BUILD_TYPE` variable. +Customizations are available through the following cache variables: + +* ``GHS_CUSTOMIZATION`` +* ``GHS_GPJ_MACROS`` + +.. versionadded:: 3.14 + The buildsystem has predetermined build-configuration settings that can be controlled + via the :variable:`CMAKE_BUILD_TYPE` variable. + +Toolset and Platform Selection +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.13 Customizations that are used to pick toolset and target system: -The ``-A <arch>`` can be supplied for setting the target architecture. -``<arch>`` usually is one of ``arm``, ``ppc``, ``86``, etcetera. -If the target architecture is not specified then -the default architecture of ``arm`` will be used. +* The ``-A <arch>`` can be supplied for setting the target architecture. + ``<arch>`` usually is one of ``arm``, ``ppc``, ``86``, etcetera. + If the target architecture is not specified then + the default architecture of ``arm`` will be used. -The ``-T <toolset>`` option can be used to set the directory location of the toolset. -Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT`` -as the root. If the toolset is not specified then the latest toolset found in -``GHS_TOOLSET_ROOT`` will be used. +* The ``-T <toolset>`` option can be used to set the directory location of the toolset. + Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT`` + as the root. If the toolset is not specified then the latest toolset found in + ``GHS_TOOLSET_ROOT`` will be used. Cache variables that are used for toolset and target system customization: @@ -50,15 +64,18 @@ Cache variables that are used for toolset and target system customization: a specific RTOS is to be used. | ``GHS_OS_DIR_OPTION`` default value is ``-os_dir``. + .. versionadded:: 3.15 + The ``GHS_OS_DIR_OPTION`` variable. + * ``GHS_BSP_NAME`` | Sets ``-bsp`` entry in project file. | Defaults to ``sim<arch>`` for ``integrity`` platforms. -Customizations are available through the following cache variables: +Target Properties +^^^^^^^^^^^^^^^^^ -* ``GHS_CUSTOMIZATION`` -* ``GHS_GPJ_MACROS`` +.. versionadded:: 3.14 The following properties are available: diff --git a/Help/generator/NMake Makefiles JOM.rst b/Help/generator/NMake Makefiles JOM.rst index 3a8744c..e0f4c90 100644 --- a/Help/generator/NMake Makefiles JOM.rst +++ b/Help/generator/NMake Makefiles JOM.rst @@ -2,3 +2,6 @@ NMake Makefiles JOM ------------------- Generates JOM makefiles. + +.. versionadded:: 3.8 + :generator:`CodeBlocks` generator can be used as an extra generator. diff --git a/Help/generator/Ninja.rst b/Help/generator/Ninja.rst index 08ee81b..f3ba222 100644 --- a/Help/generator/Ninja.rst +++ b/Help/generator/Ninja.rst @@ -11,32 +11,57 @@ For each subdirectory ``sub/dir`` of the project, additional targets are generated: ``sub/dir/all`` - Depends on all targets required by the subdirectory. + + .. versionadded:: 3.6 + + Depends on all targets required by the subdirectory. ``sub/dir/install`` - Runs the install step in the subdirectory, if any. + + .. versionadded:: 3.7 + + Runs the install step in the subdirectory, if any. ``sub/dir/install/strip`` - Runs the install step in the subdirectory followed by a ``CMAKE_STRIP`` command, - if any. - The ``CMAKE_STRIP`` variable will contain the platform's ``strip`` utility, which - removes symbols information from generated binaries. + .. versionadded:: 3.7 + Runs the install step in the subdirectory followed by a ``CMAKE_STRIP`` command, + if any. + + The ``CMAKE_STRIP`` variable will contain the platform's ``strip`` utility, which + removes symbols information from generated binaries. ``sub/dir/test`` - Runs the test step in the subdirectory, if any. + + .. versionadded:: 3.7 + + Runs the test step in the subdirectory, if any. ``sub/dir/package`` - Runs the package step in the subdirectory, if any. + + .. versionadded:: 3.7 + + Runs the package step in the subdirectory, if any. Fortran Support ^^^^^^^^^^^^^^^ +.. versionadded:: 3.7 + The ``Ninja`` generator conditionally supports Fortran when the ``ninja`` tool is at least version 1.10 (which has the required features). +Swift Support +^^^^^^^^^^^^^ + +.. versionadded:: 3.15 + +The Swift support is experimental, not considered stable, and may change +in future releases of CMake. + See Also ^^^^^^^^ -The :generator:`Ninja Multi-Config` generator is similar to the ``Ninja`` -generator, but generates multiple configurations at once. +.. versionadded:: 3.17 + The :generator:`Ninja Multi-Config` generator is similar to the ``Ninja`` + generator, but generates multiple configurations at once. diff --git a/Help/generator/VS_TOOLSET_HOST_ARCH.txt b/Help/generator/VS_TOOLSET_HOST_ARCH.txt index 0293631..e361719 100644 --- a/Help/generator/VS_TOOLSET_HOST_ARCH.txt +++ b/Help/generator/VS_TOOLSET_HOST_ARCH.txt @@ -1,7 +1,11 @@ -For each toolset that comes with this version of Visual Studio, there are -variants that are themselves compiled for 32-bit (``x86``) and -64-bit (``x64``) hosts (independent of the architecture they target). -|VS_TOOLSET_HOST_ARCH_DEFAULT| -One may explicitly request use of either the 32-bit or 64-bit host tools -by adding either ``host=x86`` or ``host=x64`` to the toolset specification. -See the :variable:`CMAKE_GENERATOR_TOOLSET` variable for details. +.. versionadded:: 3.8 + For each toolset that comes with this version of Visual Studio, there are + variants that are themselves compiled for 32-bit (``x86``) and + 64-bit (``x64``) hosts (independent of the architecture they target). + |VS_TOOLSET_HOST_ARCH_DEFAULT| + One may explicitly request use of either the 32-bit or 64-bit host tools + by adding either ``host=x86`` or ``host=x64`` to the toolset specification. + See the :variable:`CMAKE_GENERATOR_TOOLSET` variable for details. + +.. versionadded:: 3.14 + Added suport for ``host=x86`` option. diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index 4bf9a8f..b4376d8 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -17,13 +17,14 @@ Platform Selection The default target platform name (architecture) is ``Win32``. -The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps -via the :manual:`cmake(1)` ``-A`` option, to specify a target platform -name (architecture). For example: - -* ``cmake -G "Visual Studio 10 2010" -A Win32`` -* ``cmake -G "Visual Studio 10 2010" -A x64`` -* ``cmake -G "Visual Studio 10 2010" -A Itanium`` +.. versionadded:: 3.1 + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps + via the :manual:`cmake(1)` ``-A`` option, to specify a target platform + name (architecture). For example: + + * ``cmake -G "Visual Studio 10 2010" -A Win32`` + * ``cmake -G "Visual Studio 10 2010" -A x64`` + * ``cmake -G "Visual Studio 10 2010" -A Itanium`` For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 5d89a6e..932548b 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -17,15 +17,16 @@ Platform Selection The default target platform name (architecture) is ``Win32``. -The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps -via the :manual:`cmake(1)` ``-A`` option, to specify a target platform -name (architecture). For example: - -* ``cmake -G "Visual Studio 11 2012" -A Win32`` -* ``cmake -G "Visual Studio 11 2012" -A x64`` -* ``cmake -G "Visual Studio 11 2012" -A ARM`` -* ``cmake -G "Visual Studio 11 2012" -A <WinCE-SDK>`` - (Specify a target platform matching a Windows CE SDK name.) +.. versionadded:: 3.1 + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps + via the :manual:`cmake(1)` ``-A`` option, to specify a target platform + name (architecture). For example: + + * ``cmake -G "Visual Studio 11 2012" -A Win32`` + * ``cmake -G "Visual Studio 11 2012" -A x64`` + * ``cmake -G "Visual Studio 11 2012" -A ARM`` + * ``cmake -G "Visual Studio 11 2012" -A <WinCE-SDK>`` + (Specify a target platform matching a Windows CE SDK name.) For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index fb8e021..b5fa1bf 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -17,13 +17,14 @@ Platform Selection The default target platform name (architecture) is ``Win32``. -The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps -via the :manual:`cmake(1)` ``-A`` option, to specify a target platform -name (architecture). For example: - -* ``cmake -G "Visual Studio 12 2013" -A Win32`` -* ``cmake -G "Visual Studio 12 2013" -A x64`` -* ``cmake -G "Visual Studio 12 2013" -A ARM`` +.. versionadded:: 3.1 + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps + via the :manual:`cmake(1)` ``-A`` option, to specify a target platform + name (architecture). For example: + + * ``cmake -G "Visual Studio 12 2013" -A Win32`` + * ``cmake -G "Visual Studio 12 2013" -A x64`` + * ``cmake -G "Visual Studio 12 2013" -A ARM`` For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst index 5b319bb..9c61641 100644 --- a/Help/generator/Visual Studio 14 2015.rst +++ b/Help/generator/Visual Studio 14 2015.rst @@ -51,6 +51,8 @@ via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. Windows 10 SDK Maximum Version for VS 2015 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.19 + Microsoft stated in a "Windows 10 October 2018 Update" blog post that Windows 10 SDK versions (15063, 16299, 17134, 17763) are not supported by VS 2015 and are only supported by VS 2017 and later. Therefore by default CMake diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst index e7baaad..a002f2f 100644 --- a/Help/generator/Visual Studio 15 2017.rst +++ b/Help/generator/Visual Studio 15 2017.rst @@ -14,18 +14,20 @@ projects (JavaScript, Powershell, Python, etc.) are not supported. Instance Selection ^^^^^^^^^^^^^^^^^^ -VS 2017 supports multiple installations on the same machine. -The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a -cache entry containing the absolute path to a Visual Studio instance. -If the value is not specified explicitly by the user or a toolchain file, -CMake queries the Visual Studio Installer to locate VS instances, chooses -one, and sets the variable as a cache entry to hold the value persistently. - -When CMake first chooses an instance, if the ``VS150COMNTOOLS`` environment -variable is set and points to the ``Common7/Tools`` directory within -one of the instances, that instance will be used. Otherwise, if more -than one instance is installed we do not define which one is chosen -by default. +.. versionadded:: 3.9 + VS 2017 supports multiple installations on the same machine. + The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a + cache entry containing the absolute path to a Visual Studio instance. + If the value is not specified explicitly by the user or a toolchain file, + CMake queries the Visual Studio Installer to locate VS instances, chooses + one, and sets the variable as a cache entry to hold the value persistently. + +.. versionadded:: 3.11 + When CMake first chooses an instance, if the ``VS150COMNTOOLS`` environment + variable is set and points to the ``Common7/Tools`` directory within + one of the instances, that instance will be used. Otherwise, if more + than one instance is installed we do not define which one is chosen + by default. Platform Selection ^^^^^^^^^^^^^^^^^^ diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index a09d047..644f936 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/Help/generator/Visual Studio 9 2008.rst @@ -8,15 +8,16 @@ Platform Selection The default target platform name (architecture) is ``Win32``. -The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps -via the :manual:`cmake(1)` ``-A`` option, to specify a target platform -name (architecture). For example: - -* ``cmake -G "Visual Studio 9 2008" -A Win32`` -* ``cmake -G "Visual Studio 9 2008" -A x64`` -* ``cmake -G "Visual Studio 9 2008" -A Itanium`` -* ``cmake -G "Visual Studio 9 2008" -A <WinCE-SDK>`` - (Specify a target platform matching a Windows CE SDK name.) +.. versionadded:: 3.1 + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps + via the :manual:`cmake(1)` ``-A`` option, to specify a target platform + name (architecture). For example: + + * ``cmake -G "Visual Studio 9 2008" -A Win32`` + * ``cmake -G "Visual Studio 9 2008" -A x64`` + * ``cmake -G "Visual Studio 9 2008" -A Itanium`` + * ``cmake -G "Visual Studio 9 2008" -A <WinCE-SDK>`` + (Specify a target platform matching a Windows CE SDK name.) For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of the generator name. diff --git a/Help/generator/Xcode.rst b/Help/generator/Xcode.rst index be03a22..e4900a1 100644 --- a/Help/generator/Xcode.rst +++ b/Help/generator/Xcode.rst @@ -3,7 +3,8 @@ Xcode Generate Xcode project files. -This supports Xcode 5.0 and above. +.. versionchanged:: 3.15 + This generator supports Xcode 5.0 and above. .. _`Xcode Build System Selection`: @@ -14,7 +15,8 @@ By default Xcode is allowed to select its own default toolchain. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. -This generator supports toolset specification using one of these forms: +.. versionadded:: 3.19 + This generator supports toolset specification using one of these forms: * ``toolset`` * ``toolset[,key=value]*`` @@ -33,3 +35,12 @@ Supported pairs are: For example, to select the original build system under Xcode 12, run :manual:`cmake(1)` with the option ``-T buildsystem=1``. + +Swift Support +^^^^^^^^^^^^^ + +.. versionadded:: 3.4 + +When using the :generator:`Xcode` generator with Xcode 6.1 or higher, +one may enable the ``Swift`` language with the :command:`enable_language` +command or the :command:`project`. diff --git a/Help/guide/ide-integration/index.rst b/Help/guide/ide-integration/index.rst index 8ea31a0..addf932 100644 --- a/Help/guide/ide-integration/index.rst +++ b/Help/guide/ide-integration/index.rst @@ -82,8 +82,8 @@ as the include directories, compile definitions, etc. used to build the artifacts. Such information can be obtained by using the :manual:`File API <cmake-file-api(7)>`. The manual page for the File API contains more information about the API and how to invoke it. -:manual:`Server mode <cmake-server(7)>` is deprecated and should not be -used on CMake 3.14 or later. +:manual:`Server mode <cmake-server(7)>` was removed as of CMake 3.20 and +should not be used on CMake 3.14 or later. IDEs should avoid creating more build trees than necessary, and only create multiple build trees if the user wishes to switch to a different compiler, diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 0aa4f75..036fa8f 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -20,6 +20,7 @@ These commands are always available. /command/cmake_language /command/cmake_minimum_required /command/cmake_parse_arguments + /command/cmake_path /command/cmake_policy /command/configure_file /command/continue diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index 690d293..96ed5a7 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -89,6 +89,8 @@ Feature requirements are evaluated transitively by consuming the link implementation. See :manual:`cmake-buildsystem(7)` for more on transitive behavior of build properties and usage requirements. +.. _`Requiring Language Standards`: + Requiring Language Standards ---------------------------- diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 13e0d39..26e0c48 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -56,6 +56,7 @@ Environment Variables for Languages /envvar/CC /envvar/CFLAGS /envvar/CSFLAGS + /envvar/CUDAARCHS /envvar/CUDACXX /envvar/CUDAFLAGS /envvar/CUDAHOSTCXX diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 431797f..e108bc3 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -75,7 +75,6 @@ These modules are loaded using the :command:`include` command. /module/CTestUseLaunchers /module/Dart /module/DeployQt4 - /module/Documentation /module/ExternalData /module/ExternalProject /module/FeatureSummary @@ -98,11 +97,8 @@ These modules are loaded using the :command:`include` command. /module/TestForSTDNamespace /module/UseEcos /module/UseJava - /module/UseJavaClassFilelist - /module/UseJavaSymlinks /module/UseSWIG /module/UsewxWidgets - /module/WriteCompilerDetectionHeader Find Modules ^^^^^^^^^^^^ @@ -280,11 +276,15 @@ Deprecated Utility Modules /module/CMakeExpandImportedTargets /module/CMakeForceCompiler /module/CMakeParseArguments + /module/Documentation /module/MacroAddFileDependencies /module/TestCXXAcceptsFlag + /module/UseJavaClassFilelist + /module/UseJavaSymlinks /module/UsePkgConfig /module/Use_wxWindows /module/WriteBasicConfigVersionFile + /module/WriteCompilerDetectionHeader Deprecated Find Modules ======================= diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index fa10f66..bd6b2f0 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,19 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.20 +================================= + +.. toctree:: + :maxdepth: 1 + + CMP0120: The WriteCompilerDetectionHeader module is removed. </policy/CMP0120> + CMP0119: LANGUAGE source file property explicitly compiles as language. </policy/CMP0119> + CMP0118: The GENERATED source file property is now visible in all directories. </policy/CMP0118> + CMP0117: MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default. </policy/CMP0117> + CMP0116: Ninja generators transform DEPFILEs from add_custom_command(). </policy/CMP0116> + CMP0115: Source file extensions must be explicit. </policy/CMP0115> + Policies Introduced by CMake 3.19 ================================= diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index bd6e5c6..33af9f7 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -396,6 +396,10 @@ Properties on Targets /prop_tgt/WIN32_EXECUTABLE /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS /prop_tgt/XCODE_ATTRIBUTE_an-attribute + /prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY + /prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY + /prop_tgt/XCODE_EMBED_type + /prop_tgt/XCODE_EMBED_type_PATH /prop_tgt/XCODE_EXPLICIT_FILE_TYPE /prop_tgt/XCODE_GENERATE_SCHEME /prop_tgt/XCODE_LINK_BUILD_PHASE_MODE diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 8f10b9f..6c8d0f4 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -3,742 +3,5 @@ cmake-server(7) *************** -.. only:: html - - .. contents:: - -.. deprecated:: 3.15 - - This will be removed from a future version of CMake. - Clients should use the :manual:`cmake-file-api(7)` instead. - -Introduction -============ - -:manual:`cmake(1)` is capable of providing semantic information about -CMake code it executes to generate a buildsystem. If executed with -the ``-E server`` command line options, it starts in a long running mode -and allows a client to request the available information via a JSON protocol. - -The protocol is designed to be useful to IDEs, refactoring tools, and -other tools which have a need to understand the buildsystem in entirety. - -A single :manual:`cmake-buildsystem(7)` may describe buildsystem contents -and build properties which differ based on -:manual:`generation-time context <cmake-generator-expressions(7)>` -including: - -* The Platform (eg, Windows, APPLE, Linux). -* The build configuration (eg, Debug, Release, Coverage). -* The Compiler (eg, MSVC, GCC, Clang) and compiler version. -* The language of the source files compiled. -* Available compile features (eg CXX variadic templates). -* CMake policies. - -The protocol aims to provide information to tooling to satisfy several -needs: - -#. Provide a complete and easily parsed source of all information relevant - to the tooling as it relates to the source code. There should be no need - for tooling to parse generated buildsystems to access include directories - or compile definitions for example. -#. Semantic information about the CMake buildsystem itself. -#. Provide a stable interface for reading the information in the CMake cache. -#. Information for determining when cmake needs to be re-run as a result of - file changes. - - -Operation -========= - -Start :manual:`cmake(1)` in the server command mode, supplying the path to -the build directory to process:: - - cmake -E server (--debug|--pipe=<NAMED_PIPE>) - -The server will communicate using stdin/stdout (with the ``--debug`` parameter) -or using a named pipe (with the ``--pipe=<NAMED_PIPE>`` parameter). Note -that "named pipe" refers to a local domain socket on Unix and to a named pipe -on Windows. - -When connecting to the server (via named pipe or by starting it in ``--debug`` -mode), the server will reply with a hello message:: - - [== "CMake Server" ==[ - {"supportedProtocolVersions":[{"major":1,"minor":0}],"type":"hello"} - ]== "CMake Server" ==] - -Messages sent to and from the process are wrapped in magic strings:: - - [== "CMake Server" ==[ - { - ... some JSON message ... - } - ]== "CMake Server" ==] - -The server is now ready to accept further requests via the named pipe -or stdin. - - -Debugging -========= - -CMake server mode can be asked to provide statistics on execution times, etc. -or to dump a copy of the response into a file. This is done passing a "debug" -JSON object as a child of the request. - -The debug object supports the "showStats" key, which takes a boolean and makes -the server mode return a "zzzDebug" object with stats as part of its response. -"dumpToFile" takes a string value and will cause the cmake server to copy -the response into the given filename. - -This is a response from the cmake server with "showStats" set to true:: - - [== "CMake Server" ==[ - { - "cookie":"", - "errorMessage":"Waiting for type \"handshake\".", - "inReplyTo":"unknown", - "type":"error", - "zzzDebug": { - "dumpFile":"/tmp/error.txt", - "jsonSerialization":0.011016, - "size":111, - "totalTime":0.025995 - } - } - ]== "CMake Server" ==] - -The server has made a copy of this response into the file /tmp/error.txt and -took 0.011 seconds to turn the JSON response into a string, and it took 0.025 -seconds to process the request in total. The reply has a size of 111 bytes. - - -Protocol API -============ - - -General Message Layout ----------------------- - -All messages need to have a "type" value, which identifies the type of -message that is passed back or forth. E.g. the initial message sent by the -server is of type "hello". Messages without a type will generate an response -of type "error". - -All requests sent to the server may contain a "cookie" value. This value -will he handed back unchanged in all responses triggered by the request. - -All responses will contain a value "inReplyTo", which may be empty in -case of parse errors, but will contain the type of the request message -in all other cases. - - -Type "reply" -^^^^^^^^^^^^ - -This type is used by the server to reply to requests. - -The message may -- depending on the type of the original request -- -contain values. - -Example:: - - [== "CMake Server" ==[ - {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== "CMake Server" ==] - - -Type "error" -^^^^^^^^^^^^ - -This type is used to return an error condition to the client. It will -contain an "errorMessage". - -Example:: - - [== "CMake Server" ==[ - {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} - ]== "CMake Server" ==] - - -Type "progress" -^^^^^^^^^^^^^^^ - -When the server is busy for a long time, it is polite to send back replies of -type "progress" to the client. These will contain a "progressMessage" with a -string describing the action currently taking place as well as -"progressMinimum", "progressMaximum" and "progressCurrent" with integer values -describing the range of progress. - -Messages of type "progress" will be followed by more "progress" messages or with -a message of type "reply" or "error" that complete the request. - -"progress" messages may not be emitted after the "reply" or "error" message for -the request that triggered the responses was delivered. - - -Type "message" -^^^^^^^^^^^^^^ - -A message is triggered when the server processes a request and produces some -form of output that should be displayed to the user. A Message has a "message" -with the actual text to display as well as a "title" with a suggested dialog -box title. - -Example:: - - [== "CMake Server" ==[ - {"cookie":"","message":"Something happened.","title":"Title Text","inReplyTo":"handshake","type":"message"} - ]== "CMake Server" ==] - - -Type "signal" -^^^^^^^^^^^^^ - -The server can send signals when it detects changes in the system state. Signals -are of type "signal", have an empty "cookie" and "inReplyTo" field and always -have a "name" set to show which signal was sent. - - -Specific Signals ----------------- - -The cmake server may sent signals with the following names: - -"dirty" Signal -^^^^^^^^^^^^^^ - -The "dirty" signal is sent whenever the server determines that the configuration -of the project is no longer up-to-date. This happens when any of the files that have -an influence on the build system is changed. - -The "dirty" signal may look like this:: - - [== "CMake Server" ==[ - { - "cookie":"", - "inReplyTo":"", - "name":"dirty", - "type":"signal"} - ]== "CMake Server" ==] - - -"fileChange" Signal -^^^^^^^^^^^^^^^^^^^ - -The "fileChange" signal is sent whenever a watched file is changed. It contains -the "path" that has changed and a list of "properties" with the kind of change -that was detected. Possible changes are "change" and "rename". - -The "fileChange" signal looks like this:: - - [== "CMake Server" ==[ - { - "cookie":"", - "inReplyTo":"", - "name":"fileChange", - "path":"/absolute/CMakeLists.txt", - "properties":["change"], - "type":"signal"} - ]== "CMake Server" ==] - - -Specific Message Types ----------------------- - - -Type "hello" -^^^^^^^^^^^^ - -The initial message send by the cmake server on startup is of type "hello". -This is the only message ever sent by the server that is not of type "reply", -"progress" or "error". - -It will contain "supportedProtocolVersions" with an array of server protocol -versions supported by the cmake server. These are JSON objects with "major" and -"minor" keys containing non-negative integer values. Some versions may be marked -as experimental. These will contain the "isExperimental" key set to true. Enabling -these requires a special command line argument when starting the cmake server mode. - -Within a "major" version all "minor" versions are fully backwards compatible. -New "minor" versions may introduce functionality in such a way that existing -clients of the same "major" version will continue to work, provided they -ignore keys in the output that they do not know about. - -Example:: - - [== "CMake Server" ==[ - {"supportedProtocolVersions":[{"major":0,"minor":1}],"type":"hello"} - ]== "CMake Server" ==] - - -Type "handshake" -^^^^^^^^^^^^^^^^ - -The first request that the client may send to the server is of type "handshake". - -This request needs to pass one of the "supportedProtocolVersions" of the "hello" -type response received earlier back to the server in the "protocolVersion" field. -Giving the "major" version of the requested protocol version will make the server -use the latest minor version of that protocol. Use this if you do not explicitly -need to depend on a specific minor version. - -Protocol version 1.0 requires the following attributes to be set: - - * "sourceDirectory" with a path to the sources - * "buildDirectory" with a path to the build directory - * "generator" with the generator name - * "extraGenerator" (optional!) with the extra generator to be used - * "platform" with the generator platform (if supported by the generator) - * "toolset" with the generator toolset (if supported by the generator) - -Protocol version 1.2 makes all but the build directory optional, provided -there is a valid cache in the build directory that contains all the other -information already. - -Example:: - - [== "CMake Server" ==[ - {"cookie":"zimtstern","type":"handshake","protocolVersion":{"major":0}, - "sourceDirectory":"/home/code/cmake", "buildDirectory":"/tmp/testbuild", - "generator":"Ninja"} - ]== "CMake Server" ==] - -which will result in a response type "reply":: - - [== "CMake Server" ==[ - {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== "CMake Server" ==] - -indicating that the server is ready for action. - - -Type "globalSettings" -^^^^^^^^^^^^^^^^^^^^^ - -This request can be sent after the initial handshake. It will return a -JSON structure with information on cmake state. - -Example:: - - [== "CMake Server" ==[ - {"type":"globalSettings"} - ]== "CMake Server" ==] - -which will result in a response type "reply":: - - [== "CMake Server" ==[ - { - "buildDirectory": "/tmp/test-build", - "capabilities": { - "generators": [ - { - "extraGenerators": [], - "name": "Watcom WMake", - "platformSupport": false, - "toolsetSupport": false - }, - <...> - ], - "serverMode": false, - "version": { - "isDirty": false, - "major": 3, - "minor": 6, - "patch": 20160830, - "string": "3.6.20160830-gd6abad", - "suffix": "gd6abad" - } - }, - "checkSystemVars": false, - "cookie": "", - "extraGenerator": "", - "generator": "Ninja", - "debugOutput": false, - "inReplyTo": "globalSettings", - "sourceDirectory": "/home/code/cmake", - "trace": false, - "traceExpand": false, - "type": "reply", - "warnUninitialized": false, - "warnUnused": false, - "warnUnusedCli": true - } - ]== "CMake Server" ==] - - -Type "setGlobalSettings" -^^^^^^^^^^^^^^^^^^^^^^^^ - -This request can be sent to change the global settings attributes. Unknown -attributes are going to be ignored. Read-only attributes reported by -"globalSettings" are all capabilities, buildDirectory, generator, -extraGenerator and sourceDirectory. Any attempt to set these will be ignored, -too. - -All other settings will be changed. - -The server will respond with an empty reply message or an error. - -Example:: - - [== "CMake Server" ==[ - {"type":"setGlobalSettings","debugOutput":true} - ]== "CMake Server" ==] - -CMake will reply to this with:: - - [== "CMake Server" ==[ - {"inReplyTo":"setGlobalSettings","type":"reply"} - ]== "CMake Server" ==] - - -Type "configure" -^^^^^^^^^^^^^^^^ - -This request will configure a project for build. - -To configure a build directory already containing cmake files, it is enough to -set "buildDirectory" via "setGlobalSettings". To create a fresh build directory -you also need to set "currentGenerator" and "sourceDirectory" via "setGlobalSettings" -in addition to "buildDirectory". - -You may a list of strings to "configure" via the "cacheArguments" key. These -strings will be interpreted similar to command line arguments related to -cache handling that are passed to the cmake command line client. - -Example:: - - [== "CMake Server" ==[ - {"type":"configure", "cacheArguments":["-Dsomething=else"]} - ]== "CMake Server" ==] - -CMake will reply like this (after reporting progress for some time):: - - [== "CMake Server" ==[ - {"cookie":"","inReplyTo":"configure","type":"reply"} - ]== "CMake Server" ==] - - -Type "compute" -^^^^^^^^^^^^^^ - -This request will generate build system files in the build directory and -is only available after a project was successfully "configure"d. - -Example:: - - [== "CMake Server" ==[ - {"type":"compute"} - ]== "CMake Server" ==] - -CMake will reply (after reporting progress information):: - - [== "CMake Server" ==[ - {"cookie":"","inReplyTo":"compute","type":"reply"} - ]== "CMake Server" ==] - - -Type "codemodel" -^^^^^^^^^^^^^^^^ - -The "codemodel" request can be used after a project was "compute"d successfully. - -It will list the complete project structure as it is known to cmake. - -The reply will contain a key "configurations", which will contain a list of -configuration objects. Configuration objects are used to destinquish between -different configurations the build directory might have enabled. While most -generators only support one configuration, others might support several. - -Each configuration object can have the following keys: - -"name" - contains the name of the configuration. The name may be empty. -"projects" - contains a list of project objects, one for each build project. - -Project objects define one (sub-)project defined in the cmake build system. - -Each project object can have the following keys: - -"name" - contains the (sub-)projects name. -"minimumCMakeVersion" - contains the minimum cmake version allowed for this project, null if the - project doesn't specify one. -"hasInstallRule" - true if the project contains any install rules, false otherwise. -"sourceDirectory" - contains the current source directory -"buildDirectory" - contains the current build directory. -"targets" - contains a list of build system target objects. - -Target objects define individual build targets for a certain configuration. - -Each target object can have the following keys: - -"name" - contains the name of the target. -"type" - defines the type of build of the target. Possible values are - "STATIC_LIBRARY", "MODULE_LIBRARY", "SHARED_LIBRARY", "OBJECT_LIBRARY", - "EXECUTABLE", "UTILITY" and "INTERFACE_LIBRARY". -"fullName" - contains the full name of the build result (incl. extensions, etc.). -"sourceDirectory" - contains the current source directory. -"buildDirectory" - contains the current build directory. -"isGeneratorProvided" - true if the target is auto-created by a generator, false otherwise -"hasInstallRule" - true if the target contains any install rules, false otherwise. -"installPaths" - full path to the destination directories defined by target install rules. -"artifacts" - with a list of build artifacts. The list is sorted with the most - important artifacts first (e.g. a .DLL file is listed before a - .PDB file on windows). -"linkerLanguage" - contains the language of the linker used to produce the artifact. -"linkLibraries" - with a list of libraries to link to. This value is encoded in the - system's native shell format. -"linkFlags" - with a list of flags to pass to the linker. This value is encoded in - the system's native shell format. -"linkLanguageFlags" - with the flags for a compiler using the linkerLanguage. This value is - encoded in the system's native shell format. -"frameworkPath" - with the framework path (on Apple computers). This value is encoded - in the system's native shell format. -"linkPath" - with the link path. This value is encoded in the system's native shell - format. -"sysroot" - with the sysroot path. -"fileGroups" - contains the source files making up the target. - -FileGroups are used to group sources using similar settings together. - -Each fileGroup object may contain the following keys: - -"language" - contains the programming language used by all files in the group. -"compileFlags" - with a string containing all the flags passed to the compiler - when building any of the files in this group. This value is encoded in - the system's native shell format. -"includePath" - with a list of include paths. Each include path is an object - containing a "path" with the actual include path and "isSystem" with a bool - value informing whether this is a normal include or a system include. This - value is encoded in the system's native shell format. -"defines" - with a list of defines in the form "SOMEVALUE" or "SOMEVALUE=42". This - value is encoded in the system's native shell format. -"sources" - with a list of source files. - -All file paths in the fileGroup are either absolute or relative to the -sourceDirectory of the target. - -Example:: - - [== "CMake Server" ==[ - {"type":"codemodel"} - ]== "CMake Server" ==] - -CMake will reply:: - - [== "CMake Server" ==[ - { - "configurations": [ - { - "name": "", - "projects": [ - { - "buildDirectory": "/tmp/build/Source/CursesDialog/form", - "name": "CMAKE_FORM", - "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", - "targets": [ - { - "artifacts": [ "/tmp/build/Source/CursesDialog/form/libcmForm.a" ], - "buildDirectory": "/tmp/build/Source/CursesDialog/form", - "fileGroups": [ - { - "compileFlags": " -std=gnu11", - "defines": [ "CURL_STATICLIB", "LIBARCHIVE_STATIC" ], - "includePath": [ { "path": "/tmp/build/Utilities" }, <...> ], - "isGenerated": false, - "language": "C", - "sources": [ "fld_arg.c", <...> ] - } - ], - "fullName": "libcmForm.a", - "linkerLanguage": "C", - "name": "cmForm", - "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", - "type": "STATIC_LIBRARY" - } - ] - }, - <...> - ] - } - ], - "cookie": "", - "inReplyTo": "codemodel", - "type": "reply" - } - ]== "CMake Server" ==] - - -Type "ctestInfo" -^^^^^^^^^^^^^^^^ - -The "ctestInfo" request can be used after a project was "compute"d successfully. - -It will list the complete project test structure as it is known to cmake. - -The reply will contain a key "configurations", which will contain a list of -configuration objects. Configuration objects are used to destinquish between -different configurations the build directory might have enabled. While most -generators only support one configuration, others might support several. - -Each configuration object can have the following keys: - -"name" - contains the name of the configuration. The name may be empty. -"projects" - contains a list of project objects, one for each build project. - -Project objects define one (sub-)project defined in the cmake build system. - -Each project object can have the following keys: - -"name" - contains the (sub-)projects name. -"ctestInfo" - contains a list of test objects. - -Each test object can have the following keys: - -"ctestName" - contains the name of the test. -"ctestCommand" - contains the test command. -"properties" - contains a list of test property objects. - -Each test property object can have the following keys: - -"key" - contains the test property key. -"value" - contains the test property value. - - -Type "cmakeInputs" -^^^^^^^^^^^^^^^^^^ - -The "cmakeInputs" requests will report files used by CMake as part -of the build system itself. - -This request is only available after a project was successfully -"configure"d. - -Example:: - - [== "CMake Server" ==[ - {"type":"cmakeInputs"} - ]== "CMake Server" ==] - -CMake will reply with the following information:: - - [== "CMake Server" ==[ - {"buildFiles": - [ - {"isCMake":true,"isTemporary":false,"sources":["/usr/lib/cmake/...", ... ]}, - {"isCMake":false,"isTemporary":false,"sources":["CMakeLists.txt", ...]}, - {"isCMake":false,"isTemporary":true,"sources":["/tmp/build/CMakeFiles/...", ...]} - ], - "cmakeRootDirectory":"/usr/lib/cmake", - "sourceDirectory":"/home/code/src/cmake", - "cookie":"", - "inReplyTo":"cmakeInputs", - "type":"reply" - } - ]== "CMake Server" ==] - -All file names are either relative to the top level source directory or -absolute. - -The list of files which "isCMake" set to true are part of the cmake installation. - -The list of files witch "isTemporary" set to true are part of the build directory -and will not survive the build directory getting cleaned out. - - -Type "cache" -^^^^^^^^^^^^ - -The "cache" request will list the cached configuration values. - -Example:: - - [== "CMake Server" ==[ - {"type":"cache"} - ]== "CMake Server" ==] - -CMake will respond with the following output:: - - [== "CMake Server" ==[ - { - "cookie":"","inReplyTo":"cache","type":"reply", - "cache": - [ - { - "key":"SOMEVALUE", - "properties": - { - "ADVANCED":"1", - "HELPSTRING":"This is not helpful" - } - "type":"STRING", - "value":"TEST"} - ] - } - ]== "CMake Server" ==] - -The output can be limited to a list of keys by passing an array of key names -to the "keys" optional field of the "cache" request. - - -Type "fileSystemWatchers" -^^^^^^^^^^^^^^^^^^^^^^^^^ - -The server can watch the filesystem for changes. The "fileSystemWatchers" -command will report on the files and directories watched. - -Example:: - - [== "CMake Server" ==[ - {"type":"fileSystemWatchers"} - ]== "CMake Server" ==] - -CMake will respond with the following output:: - - [== "CMake Server" ==[ - { - "cookie":"","inReplyTo":"fileSystemWatchers","type":"reply", - "watchedFiles": [ "/absolute/path" ], - "watchedDirectories": [ "/absolute" ] - } - ]== "CMake Server" ==] +The :manual:`cmake(1)` server mode has been removed since CMake 3.20. +Clients should use the :manual:`cmake-file-api(7)` instead. diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 88cddf6..0267ca3 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -386,7 +386,8 @@ Configure use of an Android NDK with the following variables: :variable:`CMAKE_ANDROID_ARCH_ABI` Set to the Android ABI (architecture). If not specified, this - variable will default to ``armeabi``. + variable will default to the first supported ABI in the list of + ``armeabi``, ``armeabi-v7a`` and ``arm64-v8a``. The :variable:`CMAKE_ANDROID_ARCH` variable will be computed from ``CMAKE_ANDROID_ARCH_ABI`` automatically. Also see the :variable:`CMAKE_ANDROID_ARM_MODE` and @@ -394,7 +395,6 @@ Configure use of an Android NDK with the following variables: :variable:`CMAKE_ANDROID_NDK` Set to the absolute path to the Android NDK root directory. - A ``${CMAKE_ANDROID_NDK}/platforms`` directory must exist. If not specified, a default for this variable will be chosen as specified :ref:`above <Cross Compiling for Android>`. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index ecf0fa4..4420468 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -336,6 +336,7 @@ Variables that Control the Build /variable/CMAKE_ANDROID_ARM_MODE /variable/CMAKE_ANDROID_ARM_NEON /variable/CMAKE_ANDROID_ASSETS_DIRECTORIES + /variable/CMAKE_ANDROID_EXCEPTIONS /variable/CMAKE_ANDROID_GUI /variable/CMAKE_ANDROID_JAR_DEPENDENCIES /variable/CMAKE_ANDROID_JAR_DIRECTORIES @@ -349,6 +350,7 @@ Variables that Control the Build /variable/CMAKE_ANDROID_PROCESS_MAX /variable/CMAKE_ANDROID_PROGUARD /variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH + /variable/CMAKE_ANDROID_RTTI /variable/CMAKE_ANDROID_SECURE_PROPS_PATH /variable/CMAKE_ANDROID_SKIP_ANT_STEP /variable/CMAKE_ANDROID_STANDALONE_TOOLCHAIN @@ -385,6 +387,7 @@ Variables that Control the Build /variable/CMAKE_DEFAULT_BUILD_TYPE /variable/CMAKE_DEFAULT_CONFIGS /variable/CMAKE_DISABLE_PRECOMPILE_HEADERS + /variable/CMAKE_DEPENDS_USE_COMPILER /variable/CMAKE_ENABLE_EXPORTS /variable/CMAKE_EXE_LINKER_FLAGS /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG @@ -521,6 +524,7 @@ Variables for Languages /variable/CMAKE_LANG_ARCHIVE_APPEND /variable/CMAKE_LANG_ARCHIVE_CREATE /variable/CMAKE_LANG_ARCHIVE_FINISH + /variable/CMAKE_LANG_BYTE_ORDER /variable/CMAKE_LANG_COMPILER /variable/CMAKE_LANG_COMPILER_EXTERNAL_TOOLCHAIN /variable/CMAKE_LANG_COMPILER_ID diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 921f5c4..7efe0cd 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -580,6 +580,7 @@ Available commands are: ``serverMode`` ``true`` if cmake supports server-mode and ``false`` otherwise. + Always false since CMake 3.20. ``cat <files>...`` Concatenate files and print on the standard output. diff --git a/Help/module/UseJavaClassFilelist.rst b/Help/module/UseJavaClassFilelist.rst index b9cd476..29949be 100644 --- a/Help/module/UseJavaClassFilelist.rst +++ b/Help/module/UseJavaClassFilelist.rst @@ -1 +1,6 @@ -.. cmake-module:: ../../Modules/UseJavaClassFilelist.cmake +UseJavaClassFilelist +-------------------- + +.. versionchanged:: 3.20 + This module was previously documented by mistake and was never meant for + direct inclusion by project code. See the :module:`UseJava` module. diff --git a/Help/module/UseJavaSymlinks.rst b/Help/module/UseJavaSymlinks.rst index 2fab8e8..1058a68 100644 --- a/Help/module/UseJavaSymlinks.rst +++ b/Help/module/UseJavaSymlinks.rst @@ -1 +1,6 @@ -.. cmake-module:: ../../Modules/UseJavaSymlinks.cmake +UseJavaSymlinks +--------------- + +.. versionchanged:: 3.20 + This module was previously documented by mistake and was never meant for + direct inclusion by project code. See the :module:`UseJava` module. diff --git a/Help/policy/CMP0115.rst b/Help/policy/CMP0115.rst new file mode 100644 index 0000000..7f82c43 --- /dev/null +++ b/Help/policy/CMP0115.rst @@ -0,0 +1,34 @@ +CMP0115 +------- + +.. versionadded:: 3.20 + +Source file extensions must be explicit. + +In CMake 3.19 and below, if a source file could not be found by the name +specified, it would append a list of known extensions to the name to see if +the file with the extension could be found. For example, this would allow the +user to run: + +.. code-block:: cmake + + add_executable(exe main) + +and put ``main.c`` in the executable without specifying the extension. + +Starting in CMake 3.20, CMake prefers all source files to have their extensions +explicitly listed: + +.. code-block:: cmake + + add_executable(exe main.c) + +The ``OLD`` behavior for this policy is to implicitly append known extensions +to source files if they can't be found. The ``NEW`` behavior of this policy is +to not append known extensions and require them to be explicit. + +This policy was introduced in CMake version 3.20. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0116.rst b/Help/policy/CMP0116.rst new file mode 100644 index 0000000..25a14c4 --- /dev/null +++ b/Help/policy/CMP0116.rst @@ -0,0 +1,38 @@ +CMP0116 +------- + +.. versionadded:: 3.20 + +Ninja generators transform ``DEPFILE`` s from :command:`add_custom_command`. + +In CMake 3.19 and below, files given to the ``DEPFILE`` argument of +:command:`add_custom_command` were passed directly to Ninja's ``depfile`` +variable without any path resolution. This meant that if +:command:`add_custom_command` was called from a subdirectory (created by +:command:`add_subdirectory`), the ``DEPFILE`` argument would have to be either +an absolute path or a path relative to :variable:`CMAKE_BINARY_DIR`, rather +than :variable:`CMAKE_CURRENT_BINARY_DIR`. In addition, no transformation was +done on the file listed in ``DEPFILE``, which meant that the paths within the +``DEPFILE`` had the same restrictions. + +Starting with CMake 3.20, the ``DEPFILE`` argument is relative to +:variable:`CMAKE_CURRENT_BINARY_DIR` (unless it is absolute), and the paths in +the ``DEPFILE`` are also relative to :variable:`CMAKE_CURRENT_BINARY_DIR`. +CMake automatically transforms the paths in the ``DEPFILE`` (unless they are +absolute) after the custom command is run. The file listed in ``DEPFILE`` is +not modified in any way. Instead, CMake writes the transformation to its own +internal file, and passes this internal file to Ninja's ``depfile`` variable. +This transformation happens regardless of whether or not ``DEPFILE`` is +relative, and regardless of whether or not :command:`add_custom_command` is +called from a subdirectory. + +The ``OLD`` behavior for this policy is to pass the ``DEPFILE`` to Ninja +unaltered. The ``NEW`` behavior for this policy is to transform the ``DEPFILE`` +after running the custom command. + +This policy was introduced in CMake version 3.20. Unlike most policies, +CMake version |release| does *not* warn by default when this policy is not set +(unless ``DEPFILE`` is used in a subdirectory) and simply uses ``OLD`` +behavior. See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0116 <CMAKE_POLICY_WARNING_CMP<NNNN>>` +variable to control the warning. diff --git a/Help/policy/CMP0117.rst b/Help/policy/CMP0117.rst new file mode 100644 index 0000000..0c4dd30 --- /dev/null +++ b/Help/policy/CMP0117.rst @@ -0,0 +1,43 @@ +CMP0117 +------- + +.. versionadded:: 3.20 + +MSVC RTTI flag ``/GR`` is not added to +:variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` by default. + +When using MSVC-like compilers in CMake 3.19 and below, the RTTI flag +``/GR`` is added to :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` by +default. This behavior is left from support for MSVC versions from Visual +Studio 2003 and below that did not enable RTTI by default. It is no longer +necessary. Furthermore, it is problematic for projects that want to change +to ``/GR-`` programmatically. In particular, it requires string editing of +the :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` variable with knowledge +of the CMake builtin default so it can be replaced. + +CMake 3.20 and above prefer to leave out ``/GR`` from the value of +:variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` by default. + +This policy provides compatibility with projects that have not been updated +to expect the lack of the ``/GR`` flag. The policy setting takes effect as +of the first :command:`project` or :command:`enable_language` command that +initializes :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>`. + +.. note:: + + Once the policy has taken effect at the top of a project for a given + language, that choice must be used throughout the tree for that language. + In projects that have nested projects in subdirectories, be sure to + convert everything together. + +The ``OLD`` behavior for this policy is to place the MSVC ``/GR`` flag in the +default :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` cache entry. The +``NEW`` behavior for this policy is to *not* place the MSVC ``/GR`` flag in +the default cache entry. + +This policy was introduced in CMake version 3.20. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0118.rst b/Help/policy/CMP0118.rst new file mode 100644 index 0000000..8e71320 --- /dev/null +++ b/Help/policy/CMP0118.rst @@ -0,0 +1,17 @@ +CMP0118 +------- + +The :prop_sf:`GENERATED` source file property is now visible in all directories. + +Whether or not a source file is generated is an all-or-nothing global +property of the source. Consequently, the associated ``GENERATED`` +property is now visible from any directory scope, not only from the scope +for which it was set. + +The ``OLD`` behavior of this policy is to only allow ``GENERATED`` to be +visible from the directory scope for which it was set. The ``NEW`` +behavior on the other hand allows it to be visible from any scope. + +This policy was introduced in CMake version 3.20. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/policy/CMP0119.rst b/Help/policy/CMP0119.rst new file mode 100644 index 0000000..61c8bdc --- /dev/null +++ b/Help/policy/CMP0119.rst @@ -0,0 +1,36 @@ +CMP0119 +------- + +.. versionadded:: 3.20 + +:prop_sf:`LANGUAGE` source file property explicitly compiles as specified +language. + +The :prop_sf:`LANGUAGE` source file property is documented to mean that the +source file is written in the specified language. In CMake 3.19 and below, +setting this property causes CMake to compile the source file using the +compiler for the specified language. However, it only passes an explicit +flag to tell the compiler to treat the source as the specified language +for MSVC-like, XL, and Embarcadero compilers for the ``CXX`` language. +CMake 3.20 and above prefer to also explicitly tell the compiler to use +the specified language using a flag such as ``-x c`` on all compilers +for which such flags are known. + +This policy provides compatibility for projects that have not been updated +to expect this behavior. For example, some projects were setting the +``LANGUAGE`` property to ``C`` on assembly-language ``.S`` source files +in order to compile them using the C compiler. Such projects should be +updated to use ``enable_language(ASM)``, for which CMake will often choose +the C compiler as the assembler on relevant platforms anyway. + +The ``OLD`` behavior for this policy is to interpret the ``LANGUAGE <LANG>`` +property using its undocumented meaning to "use the ``<LANG>`` compiler". +The ``NEW`` behavior for this policy is to interpret the ``LANGUAGE <LANG>`` +property using its documented meaning to "compile as a ``<LANG>`` source". + +This policy was introduced in CMake version 3.20. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0120.rst b/Help/policy/CMP0120.rst new file mode 100644 index 0000000..9d2f6c9 --- /dev/null +++ b/Help/policy/CMP0120.rst @@ -0,0 +1,47 @@ +CMP0120 +------- + +.. versionadded:: 3.20 + +The :module:`WriteCompilerDetectionHeader` module is removed. + +CMake versions 3.1 through 3.19 provide this module to generate a +C++ compatibility layer by re-using information from CMake's table of +preprocessor checks for :manual:`cmake-compile-features(7)`. However: + +* Those granular features have been superseded by meta-features for + :ref:`Requiring Language Standards` such as ``cxx_std_11``. Therefore + no new granular feature checks will be added and projects will need to + use other means to conditionally use new C++ features. + +* The module exposes some of CMake's implementation details directly + to C++ translation units. + +* The module's approach effectively provides a header file with CMake, + thus tying the version of the header to the version of CMake. + Many projects found that the :module:`WriteCompilerDetectionHeader` was + best used by manually generating its header locally with a recent version + of CMake and then bundling it with the project source so that it could + be used with older CMake versions. + +For reasons including the above, CMake 3.20 and above prefer to not +provide the :module:`WriteCompilerDetectionHeader` module. This policy +provides compatibility for projects that have not been ported away from +it. Projects using the module should be updated to stop using it. +Alternatives include: + +* Bundle a copy of the generated header in the project's source. +* Use a third-party alternative, such as the CC0-licensed `Hedley`_. +* Drop support for compilers too old to provide the features natively. + +The ``OLD`` behavior of this policy is for inclusion of the deprecated +:module:`WriteCompilerDetectionHeader` module to work. The ``NEW`` +behavior is for inclusion of the module to fail as if it does not exist. + +This policy was introduced in CMake version 3.20. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt + +.. _`Hedley`: https://nemequ.github.io/hedley/ diff --git a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst index e8e3148..6bbb870 100644 --- a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst @@ -30,3 +30,6 @@ The features known to this version of CMake are: ``cuda_std_20`` Compiler mode is at least CUDA/C++ 20. + +``cuda_std_23`` + Compiler mode is at least CUDA/C++ 23. diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index bac3274..73c0b34 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -37,6 +37,8 @@ but it does not necessarily imply complete conformance to that standard. ``cxx_std_20`` Compiler mode is at least C++ 20. +``cxx_std_23`` + Compiler mode is at least C++ 23. Low level individual compile features ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/prop_sf/GENERATED.rst b/Help/prop_sf/GENERATED.rst index 48ff70c..6ef4580 100644 --- a/Help/prop_sf/GENERATED.rst +++ b/Help/prop_sf/GENERATED.rst @@ -3,6 +3,9 @@ GENERATED Is this source file generated as part of the build or CMake process. +.. versionchanged:: 3.20 + The GENERATED source file property is now visible in all directories. + Tells the internal CMake engine that a source file is generated by an outside process such as another build step, or the execution of CMake itself. This information is then used to exempt the file from any existence or @@ -34,3 +37,11 @@ or :prop_tgt:`AUTORCC` functionality, the :prop_gbl:`AUTOGEN_SOURCE_GROUP`, :prop_gbl:`AUTOMOC_SOURCE_GROUP` and :prop_gbl:`AUTORCC_SOURCE_GROUP` target properties may influence where the generated sources are grouped in the project's file lists. + +.. note:: + + Starting with CMake 3.20 the ``GENERATED`` source file property can be set + and retrieved from any directory scope. It is an all-or-nothing property. + It also can no longer be removed or unset if it was set to ``TRUE``. Policy + :policy:`CMP0118` was introduced to allow supporting the ``OLD`` behavior + for some time. diff --git a/Help/prop_sf/LANGUAGE.rst b/Help/prop_sf/LANGUAGE.rst index 1dd2554..f14c176 100644 --- a/Help/prop_sf/LANGUAGE.rst +++ b/Help/prop_sf/LANGUAGE.rst @@ -1,7 +1,7 @@ LANGUAGE -------- -What programming language is the file. +Specify the programming language in which a source file is written. A property that can be set to indicate what programming language the source file is. If it is not set the language is determined based on @@ -9,3 +9,9 @@ the file extension. Typical values are ``CXX`` (i.e. C++), ``C``, ``CSharp``, ``CUDA``, ``Fortran``, ``ISPC``, and ``ASM``. Setting this property for a file means this file will be compiled. Do not set this for headers or files that should not be compiled. + +.. versionchanged:: 3.20 + Setting this property causes the source file to be compiled as the + specified language, using explicit flags if possible. Previously it + only caused the specified language's compiler to be used. + See policy :policy:`CMP0119`. diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst index fcc4725..6517035 100644 --- a/Help/prop_tgt/CUDA_STANDARD.rst +++ b/Help/prop_tgt/CUDA_STANDARD.rst @@ -9,7 +9,7 @@ This property specifies the CUDA/C++ standard whose features are requested to build this target. For some compilers, this results in adding a flag such as ``-std=gnu++11`` to the compile line. -Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``. +Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst index f322ffe..be0dab5 100644 --- a/Help/prop_tgt/CXX_STANDARD.rst +++ b/Help/prop_tgt/CXX_STANDARD.rst @@ -11,7 +11,7 @@ flag such as ``-std=gnu++11`` to the compile line. For compilers that have no notion of a standard level, such as Microsoft Visual C++ before 2015 Update 3, this has no effect. -Supported values are ``98``, ``11``, ``14``, ``17``, and ``20``. +Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/prop_tgt/LANG_CLANG_TIDY.rst b/Help/prop_tgt/LANG_CLANG_TIDY.rst index 7fc2372..af16d3c 100644 --- a/Help/prop_tgt/LANG_CLANG_TIDY.rst +++ b/Help/prop_tgt/LANG_CLANG_TIDY.rst @@ -3,7 +3,7 @@ .. versionadded:: 3.6 -This property is implemented only when ``<LANG>`` is ``C`` or ``CXX``. +This property is implemented only when ``<LANG>`` is ``C``, ``CXX``, ``OBJC`` or ``OBJCXX``. Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line for the ``clang-tidy`` tool. The :ref:`Makefile Generators` diff --git a/Help/prop_tgt/OBJCXX_STANDARD.rst b/Help/prop_tgt/OBJCXX_STANDARD.rst index 1067153..96088af 100644 --- a/Help/prop_tgt/OBJCXX_STANDARD.rst +++ b/Help/prop_tgt/OBJCXX_STANDARD.rst @@ -9,7 +9,7 @@ This property specifies the ObjC++ standard whose features are requested to build this target. For some compilers, this results in adding a flag such as ``-std=gnu++11`` to the compile line. -Supported values are ``98``, ``11``, ``14``, ``17``, and ``20``. +Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst new file mode 100644 index 0000000..7b68126 --- /dev/null +++ b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst @@ -0,0 +1,8 @@ +XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY +---------------------------------------- + +.. versionadded:: 3.20 + +Tell the :generator:`Xcode` generator to perform code signing for all the +frameworks and libraries that are embedded using the +:prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` property. diff --git a/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst new file mode 100644 index 0000000..29f8c5c --- /dev/null +++ b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst @@ -0,0 +1,8 @@ +XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY +--------------------------------------------- + +.. versionadded:: 3.20 + +Tell the :generator:`Xcode` generator to remove headers from all the +frameworks that are embedded using the +:prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` property. diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst new file mode 100644 index 0000000..90c5bc7 --- /dev/null +++ b/Help/prop_tgt/XCODE_EMBED_type.rst @@ -0,0 +1,14 @@ +XCODE_EMBED_<type> +------------------ + +.. versionadded:: 3.20 + +Tell the :generator:`Xcode` generator to embed the specified list of items into +the target bundle. ``<type>`` specifies the embed build phase to use. + +Currently, the only supported value for ``<type>`` is ``FRAMEWORKS``. +The specified items will be added to the ``Embed Frameworks`` build phase. +The items can be CMake target names or paths to frameworks or libraries. +See also :prop_tgt:`XCODE_EMBED_<type>_PATH`, +:prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` and +:prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY`. diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst new file mode 100644 index 0000000..887cf57 --- /dev/null +++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst @@ -0,0 +1,9 @@ +XCODE_EMBED_<type>_PATH +----------------------- + +.. versionadded:: 3.20 + +Tell the :generator:`Xcode` generator the relative path to use when embedding +the items specified by :prop_tgt:`XCODE_EMBED_<type>`. The path is relative +to the base location of the ``Embed XXX`` build phase associated with +``<type>``. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/ExternalData-suppress-progress.rst b/Help/release/dev/ExternalData-suppress-progress.rst new file mode 100644 index 0000000..bf4183f --- /dev/null +++ b/Help/release/dev/ExternalData-suppress-progress.rst @@ -0,0 +1,6 @@ +ExternalData-suppress-progress +------------------------------ + +* The :module:`ExternalData` module ``ExternalData_add_target`` now supports a + ``SHOW_PROGRESS <bool>`` argument to suppress progress output during the + build. diff --git a/Help/release/dev/FindIntl-imported-target.rst b/Help/release/dev/FindIntl-imported-target.rst new file mode 100644 index 0000000..5770f21 --- /dev/null +++ b/Help/release/dev/FindIntl-imported-target.rst @@ -0,0 +1,4 @@ +FindIntl-imported-target +------------------------ + +* The :module:`FindIntl` module now provides an imported target. diff --git a/Help/release/dev/FindPython-FIND_UNVERSIONED_NAMES.rst b/Help/release/dev/FindPython-FIND_UNVERSIONED_NAMES.rst new file mode 100644 index 0000000..a0b5838 --- /dev/null +++ b/Help/release/dev/FindPython-FIND_UNVERSIONED_NAMES.rst @@ -0,0 +1,6 @@ +FindPython-FIND_UNVERSIONED_NAMES +--------------------------------- + +* Modules :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython` + gain the capability to control how interpreter unversioned names are + searched. diff --git a/Help/release/dev/TestBigEndian-use-abi-result.rst b/Help/release/dev/TestBigEndian-use-abi-result.rst new file mode 100644 index 0000000..1a5bf7f --- /dev/null +++ b/Help/release/dev/TestBigEndian-use-abi-result.rst @@ -0,0 +1,5 @@ +TestBigEndian-use-abi-result +---------------------------- + +* The :module:`TestBigEndian` module has been deprecated in favor + of the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable. diff --git a/Help/release/dev/abi-byte-order.rst b/Help/release/dev/abi-byte-order.rst new file mode 100644 index 0000000..e8beebc --- /dev/null +++ b/Help/release/dev/abi-byte-order.rst @@ -0,0 +1,5 @@ +abi-byte-order +-------------- + +* The :variable:`CMAKE_<LANG>_BYTE_ORDER` variable was added to provide the + target architecture byte order detected from the toolchain. diff --git a/Help/release/dev/android-ndk.rst b/Help/release/dev/android-ndk.rst new file mode 100644 index 0000000..ee4ea5b --- /dev/null +++ b/Help/release/dev/android-ndk.rst @@ -0,0 +1,12 @@ +android-ndk +----------- + +* CMake's support for :ref:`Cross Compiling for Android` + is now merged with the Android NDK's toolchain file. + They now have similar behavior, though some variable names differ. + User-facing changes include: + + - ``find_*`` functions will search NDK ABI / API specific paths by default. + + - The default :variable:`CMAKE_BUILD_TYPE` for Android is + now ``RelWithDebInfo``. diff --git a/Help/release/dev/clang-tidy-objc.rst b/Help/release/dev/clang-tidy-objc.rst new file mode 100644 index 0000000..c899257 --- /dev/null +++ b/Help/release/dev/clang-tidy-objc.rst @@ -0,0 +1,5 @@ +clang-tidy-objc +--------------- + +* The target property :prop_tgt:`<LANG>_CLANG_TIDY` and the associated + variable :variable:`CMAKE_<LANG>_CLANG_TIDY` learned to support OBJC and OBJCXX. diff --git a/Help/release/dev/cmake_path.rst b/Help/release/dev/cmake_path.rst new file mode 100644 index 0000000..9d252ae --- /dev/null +++ b/Help/release/dev/cmake_path.rst @@ -0,0 +1,5 @@ +cmake_path +---------- + +* The :command:`cmake_path` command was added for operations on + filesystem paths. diff --git a/Help/release/dev/configure_file-user-permissions.rst b/Help/release/dev/configure_file-user-permissions.rst new file mode 100644 index 0000000..b757fb1 --- /dev/null +++ b/Help/release/dev/configure_file-user-permissions.rst @@ -0,0 +1,6 @@ +configure_file-user-permissions +------------------------------- + +* The :command:`configure_file` command gained a ``USE_SOURCE_PERMISSIONS`` + and ``FILE_PERMISSIONS`` option to support copying of permissions of source + file and specifying user defined permissions. diff --git a/Help/release/dev/cpack-nsis-utf-8-bom.rst b/Help/release/dev/cpack-nsis-utf-8-bom.rst new file mode 100644 index 0000000..b2a20ce --- /dev/null +++ b/Help/release/dev/cpack-nsis-utf-8-bom.rst @@ -0,0 +1,6 @@ +cpack-nsis-utf8-bom +------------------- + +* The :cpack_gen:`CPack NSIS Generator` now handles correctly Unicode characters. + If you want to have a ``CPACK_RESOURCE_FILE_LICENSE`` with UTF-8 characters + it needs to be encoded in UTF-8 BOM. diff --git a/Help/release/dev/cpack-nuget.rst b/Help/release/dev/cpack-nuget.rst new file mode 100644 index 0000000..2c28b59 --- /dev/null +++ b/Help/release/dev/cpack-nuget.rst @@ -0,0 +1,31 @@ +cpack-nuget +----------- + +* The :cpack_gen:`CPack NuGet Generator` gained options: + + - :variable:`CPACK_NUGET_PACKAGE_ICON` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_ICON` + allow package icons to be specified by local files. + - :variable:`CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_EXPRESSION` add + support for specifying licenses recognized by the + `Software Package Data Exchange`_ (SPDX). + - :variable:`CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSE_FILE_NAME` allow + licenses to be specified by local files. + - :variable:`CPACK_NUGET_PACKAGE_LANGUAGE` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_LANGUAGE` allow the locale + for a package to be specified, for example ``en_CA``. + + Some other variables have been deprecated to reflect changes in the + NuGet specification: + + - :variable:`CPACK_NUGET_PACKAGE_ICONURL` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_ICONURL` have been deprecated; + replace with a reference to a local icon file. + - :variable:`CPACK_NUGET_PACKAGE_LICENSEURL` and + :variable:`CPACK_NUGET_<compName>_PACKAGE_LICENSEURL` have been deprecated; + replace with a reference to the project's license file or SPDX + license expression. + +.. _Software Package Data Exchange: https://spdx.org/ diff --git a/Help/release/dev/cpackifw-package-wizard-show-page-list.rst b/Help/release/dev/cpackifw-package-wizard-show-page-list.rst new file mode 100644 index 0000000..ede69f5 --- /dev/null +++ b/Help/release/dev/cpackifw-package-wizard-show-page-list.rst @@ -0,0 +1,7 @@ +cpackifw-package-wizard-show-page-list +-------------------------------------- + +* The :cpack_gen:`CPack IFW Generator` gained new + :variable:`CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST` variable to + control visibility of the widget listing installer pages on the left side + of the wizard. This feature available only since QtIFW 4.0. diff --git a/Help/release/dev/cpp-cuda-23.rst b/Help/release/dev/cpp-cuda-23.rst new file mode 100644 index 0000000..dc7c3b1 --- /dev/null +++ b/Help/release/dev/cpp-cuda-23.rst @@ -0,0 +1,7 @@ +cpp-cuda-23 +----------- + +* :prop_tgt:`CXX_STANDARD`, :prop_tgt:`CUDA_STANDARD`, + :prop_tgt:`OBJCXX_STANDARD` and the + :manual:`Compile Features <cmake-compile-features(7)>` functionality gained + support for C++23. diff --git a/Help/release/dev/cuda-archs-env.rst b/Help/release/dev/cuda-archs-env.rst new file mode 100644 index 0000000..a2afcbe --- /dev/null +++ b/Help/release/dev/cuda-archs-env.rst @@ -0,0 +1,6 @@ +cuda-archs-env +-------------- + +* The :envvar:`CUDAARCHS` environment variable was added for initializing + :variable:`CMAKE_CUDA_ARCHITECTURES`. Useful in cases where the compiler + default is unsuitable for the machine's GPU. diff --git a/Help/release/dev/explicit-LANGUAGE-flag.rst b/Help/release/dev/explicit-LANGUAGE-flag.rst new file mode 100644 index 0000000..4de4a47 --- /dev/null +++ b/Help/release/dev/explicit-LANGUAGE-flag.rst @@ -0,0 +1,5 @@ +explicit-LANGUAGE-flag +---------------------- + +* The :prop_sf:`LANGUAGE` source file property now forces compilation + as the specified language. See policy :policy:`CMP0119`. diff --git a/Help/release/dev/explicit-source-extensions.rst b/Help/release/dev/explicit-source-extensions.rst new file mode 100644 index 0000000..ccd9339 --- /dev/null +++ b/Help/release/dev/explicit-source-extensions.rst @@ -0,0 +1,5 @@ +explicit-source-extensions +-------------------------- + +* Source file extensions must now be explicit. See policy :policy:`CMP0115` for + details. diff --git a/Help/release/dev/make-GENERATED-visible-from-any-scope.rst b/Help/release/dev/make-GENERATED-visible-from-any-scope.rst new file mode 100644 index 0000000..7757175 --- /dev/null +++ b/Help/release/dev/make-GENERATED-visible-from-any-scope.rst @@ -0,0 +1,7 @@ +make-GENERATED-visible-from-any-scope +------------------------------------- + +* The :prop_sf:`GENERATED` source-file property is now visible + from any directory scope, regardles in which scope or for what + scope it was set. + See policy :policy:`CMP0118`. diff --git a/Help/release/dev/makefiles-dependencies-use-compiler.rst b/Help/release/dev/makefiles-dependencies-use-compiler.rst new file mode 100644 index 0000000..8170cda --- /dev/null +++ b/Help/release/dev/makefiles-dependencies-use-compiler.rst @@ -0,0 +1,5 @@ +makefiles-dependencies-use-compiler +----------------------------------- + +* The :ref:`Makefile Generators` gained the capability, for a selection of + compilers, to use the compiler itself to generate implicit dependencies. diff --git a/Help/release/dev/msvc-no-GR.rst b/Help/release/dev/msvc-no-GR.rst new file mode 100644 index 0000000..e5ca850 --- /dev/null +++ b/Help/release/dev/msvc-no-GR.rst @@ -0,0 +1,7 @@ +msvc-no-GR +---------- + +* With MSVC-like compilers the value of + :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` no longer contains + the ``/GR`` flag for runtime type information by default. + See policy :policy:`CMP0117`. diff --git a/Help/release/dev/ninja-depfile-transformation.rst b/Help/release/dev/ninja-depfile-transformation.rst new file mode 100644 index 0000000..edf7f58 --- /dev/null +++ b/Help/release/dev/ninja-depfile-transformation.rst @@ -0,0 +1,5 @@ +ninja-depfile-transformation +---------------------------- + +* Ninja generators now transform ``DEPFILE`` s from + :command:`add_custom_command`. See policy :policy:`CMP0116` for details. diff --git a/Help/release/dev/remove-WCDH-module.rst b/Help/release/dev/remove-WCDH-module.rst new file mode 100644 index 0000000..4ea951a --- /dev/null +++ b/Help/release/dev/remove-WCDH-module.rst @@ -0,0 +1,5 @@ +remove-WCDH-module +------------------ + +* The :module:`WriteCompilerDetectionHeader` module has been deprecated + via policy :policy:`CMP0120`. Projects should be ported away from it. diff --git a/Help/release/dev/remove-server-mode.rst b/Help/release/dev/remove-server-mode.rst new file mode 100644 index 0000000..7c986b1 --- /dev/null +++ b/Help/release/dev/remove-server-mode.rst @@ -0,0 +1,5 @@ +remove-server-mode +------------------ + +* The :manual:`cmake-server(7)` mode has been removed. + Clients should use the :manual:`cmake-file-api(7)` instead. diff --git a/Help/release/dev/target-sources-supports-custom-target.rst b/Help/release/dev/target-sources-supports-custom-target.rst new file mode 100644 index 0000000..131fb3a --- /dev/null +++ b/Help/release/dev/target-sources-supports-custom-target.rst @@ -0,0 +1,4 @@ +target-sources-supports-custom-target +------------------------------------- + +* The :command:`target_sources` now supports custom targets. diff --git a/Help/release/dev/xcode-embed-frameworks.rst b/Help/release/dev/xcode-embed-frameworks.rst new file mode 100644 index 0000000..5573fcb --- /dev/null +++ b/Help/release/dev/xcode-embed-frameworks.rst @@ -0,0 +1,9 @@ +xcode-embed-frameworks +---------------------- + +* When using the Xcode generator, it is now possible to embed frameworks + using the new :prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` + target property. Aspects of the embedding can be customized with the + :prop_tgt:`XCODE_EMBED_FRAMEWORKS_PATH <XCODE_EMBED_<type>>`, + :prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY` and + :prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` target properties. diff --git a/Help/release/index.rst b/Help/release/index.rst index 6fb0f1a..a8329a6 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -7,6 +7,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Help/variable/CMAKE_ANDROID_EXCEPTIONS.rst b/Help/variable/CMAKE_ANDROID_EXCEPTIONS.rst new file mode 100644 index 0000000..6dd44f8 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_EXCEPTIONS.rst @@ -0,0 +1,7 @@ +CMAKE_ANDROID_EXCEPTIONS +------------------------ + +.. versionadded:: 3.20 + +When :ref:`Cross Compiling for Android with the NDK`, this variable may be set +to specify whether exceptions are enabled. diff --git a/Help/variable/CMAKE_ANDROID_RTTI.rst b/Help/variable/CMAKE_ANDROID_RTTI.rst new file mode 100644 index 0000000..0e98206 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_RTTI.rst @@ -0,0 +1,7 @@ +CMAKE_ANDROID_RTTI +------------------ + +.. versionadded:: 3.20 + +When :ref:`Cross Compiling for Android with the NDK`, this variable may be set +to specify whether RTTI is enabled. diff --git a/Help/variable/CMAKE_BUILD_TYPE.rst b/Help/variable/CMAKE_BUILD_TYPE.rst index 2d35635..405f7d5 100644 --- a/Help/variable/CMAKE_BUILD_TYPE.rst +++ b/Help/variable/CMAKE_BUILD_TYPE.rst @@ -18,3 +18,8 @@ in a build tree configured to build type ``Debug``, CMake will see to having :variable:`CMAKE_C_FLAGS_DEBUG <CMAKE_<LANG>_FLAGS_DEBUG>` settings get added to the :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` settings. See also :variable:`CMAKE_CONFIGURATION_TYPES`. + +Note that configuration names are case-insensitive. The value of this +variable will be the same as it is specified when invoking CMake. +For instance, if ``-DCMAKE_BUILD_TYPE=ReLeAsE`` is specified, then the +value of ``CMAKE_BUILD_TYPE`` will be ``ReLeAsE``. diff --git a/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst index 985040d..7f7e679 100644 --- a/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst +++ b/Help/variable/CMAKE_CUDA_ARCHITECTURES.rst @@ -5,7 +5,8 @@ CMAKE_CUDA_ARCHITECTURES Default value for :prop_tgt:`CUDA_ARCHITECTURES` property of targets. -This is initialized as follows depending on :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>`: +Initialized by the :envvar:`CUDAARCHS` environment variable if set. +Otherwise as follows depending on :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>`: - For ``Clang``: the oldest architecture that works. diff --git a/Help/variable/CMAKE_DEPENDS_USE_COMPILER.rst b/Help/variable/CMAKE_DEPENDS_USE_COMPILER.rst new file mode 100644 index 0000000..bdad59e --- /dev/null +++ b/Help/variable/CMAKE_DEPENDS_USE_COMPILER.rst @@ -0,0 +1,9 @@ +CMAKE_DEPENDS_USE_COMPILER +-------------------------- + +.. versionadded:: 3.20 + +For the :ref:`Makefile Generators`, source dependencies are now, for a +selection of compilers, generated by the compiler itself. By defining this +variable with value ``FALSE``, you can restore the legacy behavior (i.e. using +``CMake`` for dependencies discovery). diff --git a/Help/variable/CMAKE_LANG_BYTE_ORDER.rst b/Help/variable/CMAKE_LANG_BYTE_ORDER.rst new file mode 100644 index 0000000..78f0ae6 --- /dev/null +++ b/Help/variable/CMAKE_LANG_BYTE_ORDER.rst @@ -0,0 +1,20 @@ +CMAKE_<LANG>_BYTE_ORDER +----------------------- + +.. versionadded:: 3.20 + +Byte order of ``<LANG>`` compiler target architecture, if known. +If defined and not empty, the value is one of: + +``BIG_ENDIAN`` + The target architecture is Big Endian. + +``LITTLE_ENDIAN`` + The target architecture is Little Endian. + +This is defined for languages ``C``, ``CXX``, ``OBJC``, ``OBJCXX``, +and ``CUDA``. + +If :variable:`CMAKE_OSX_ARCHITECTURES` specifies multiple architectures, the +value of ``CMAKE_<LANG>_BYTE_ORDER`` is non-empty only if all architectures +share the same byte order. diff --git a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst index 78f0f6a..32e27b0 100644 --- a/Help/variable/CMAKE_LANG_CLANG_TIDY.rst +++ b/Help/variable/CMAKE_LANG_CLANG_TIDY.rst @@ -4,7 +4,7 @@ CMAKE_<LANG>_CLANG_TIDY .. versionadded:: 3.6 Default value for :prop_tgt:`<LANG>_CLANG_TIDY` target property -when ``<LANG>`` is ``C`` or ``CXX``. +when ``<LANG>`` is ``C``, ``CXX``, ``OBJC`` or ``OBJCXX``. This variable is used to initialize the property on each target as it is created. For example: diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index d35595a..9f68741 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -27,6 +27,8 @@ warn by default: policy :policy:`CMP0102`. * ``CMAKE_POLICY_WARNING_CMP0112`` controls the warning for policy :policy:`CMP0112`. +* ``CMAKE_POLICY_WARNING_CMP0116`` controls the warning for + policy :policy:`CMP0116`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index f521d22..0beff04 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -59,9 +59,10 @@ fix each one up according to its own list of prerequisites. Then clear all the keys and call ``verify_app`` on the final bundle to ensure that it is truly standalone. -As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, -which are then ignored -(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``). +.. versionadded:: 3.6 + As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, + which are then ignored + (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``). .. code-block:: cmake @@ -78,9 +79,10 @@ Verifies that an application ``<app>`` appears valid based on running analysis tools on it. Calls :command:`message(FATAL_ERROR)` if the application is not verified. -As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, -which are then ignored -(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) +.. versionadded:: 3.6 + As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, + which are then ignored + (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake @@ -155,9 +157,10 @@ them. Set values associated with each key such that we can loop over all of them and copy prerequisite libs into the bundle and then do appropriate ``install_name_tool`` fixups. -As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, -which are then ignored -(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) +.. versionadded:: 3.6 + As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, + which are then ignored + (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake @@ -215,9 +218,10 @@ Verifies that the sum of all prerequisites of all files inside the bundle are contained within the bundle or are ``system`` libraries, presumed to exist everywhere. -As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, -which are then ignored -(e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) +.. versionadded:: 3.6 + As an optional parameter (``IGNORE_ITEM``) a list of file names can be passed, + which are then ignored + (e.g. ``IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe"``) .. code-block:: cmake diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index eea3f5d..7f73891 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -48,6 +48,7 @@ set(CMAKE_C_LINKER_PREFERENCE 10) # Save compiler ABI information. set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@") set(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@") +set(CMAKE_C_BYTE_ORDER "@CMAKE_C_BYTE_ORDER@") set(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") if(CMAKE_C_SIZEOF_DATA_PTR) diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c index 08cf39b..f0ee21a 100644 --- a/Modules/CMakeCCompilerABI.c +++ b/Modules/CMakeCCompilerABI.c @@ -17,6 +17,8 @@ int main(int argc, char* argv[]) { int require = 0; require += info_sizeof_dptr[argc]; + require += info_byte_order_big_endian[argc]; + require += info_byte_order_little_endian[argc]; #if defined(ABI_ID) require += info_abi[argc]; #endif diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 871e18e..56ae732 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -12,6 +12,7 @@ set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@") set(CMAKE_CUDA14_COMPILE_FEATURES "@CMAKE_CUDA14_COMPILE_FEATURES@") set(CMAKE_CUDA17_COMPILE_FEATURES "@CMAKE_CUDA17_COMPILE_FEATURES@") set(CMAKE_CUDA20_COMPILE_FEATURES "@CMAKE_CUDA20_COMPILE_FEATURES@") +set(CMAKE_CUDA23_COMPILE_FEATURES "@CMAKE_CUDA23_COMPILE_FEATURES@") set(CMAKE_CUDA_PLATFORM_ID "@CMAKE_CUDA_PLATFORM_ID@") set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@") @@ -31,6 +32,7 @@ set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1) set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@") set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@") +set(CMAKE_CUDA_BYTE_ORDER "@CMAKE_CUDA_BYTE_ORDER@") set(CMAKE_CUDA_LIBRARY_ARCHITECTURE "@CMAKE_CUDA_LIBRARY_ARCHITECTURE@") if(CMAKE_CUDA_SIZEOF_DATA_PTR) diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu index 702a7c5..449a079 100644 --- a/Modules/CMakeCUDACompilerABI.cu +++ b/Modules/CMakeCUDACompilerABI.cu @@ -8,6 +8,8 @@ int main(int argc, char* argv[]) { int require = 0; require += info_sizeof_dptr[argc]; + require += info_byte_order_big_endian[argc]; + require += info_byte_order_little_endian[argc]; #if defined(ABI_ID) require += info_abi[argc]; #endif diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in index 2055de2..91039e5 100644 --- a/Modules/CMakeCUDACompilerId.cu.in +++ b/Modules/CMakeCUDACompilerId.cu.in @@ -17,7 +17,9 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; @CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@ const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if __cplusplus > 201703L +#if __cplusplus > 202002L + "23" +#elif __cplusplus > 201703L "20" #elif __cplusplus >= 201703L "17" diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 58e6e29..cb03ef4 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -154,21 +154,6 @@ if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION) "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>") endif() -if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA) - set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o $DEP_FILE") - #The Ninja generator uses the make file dependency files to determine what - #files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building - #a source file and generating the dependencies of said file in a single - #invocation. Instead we have to state that you need to chain two commands. - # - #The makefile generators uses the custom CMake dependency scanner, and thus - #it is exempt from this logic. - list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") - list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") - list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}") -endif() - # compile a cu file into an executable if(NOT CMAKE_CUDA_LINK_EXECUTABLE) set(CMAKE_CUDA_LINK_EXECUTABLE diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 09bdc23..92ae2ab 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -11,6 +11,7 @@ set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@") set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@") set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@") set(CMAKE_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_COMPILE_FEATURES@") +set(CMAKE_CXX23_COMPILE_FEATURES "@CMAKE_CXX23_COMPILE_FEATURES@") set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@") @@ -60,6 +61,7 @@ set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) # Save compiler ABI information. set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@") set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@") +set(CMAKE_CXX_BYTE_ORDER "@CMAKE_CXX_BYTE_ORDER@") set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") if(CMAKE_CXX_SIZEOF_DATA_PTR) diff --git a/Modules/CMakeCXXCompilerABI.cpp b/Modules/CMakeCXXCompilerABI.cpp index 2360534..036b96e 100644 --- a/Modules/CMakeCXXCompilerABI.cpp +++ b/Modules/CMakeCXXCompilerABI.cpp @@ -8,6 +8,8 @@ int main(int argc, char* argv[]) { int require = 0; require += info_sizeof_dptr[argc]; + require += info_byte_order_big_endian[argc]; + require += info_byte_order_little_endian[argc]; #if defined(ABI_ID) require += info_abi[argc]; #endif diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 672fff8..49d9f0a 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -44,7 +44,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if CXX_STD > 201703L +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L "20" #elif CXX_STD >= 201703L "17" diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 45532af..c5ce4dd 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -9,6 +9,18 @@ const char info_sizeof_dptr[] = { /* clang-format on */ }; +/* Byte order. Only one of these will have bytes in the right order. */ +static unsigned short const info_byte_order_big_endian[] = { + /* INFO:byte_order string for BIG_ENDIAN */ + 0x494E, 0x464F, 0x3A62, 0x7974, 0x655F, 0x6F72, 0x6465, 0x725B, + 0x4249, 0x475F, 0x454E, 0x4449, 0x414E, 0x5D00, 0x0000 +}; +static unsigned short const info_byte_order_little_endian[] = { + /* INFO:byte_order string for LITTLE_ENDIAN */ + 0x4E49, 0x4F46, 0x623A, 0x7479, 0x5F65, 0x726F, 0x6564, 0x5B72, + 0x494C, 0x5454, 0x454C, 0x455F, 0x444E, 0x4149, 0x5D4E, 0x0000 +}; + /* Application Binary Interface. */ /* Check for (some) ARM ABIs. diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 972adef..578729c 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -47,6 +47,10 @@ if(NOT $ENV{CUDAHOSTCXX} STREQUAL "") endif() endif() +if(NOT "$ENV{CUDAARCHS}" STREQUAL "") + set(CMAKE_CUDA_ARCHITECTURES "$ENV{CUDAARCHS}" CACHE STRING "CUDA architectures") +endif() + # Build a small source file to identify the compiler. if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(CMAKE_CUDA_COMPILER_ID_RUN 1) diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index b50e5f1..c03a85f 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -50,6 +50,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX14_COMPILE_FEATURES) set(CMAKE_CXX17_COMPILE_FEATURES) set(CMAKE_CXX20_COMPILE_FEATURES) + set(CMAKE_CXX23_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -60,6 +61,9 @@ function(cmake_determine_compile_features lang) return() endif() + if (CMAKE_CXX20_COMPILE_FEATURES AND CMAKE_CXX23_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES}) + endif() if (CMAKE_CXX17_COMPILE_FEATURES AND CMAKE_CXX20_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES}) endif() @@ -80,6 +84,7 @@ function(cmake_determine_compile_features lang) ${CMAKE_CXX14_COMPILE_FEATURES} ${CMAKE_CXX17_COMPILE_FEATURES} ${CMAKE_CXX20_COMPILE_FEATURES} + ${CMAKE_CXX23_COMPILE_FEATURES} ) endif() @@ -89,6 +94,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE) message(CHECK_PASS "done") @@ -100,6 +106,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CUDA14_COMPILE_FEATURES) set(CMAKE_CUDA17_COMPILE_FEATURES) set(CMAKE_CUDA20_COMPILE_FEATURES) + set(CMAKE_CUDA23_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -110,7 +117,10 @@ function(cmake_determine_compile_features lang) return() endif() - if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES) + if (CMAKE_CUDA20_COMPILE_FEATURES AND CMAKE_CUDA23_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES}) + endif() + if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES}) endif() if (CMAKE_CUDA14_COMPILE_FEATURES AND CMAKE_CUDA17_COMPILE_FEATURES) @@ -130,6 +140,7 @@ function(cmake_determine_compile_features lang) ${CMAKE_CUDA14_COMPILE_FEATURES} ${CMAKE_CUDA17_COMPILE_FEATURES} ${CMAKE_CUDA20_COMPILE_FEATURES} + ${CMAKE_CUDA23_COMPILE_FEATURES} ) endif() @@ -139,6 +150,7 @@ function(cmake_determine_compile_features lang) set(CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES} PARENT_SCOPE) message(CHECK_PASS "done") diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 7e5b375..67c42a2a 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -75,12 +75,25 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) message(CHECK_PASS "done") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n") - file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") + file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 32 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") + set(ABI_SIZEOF_DPTR "NOTFOUND") + set(ABI_BYTE_ORDER "NOTFOUND") + set(ABI_NAME "NOTFOUND") foreach(info ${ABI_STRINGS}) - if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]") + if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]" AND NOT ABI_SIZEOF_DPTR) set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]") + if("${info}" MATCHES "INFO:byte_order\\[(BIG_ENDIAN|LITTLE_ENDIAN)\\]") + set(byte_order "${CMAKE_MATCH_1}") + if(ABI_BYTE_ORDER STREQUAL "NOTFOUND") + # Tentatively use the value because this is the first occurrence. + set(ABI_BYTE_ORDER "${byte_order}") + elseif(NOT ABI_BYTE_ORDER STREQUAL "${byte_order}") + # Drop value because multiple occurrences do not match. + set(ABI_BYTE_ORDER "") + endif() + endif() + if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]" AND NOT ABI_NAME) set(ABI_NAME "${CMAKE_MATCH_1}") endif() endforeach() @@ -91,6 +104,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE) endif() + if(ABI_BYTE_ORDER) + set(CMAKE_${lang}_BYTE_ORDER "${ABI_BYTE_ORDER}" PARENT_SCOPE) + endif() + if(ABI_NAME) set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) endif() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 937a120..8cf161f 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -152,7 +152,10 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") endif() - if(CMAKE_GENERATOR MATCHES "^Ninja" AND MSVC_${lang}_ARCHITECTURE_ID) + if((CMAKE_GENERATOR MATCHES "^Ninja" + OR ((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")) + AND MSVC_${lang}_ARCHITECTURE_ID) foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "") CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang} "${userflags}") endforeach() @@ -276,6 +279,16 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) + # Executable names have choosen according documentation + # URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler") + set(id_cl dpcpp.exe) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler 2021") + set(id_cl icx.exe) + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "C\\+\\+ Compiler") + set(id_cl icl.exe) + endif() else() set(id_cl cl.exe) endif() @@ -310,9 +323,6 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>") else() set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") - set(id_cl icl.exe) - endif() if(CMAKE_VS_PLATFORM_TOOLSET_VERSION) set(id_sep "\\") if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20") diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index be4a3be..7086722 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -29,8 +29,9 @@ Graphviz package: dot -Tpng -o foo.png foo.dot -The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE`` -are represented as solid, dashed and dotted edges. +.. versionadded:: 3.10 + The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE`` + are represented as solid, dashed and dotted edges. Variables specific to the Graphviz support ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 1555517..608adce 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -45,6 +45,7 @@ endforeach() # Save compiler ABI information. set(CMAKE_OBJC_SIZEOF_DATA_PTR "@CMAKE_OBJC_SIZEOF_DATA_PTR@") set(CMAKE_OBJC_COMPILER_ABI "@CMAKE_OBJC_COMPILER_ABI@") +set(CMAKE_OBJC_BYTE_ORDER "@CMAKE_OBJC_BYTE_ORDER@") set(CMAKE_OBJC_LIBRARY_ARCHITECTURE "@CMAKE_OBJC_LIBRARY_ARCHITECTURE@") if(CMAKE_OBJC_SIZEOF_DATA_PTR) diff --git a/Modules/CMakeOBJCCompilerABI.m b/Modules/CMakeOBJCCompilerABI.m index 8fa8511..0726cd3 100644 --- a/Modules/CMakeOBJCCompilerABI.m +++ b/Modules/CMakeOBJCCompilerABI.m @@ -12,6 +12,8 @@ int main(int argc, char *argv[]) { int require = 0; require += info_sizeof_dptr[argc]; + require += info_byte_order_big_endian[argc]; + require += info_byte_order_little_endian[argc]; #if defined(ABI_ID) require += info_abi[argc]; #endif diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index b6452c4..a24582b 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -11,6 +11,7 @@ set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@") set(CMAKE_OBJCXX14_COMPILE_FEATURES "@CMAKE_OBJCXX14_COMPILE_FEATURES@") set(CMAKE_OBJCXX17_COMPILE_FEATURES "@CMAKE_OBJCXX17_COMPILE_FEATURES@") set(CMAKE_OBJCXX20_COMPILE_FEATURES "@CMAKE_OBJCXX20_COMPILE_FEATURES@") +set(CMAKE_OBJCXX23_COMPILE_FEATURES "@CMAKE_OBJCXX23_COMPILE_FEATURES@") set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@") set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@") @@ -55,6 +56,7 @@ set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1) # Save compiler ABI information. set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@") set(CMAKE_OBJCXX_COMPILER_ABI "@CMAKE_OBJCXX_COMPILER_ABI@") +set(CMAKE_OBJCXX_BYTE_ORDER "@CMAKE_OBJCXX_BYTE_ORDER@") set(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@") if(CMAKE_OBJCXX_SIZEOF_DATA_PTR) diff --git a/Modules/CMakeOBJCXXCompilerABI.mm b/Modules/CMakeOBJCXXCompilerABI.mm index 288a58c..7b9fefc 100644 --- a/Modules/CMakeOBJCXXCompilerABI.mm +++ b/Modules/CMakeOBJCXXCompilerABI.mm @@ -12,6 +12,8 @@ int main(int argc, char *argv[]) { int require = 0; require += info_sizeof_dptr[argc]; + require += info_byte_order_big_endian[argc]; + require += info_byte_order_little_endian[argc]; #if defined(ABI_ID) require += info_abi[argc]; #endif diff --git a/Modules/CMakeOBJCXXCompilerId.mm.in b/Modules/CMakeOBJCXXCompilerId.mm.in index fe04de1..e2ac35d 100644 --- a/Modules/CMakeOBJCXXCompilerId.mm.in +++ b/Modules/CMakeOBJCXXCompilerId.mm.in @@ -30,7 +30,9 @@ char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif const char* info_language_dialect_default = "INFO" ":" "dialect_default[" -#if CXX_STD > 201703L +#if CXX_STD > 202002L + "23" +#elfif CXX_STD > 201703L "20" #elif CXX_STD >= 201703L "17" diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 1a7f9cf..372e9f4 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -81,13 +81,14 @@ always relative to the installed location of the package. This works both for relative and also for absolute locations. For absolute locations it works only if the absolute location is a subdirectory of ``INSTALL_PREFIX``. -If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to -calculate all the relative paths. The ``<path>`` argument must be an absolute -path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX` -variable will be used instead. The default value is good when generating a -FooConfig.cmake file to use your package from the install tree. When -generating a FooConfig.cmake file to use your package from the build tree this -option should be used. +.. versionadded:: 3.1 + If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to + calculate all the relative paths. The ``<path>`` argument must be an absolute + path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX` + variable will be used instead. The default value is good when generating a + FooConfig.cmake file to use your package from the install tree. When + generating a FooConfig.cmake file to use your package from the build tree this + option should be used. By default ``configure_package_config_file`` also generates two helper macros, ``set_and_check()`` and ``check_required_components()`` into the @@ -159,22 +160,27 @@ If your project has more elaborated version matching rules, you will need to write your own custom ``ConfigVersion.cmake`` file instead of using this macro. -.. note:: ``COMPATIBILITY_MODE`` ``AnyNewerVersion`` handles the version range - if any is specified (see :command:`find_package` command for the details). - All other modes are incompatible with version ranges and will display an - author warning if one is specified. +.. versionadded:: 3.11 + The ``SameMinorVersion`` compatibility mode. -If ``ARCH_INDEPENDENT`` is given, the installed package version will be -considered compatible even if it was built for a different architecture than -the requested architecture. Otherwise, an architecture check will be performed, -and the package will be considered compatible only if the architecture matches -exactly. For example, if the package is built for a 32-bit architecture, the -package is only considered compatible if it is used on a 32-bit architecture, -unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered -compatible on any architecture. +.. versionadded:: 3.14 + If ``ARCH_INDEPENDENT`` is given, the installed package version will be + considered compatible even if it was built for a different architecture than + the requested architecture. Otherwise, an architecture check will be performed, + and the package will be considered compatible only if the architecture matches + exactly. For example, if the package is built for a 32-bit architecture, the + package is only considered compatible if it is used on a 32-bit architecture, + unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered + compatible on any architecture. .. note:: ``ARCH_INDEPENDENT`` is intended for header-only libraries or similar - packages with no binaries. + packages with no binaries. + +.. versionadded:: 3.19 + ``COMPATIBILITY_MODE`` ``AnyNewerVersion`` handles the version range + if any is specified (see :command:`find_package` command for the details). + All other modes are incompatible with version ranges and will display an + author warning if one is specified. Internally, this macro executes :command:`configure_file()` to create the resulting version file. Depending on the ``COMPATIBILITY``, the corresponding diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 7529a1f..eb1d43b 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -194,6 +194,8 @@ installers. The most commonly-used variables are: .. variable:: CPACK_PACKAGE_CHECKSUM + .. versionadded:: 3.7 + An algorithm that will be used to generate an additional file with the checksum of the package. The output file name will be:: @@ -271,6 +273,8 @@ installers. The most commonly-used variables are: .. variable:: CPACK_VERBATIM_VARIABLES + .. versionadded:: 3.4 + If set to ``TRUE``, values of variables prefixed with ``CPACK_`` will be escaped before being written to the configuration files, so that the cpack program receives them exactly as they were specified. If not, characters @@ -356,6 +360,8 @@ The following variables are for advanced uses of CPack: .. variable:: CPACK_INSTALL_SCRIPTS + .. versionadded:: 3.16 + Extra CMake scripts executed by CPack during its local staging installation. They are executed before installing the files to be packaged. The scripts are not called by a standalone install (e.g.: ``make install``). @@ -372,6 +378,8 @@ The following variables are for advanced uses of CPack: .. variable:: CPACK_PRE_BUILD_SCRIPTS + .. versionadded:: 3.19 + List of CMake scripts to execute after CPack has installed the files to be packaged into a staging directory and before producing the package(s) from those files. See also :variable:`CPACK_INSTALL_SCRIPTS` and @@ -379,6 +387,8 @@ The following variables are for advanced uses of CPack: .. variable:: CPACK_POST_BUILD_SCRIPTS + .. versionadded:: 3.19 + List of CMake scripts to execute after CPack has produced the resultant packages and before copying them back to the build directory. See also :variable:`CPACK_INSTALL_SCRIPTS`, @@ -386,6 +396,8 @@ The following variables are for advanced uses of CPack: .. variable:: CPACK_PACKAGE_FILES + .. versionadded:: 3.19 + List of package files created in the staging directory, with each file provided as a full absolute path. This variable is populated by CPack just before invoking the post-build scripts listed in diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 6ce0bfc..d57cf18 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -51,20 +51,28 @@ The module defines the following commands: of a group to which it belongs. ``ESSENTIAL`` + .. versionadded:: 3.6 + if set, then the package manager stays disabled until that component is updated. ``VIRTUAL`` + .. versionadded:: 3.8 + if set, then the component will be hidden from the installer. It is a equivalent of the ``HIDDEN`` option from the :command:`cpack_add_component` command. ``FORCED_INSTALLATION`` + .. versionadded:: 3.8 + if set, then the component must always be installed. It is a equivalent of the ``REQUIRED`` option from the :command:`cpack_add_component` command. ``REQUIRES_ADMIN_RIGHTS`` + .. versionadded:: 3.8 + set it if the component needs to be installed with elevated permissions. ``NAME`` @@ -72,14 +80,20 @@ The module defines the following commands: By default used origin component name. ``DISPLAY_NAME`` + .. versionadded:: 3.8 + set to rewrite original name configured by :command:`cpack_add_component` command. ``DESCRIPTION`` + .. versionadded:: 3.8 + set to rewrite original description configured by :command:`cpack_add_component` command. ``UPDATE_TEXT`` + .. versionadded:: 3.8 + will be added to the component description if this is an update to the component. @@ -88,22 +102,32 @@ The module defines the following commands: By default used :variable:`CPACK_PACKAGE_VERSION`. ``RELEASE_DATE`` + .. versionadded:: 3.8 + keep empty to auto generate. ``SCRIPT`` is a relative or absolute path to operations script for this component. - ``PRIORITY`` | ``SORTING_PRIORITY`` + ``SORTING_PRIORITY`` + .. versionadded:: 3.8 + is priority of the component in the tree. - The ``PRIORITY`` option is deprecated and will be removed in a future - version of CMake. Please use ``SORTING_PRIORITY`` option instead. - ``DEPENDS`` | ``DEPENDENCIES`` + ``PRIORITY`` + .. deprecated:: 3.8 + Old name for ``SORTING_PRIORITY``. + + ``DEPENDS``, ``DEPENDENCIES`` + .. versionadded:: 3.8 + list of dependency component or component group identifiers in QtIFW style. ``AUTO_DEPEND_ON`` + .. versionadded:: 3.8 + list of identifiers of component or component group in QtIFW style that this component has an automatic dependency on. @@ -112,21 +136,31 @@ The module defines the following commands: component. You can specify more then one license. ``DEFAULT`` + .. versionadded:: 3.8 + Possible values are: TRUE, FALSE, and SCRIPT. Set to FALSE to disable the component in the installer or to SCRIPT to resolved during runtime (don't forget add the file of the script as a value of the ``SCRIPT`` option). ``USER_INTERFACES`` + .. versionadded:: 3.7 + is a list of <file_path> ('.ui' files) representing pages to load. ``TRANSLATIONS`` + .. versionadded:: 3.8 + is a list of <file_path> ('.qm' files) representing translations to load. ``REPLACES`` + .. versionadded:: 3.10 + list of identifiers of component or component group to replace. ``CHECKABLE`` + .. versionadded:: 3.10 + Possible values are: TRUE, FALSE. Set to FALSE if you want to hide the checkbox for an item. This is useful when only a few subcomponents should be selected @@ -162,13 +196,19 @@ The module defines the following commands: command. ``VIRTUAL`` + .. versionadded:: 3.8 + if set, then the group will be hidden from the installer. Note that setting this on a root component does not work. ``FORCED_INSTALLATION`` + .. versionadded:: 3.8 + if set, then the group must always be installed. ``REQUIRES_ADMIN_RIGHTS`` + .. versionadded:: 3.8 + set it if the component group needs to be installed with elevated permissions. @@ -177,14 +217,20 @@ The module defines the following commands: By default used origin component group name. ``DISPLAY_NAME`` + .. versionadded:: 3.8 + set to rewrite original name configured by :command:`cpack_add_component_group` command. ``DESCRIPTION`` + .. versionadded:: 3.8 + set to rewrite original description configured by :command:`cpack_add_component_group` command. ``UPDATE_TEXT`` + .. versionadded:: 3.8 + will be added to the component group description if this is an update to the component group. @@ -193,22 +239,30 @@ The module defines the following commands: By default used :variable:`CPACK_PACKAGE_VERSION`. ``RELEASE_DATE`` + .. versionadded:: 3.8 + keep empty to auto generate. ``SCRIPT`` is a relative or absolute path to operations script for this component group. - ``PRIORITY`` | ``SORTING_PRIORITY`` + ``SORTING_PRIORITY`` is priority of the component group in the tree. - The ``PRIORITY`` option is deprecated and will be removed in a future - version of CMake. Please use ``SORTING_PRIORITY`` option instead. - ``DEPENDS`` | ``DEPENDENCIES`` + ``PRIORITY`` + .. deprecated:: 3.8 + Old name for ``SORTING_PRIORITY``. + + ``DEPENDS``, ``DEPENDENCIES`` + .. versionadded:: 3.8 + list of dependency component or component group identifiers in QtIFW style. ``AUTO_DEPEND_ON`` + .. versionadded:: 3.8 + list of identifiers of component or component group in QtIFW style that this component group has an automatic dependency on. @@ -217,6 +271,8 @@ The module defines the following commands: component group. You can specify more then one license. ``DEFAULT`` + .. versionadded:: 3.8 + Possible values are: TRUE, FALSE, and SCRIPT. Set to TRUE to preselect the group in the installer (this takes effect only on groups that have no visible child components) @@ -224,15 +280,23 @@ The module defines the following commands: the script as a value of the ``SCRIPT`` option). ``USER_INTERFACES`` + .. versionadded:: 3.7 + is a list of <file_path> ('.ui' files) representing pages to load. ``TRANSLATIONS`` + .. versionadded:: 3.8 + is a list of <file_path> ('.qm' files) representing translations to load. ``REPLACES`` + .. versionadded:: 3.10 + list of identifiers of component or component group to replace. ``CHECKABLE`` + .. versionadded:: 3.10 + Possible values are: TRUE, FALSE. Set to FALSE if you want to hide the checkbox for an item. This is useful when only a few subcomponents should be selected @@ -272,6 +336,8 @@ The module defines the following commands: .. command:: cpack_ifw_update_repository + .. versionadded:: 3.6 + Update QtIFW specific repository from remote repository. :: @@ -307,6 +373,8 @@ The module defines the following commands: .. command:: cpack_ifw_add_package_resources + .. versionadded:: 3.7 + Add additional resources in the installer binary. :: diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 8265bd2..8f8ebb4 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -121,15 +121,6 @@ if(BUILD_TESTING) string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_LOCATION}") endif() - find_program(CVSCOMMAND cvs ) - set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING - "Options passed to the cvs update command.") - find_program(SVNCOMMAND svn) - find_program(BZRCOMMAND bzr) - find_program(HGCOMMAND hg) - find_program(GITCOMMAND git) - find_program(P4COMMAND p4) - if(NOT UPDATE_TYPE) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") set(UPDATE_TYPE cvs) @@ -146,21 +137,29 @@ if(BUILD_TESTING) string(TOLOWER "${UPDATE_TYPE}" _update_type) if("${_update_type}" STREQUAL "cvs") + find_program(CVSCOMMAND cvs ) + set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING + "Options passed to the cvs update command.") set(UPDATE_COMMAND "${CVSCOMMAND}") set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") elseif("${_update_type}" STREQUAL "svn") + find_program(SVNCOMMAND svn) set(UPDATE_COMMAND "${SVNCOMMAND}") set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") elseif("${_update_type}" STREQUAL "bzr") + find_program(BZRCOMMAND bzr) set(UPDATE_COMMAND "${BZRCOMMAND}") set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") elseif("${_update_type}" STREQUAL "hg") + find_program(HGCOMMAND hg) set(UPDATE_COMMAND "${HGCOMMAND}") set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") elseif("${_update_type}" STREQUAL "git") + find_program(GITCOMMAND git) set(UPDATE_COMMAND "${GITCOMMAND}") set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") elseif("${_update_type}" STREQUAL "p4") + find_program(P4COMMAND p4) set(UPDATE_COMMAND "${P4COMMAND}") set(UPDATE_OPTIONS "${P4_UPDATE_OPTIONS}") endif() @@ -179,12 +178,6 @@ if(BUILD_TESTING) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" DOC "Path to the memory checking command, used for memory error detection." ) - find_program(SLURM_SBATCH_COMMAND sbatch DOC - "Path to the SLURM sbatch executable" - ) - find_program(SLURM_SRUN_COMMAND srun DOC - "Path to the SLURM srun executable" - ) set(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH "File that contains suppressions for the memory checker") find_program(COVERAGE_COMMAND gcov DOC @@ -194,7 +187,14 @@ if(BUILD_TESTING) "Extra command line flags to pass to the coverage tool") # set the site name - site_name(SITE) + if(COMMAND cmake_host_system_information) + cmake_host_system_information(RESULT _ctest_hostname QUERY HOSTNAME) + set(SITE "${_ctest_hostname}" CACHE STRING "Name of the computer/site where compile is being run") + unset(_ctest_hostname) + else() + # This code path is needed for CMake itself during bootstrap. + site_name(SITE) + endif() # set the build name if(NOT BUILDNAME) set(DART_COMPILER "${CMAKE_CXX_COMPILER}") @@ -256,8 +256,6 @@ if(BUILD_TESTING) MAKECOMMAND MEMORYCHECK_COMMAND MEMORYCHECK_SUPPRESSIONS_FILE - SLURM_SBATCH_COMMAND - SLURM_SRUN_COMMAND SITE SVNCOMMAND ) diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index a01a2fe..a6fa3a4 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -39,7 +39,10 @@ After generating this tar file, it can be sent to CDash for display with the upload to CDash. Relative paths will be interpreted with respect to the top-level build directory. - ``TARBALL_COMPRESSION <option>`` Specify a compression algorithm for the + ``TARBALL_COMPRESSION <option>`` + .. versionadded:: 3.18 + + Specify a compression algorithm for the ``TARBALL`` data file. Using this option reduces the size of the data file before it is submitted to CDash. ``<option>`` must be one of ``GZIP``, ``BZIP2``, ``XZ``, ``ZSTD``, ``FROM_EXT``, or an expression that CMake @@ -68,15 +71,23 @@ After generating this tar file, it can be sent to CDash for display with the If not specified, the default option is just ``-b -x``. ``GLOB`` + .. versionadded:: 3.6 + Recursively search for .gcda files in build_dir rather than determining search locations by reading TargetDirectories.txt. ``DELETE`` + .. versionadded:: 3.6 + Delete coverage files after they've been packaged into the .tar. ``QUIET`` Suppress non-error messages that otherwise would have been printed out by this function. + + .. versionadded:: 3.3 + Added support for the :variable:`CTEST_CUSTOM_COVERAGE_EXCLUDE` variable. + #]=======================================================================] function(ctest_coverage_collect_gcov) diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake index 3dff926..23a206b 100644 --- a/Modules/CTestUseLaunchers.cmake +++ b/Modules/CTestUseLaunchers.cmake @@ -24,9 +24,12 @@ long as your CMakeLists uses include(CTest) or include(CTestUseLaunchers), it will use the value of the ENV variable to initialize a CTEST_USE_LAUNCHERS cache variable. This cache variable initialization only occurs if CTEST_USE_LAUNCHERS is not -already defined. If CTEST_USE_LAUNCHERS is on in a ctest -S script -the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE -to the cmake command used to configure the project. +already defined. + +.. versionadded:: 3.8 + If CTEST_USE_LAUNCHERS is on in a ctest -S script + the ctest_configure command will add -DCTEST_USE_LAUNCHERS:BOOL=TRUE + to the cmake command used to configure the project. #]=======================================================================] if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT}) diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 698a007..b24da49 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -44,6 +44,8 @@ Check if given C source compiles and links into an executable. directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link command (see :command:`try_compile` for further details). @@ -54,6 +56,8 @@ Check if given C source compiles and links into an executable. further details). ``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index a99e47e..a6081ff 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -43,6 +43,8 @@ subsequently be run. directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link command (see :command:`try_run` for further details). @@ -53,6 +55,8 @@ subsequently be run. further details). ``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index dc209b2..502bfa7 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -44,6 +44,8 @@ Check if given C++ source compiles and links into an executable. directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link command (see :command:`try_compile` for further details). @@ -54,6 +56,8 @@ Check if given C++ source compiles and links into an executable. further details). ``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index c8ff3d7..af03453 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -43,6 +43,8 @@ subsequently be run. directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link command (see :command:`try_run` for further details). @@ -53,6 +55,8 @@ subsequently be run. further details). ``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + If this variable evaluates to a boolean true value, all status messages associated with the check will be suppressed. diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index 5c9079d..b4da4fa 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -49,12 +49,14 @@ the way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. For example: diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index d06203f..ad72e2f 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -24,8 +24,9 @@ The following variables may be set before calling this macro to modify the way the check is run: ``CMAKE_REQUIRED_LINK_OPTIONS`` - A :ref:`;-list <CMake Language Lists>` of options to add to the link - command (see :command:`try_compile` for further details). + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link + command (see :command:`try_compile` for further details). ``CMAKE_REQUIRED_LIBRARIES`` A :ref:`;-list <CMake Language Lists>` of libraries to add to the link diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index 5ede284..e134329 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -65,6 +65,8 @@ Check if given Fortran source compiles and links into an executable. directory property will be ignored. ``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + A :ref:`;-list <CMake Language Lists>` of options to add to the link command (see :command:`try_compile` for further details). diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 136da89..9efa132 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -28,12 +28,14 @@ way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. .. note:: diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 1dd951d..0bc3c92 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -33,6 +33,9 @@ property. It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so module will return error in this case. See policy :policy:`CMP0069` for details. +.. versionadded:: 3.13 + Add support for Visual Studio generators. + Examples ^^^^^^^^ diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 3a10473..71ddde7 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -29,12 +29,14 @@ the way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. See the :module:`CheckIncludeFiles` module to check for multiple headers at once. See the :module:`CheckIncludeFileCXX` module to check for headers diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 496550f..953224e 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -29,12 +29,14 @@ the way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles` to check for one or more ``C`` headers. diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 8e10cd6..1800ca8 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -35,12 +35,14 @@ the way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX` to check for a single header file in ``C`` or ``CXX`` languages. diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 44387d4..928881c 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -68,6 +68,11 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" else() set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") endif() + if(CMAKE_TOOLCHAIN_FILE) + set(_D_CMAKE_TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}") + else() + set(_D_CMAKE_TOOLCHAIN_FILE "") + endif() execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang} COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} @@ -75,6 +80,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" -T "${CMAKE_GENERATOR_TOOLSET}" ${_D_CMAKE_GENERATOR_INSTANCE} ${_D_CMAKE_MAKE_PROGRAM} + ${_D_CMAKE_TOOLCHAIN_FILE} OUTPUT_VARIABLE _cl_output ERROR_VARIABLE _cl_output RESULT_VARIABLE _cl_result diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 6470dfd..804e0cb 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -26,13 +26,18 @@ Check if the function exists. The following variables may be set before calling this macro to modify the way the check is run: -:: - - CMAKE_REQUIRED_FLAGS = string of compile command line flags - CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) - CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command - CMAKE_REQUIRED_LIBRARIES = list of libraries to link - CMAKE_REQUIRED_QUIET = execute quietly without messages +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 8b06403..d29c5e8 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -35,14 +35,20 @@ Check if the prototype we expect is correct. The following variables may be set before calling this function to modify the way the check is run: -:: - - CMAKE_REQUIRED_FLAGS = string of compile command line flags - CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) - CMAKE_REQUIRED_INCLUDES = list of include directories - CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command - CMAKE_REQUIRED_LIBRARIES = list of libraries to link - CMAKE_REQUIRED_QUIET = execute quietly without messages +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + list of include directories. +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. #]=======================================================================] # diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 842a8fd..8217c84 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -23,18 +23,23 @@ Check if the given struct or class has the specified member variable <language> - the compiler to use (C or CXX) - The following variables may be set before calling this macro to modify the way the check is run: -:: - - CMAKE_REQUIRED_FLAGS = string of compile command line flags - CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) - CMAKE_REQUIRED_INCLUDES = list of include directories - CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command - CMAKE_REQUIRED_LIBRARIES = list of libraries to link - CMAKE_REQUIRED_QUIET = execute quietly without messages +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + list of include directories. +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. Example: diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 4f202c4..f8ca584 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -39,12 +39,14 @@ the way the check is run: a :ref:`;-list <CMake Language Lists>` of header search paths to pass to the compiler. ``CMAKE_REQUIRED_LINK_OPTIONS`` - a :ref:`;-list <CMake Language Lists>` of options to add to the link command. + .. versionadded:: 3.14 + a :ref:`;-list <CMake Language Lists>` of options to add to the link command. ``CMAKE_REQUIRED_LIBRARIES`` a :ref:`;-list <CMake Language Lists>` of libraries to add to the link command. See policy :policy:`CMP0075`. ``CMAKE_REQUIRED_QUIET`` - execute quietly without messages. + .. versionadded:: 3.1 + execute quietly without messages. For example: diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 17beadc..69f68f9 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -57,19 +57,25 @@ member you can do something like this: check_type_size("((struct something*)0)->member" SIZEOF_MEMBER) - The following variables may be set before calling this macro to modify the way the check is run: -:: - - CMAKE_REQUIRED_FLAGS = string of compile command line flags - CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) - CMAKE_REQUIRED_INCLUDES = list of include directories - CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command - CMAKE_REQUIRED_LIBRARIES = list of libraries to link - CMAKE_REQUIRED_QUIET = execute quietly without messages - CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_INCLUDES`` + list of include directories. +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. +``CMAKE_EXTRA_INCLUDE_FILES`` + list of extra headers to include. #]=======================================================================] include(CheckIncludeFile) diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 8a93535..7420124 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -26,13 +26,18 @@ Check if the variable exists. The following variables may be set before calling this macro to modify the way the check is run: -:: - - CMAKE_REQUIRED_FLAGS = string of compile command line flags - CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) - CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command - CMAKE_REQUIRED_LIBRARIES = list of libraries to link - CMAKE_REQUIRED_QUIET = execute quietly without messages +``CMAKE_REQUIRED_FLAGS`` + string of compile command line flags. +``CMAKE_REQUIRED_DEFINITIONS`` + list of macros to define (-DFOO=bar). +``CMAKE_REQUIRED_LINK_OPTIONS`` + .. versionadded:: 3.14 + list of options to pass to link command. +``CMAKE_REQUIRED_LIBRARIES`` + list of libraries to link. +``CMAKE_REQUIRED_QUIET`` + .. versionadded:: 3.1 + execute quietly without messages. #]=======================================================================] include_guard(GLOBAL) diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake index f949568..f4f1854 100644 --- a/Modules/Compiler/ARMCC.cmake +++ b/Modules/Compiler/ARMCC.cmake @@ -33,7 +33,7 @@ macro(__compiler_armcc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>") - set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers") + set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEP_FILE> --depend_single_line --no_depend_system_headers") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") endmacro() diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 2794f52..bd98193 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -1,6 +1,19 @@ include(Compiler/Clang) __compiler_clang(C) + +if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) + endif() +endif() + +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 15edc21..28be1df 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -1,7 +1,17 @@ include(Compiler/Clang) __compiler_clang(CXX) +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + endif() + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/AppleClang-OBJC.cmake b/Modules/Compiler/AppleClang-OBJC.cmake index d1f3706..d4eab4f 100644 --- a/Modules/Compiler/AppleClang-OBJC.cmake +++ b/Modules/Compiler/AppleClang-OBJC.cmake @@ -1,5 +1,14 @@ include(Compiler/Clang-OBJC) +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles" + AND CMAKE_DEPFILE_FLAGS_OBJC) + # dependencies are computed by the compiler itself + set(CMAKE_OBJC_DEPFILE_FORMAT gcc) + set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE) +endif() + + if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake index 409bd4a..172a343 100644 --- a/Modules/Compiler/AppleClang-OBJCXX.cmake +++ b/Modules/Compiler/AppleClang-OBJCXX.cmake @@ -1,5 +1,15 @@ include(Compiler/Clang-OBJCXX) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles" + AND CMAKE_DEPFILE_FLAGS_OBJCXX) + # dependencies are computed by the compiler itself + set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc) + set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE) +endif() + + set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0) diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index 409b65a..cd897c5 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -93,21 +93,14 @@ endmacro() # Define to allow compile features to be automatically determined macro(cmake_record_cxx_compile_features) set(_result 0) + if(_result EQUAL 0 AND DEFINED CMAKE_CXX23_STANDARD_COMPILE_OPTION) + _has_compiler_features_cxx(23) + endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION) - if(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) - _has_compiler_features_cxx(20) - else() - _record_compiler_features_cxx(20) - endif() - unset(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(20) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION) - if(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) - _has_compiler_features_cxx(17) - else() - _record_compiler_features_cxx(17) - endif() - unset(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(17) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION) if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) @@ -137,21 +130,14 @@ endmacro() macro(cmake_record_cuda_compile_features) set(_result 0) + if(_result EQUAL 0 AND DEFINED CMAKE_CUDA23_STANDARD_COMPILE_OPTION) + _has_compiler_features_cuda(23) + endif() if(_result EQUAL 0 AND DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION) - if(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT) - _has_compiler_features_cuda(20) - else() - _record_compiler_features_cuda(20) - endif() - unset(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cuda(20) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CUDA17_STANDARD_COMPILE_OPTION) - if(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT) - _has_compiler_features_cuda(17) - else() - _record_compiler_features_cuda(17) - endif() - unset(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cuda(17) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CUDA14_STANDARD_COMPILE_OPTION) if(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 7c4a263..5609abf 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -7,7 +7,22 @@ if(APPLE AND NOT appleClangPolicy STREQUAL NEW) endif() if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC) set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) + endif() +elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) + endif() endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake index fd8c2b7..cafc7dd 100644 --- a/Modules/Compiler/Clang-CUDA.cmake +++ b/Modules/Compiler/Clang-CUDA.cmake @@ -2,7 +2,13 @@ include(Compiler/Clang) __compiler_clang(CUDA) # Set explicitly, because __compiler_clang() doesn't set this if we're simulating MSVC. -set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_CUDA_DEPFILE_FORMAT gcc) + set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE) +endif() # C++03 isn't supported for CXX, but is for CUDA, so we need to set these manually. # Do this before __compiler_clang_cxx_standards() since that adds the feature. diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 789e991..98828e0 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -3,6 +3,15 @@ __compiler_clang(CXX) __compiler_clang_cxx_standards(CXX) if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + endif() + + set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() @@ -13,4 +22,9 @@ endif() if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles" + AND CMAKE_DEPFILE_FLAGS_CXX) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + endif() endif() diff --git a/Modules/Compiler/Clang-OBJC.cmake b/Modules/Compiler/Clang-OBJC.cmake index c61c497..19179e3 100644 --- a/Modules/Compiler/Clang-OBJC.cmake +++ b/Modules/Compiler/Clang-OBJC.cmake @@ -1,6 +1,15 @@ include(Compiler/Clang) __compiler_clang(OBJC) +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJC) + # dependencies are computed by the compiler itself + set(CMAKE_OBJC_DEPFILE_FORMAT gcc) + set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE) +endif() + + if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_OBJC90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_OBJC90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/Clang-OBJCXX.cmake b/Modules/Compiler/Clang-OBJCXX.cmake index 453b5fd..9bdff66 100644 --- a/Modules/Compiler/Clang-OBJCXX.cmake +++ b/Modules/Compiler/Clang-OBJCXX.cmake @@ -1,3 +1,11 @@ include(Compiler/Clang) __compiler_clang(OBJCXX) __compiler_clang_cxx_standards(OBJCXX) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJCXX) + # dependencies are computed by the compiler itself + set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc) + set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE) +endif() diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 27692c2..9f900df 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -155,10 +155,6 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") endif() - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 6.0) - set(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT ON) - endif() - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20") @@ -169,6 +165,11 @@ macro(__compiler_clang_cxx_standards lang) unset(_clang_version_std17) + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b") + set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") + endif() + if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC") # The MSVC standard library requires C++14, and MSVC itself has no # notion of operating in a mode not aware of at least that standard. @@ -180,8 +181,6 @@ macro(__compiler_clang_cxx_standards lang) # This clang++ is missing some features because of MSVC compatibility. unset(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT) unset(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT) - unset(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT) - unset(CMAKE_${lang}20_STANDARD__HAS_FULL_SUPPORT) endif() __compiler_check_default_language_standard(${lang} 2.1 98) @@ -221,6 +220,8 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "") set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "") set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "") + set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "") + set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "") # There is no meaningful default for this set(CMAKE_${lang}_STANDARD_DEFAULT "") @@ -236,6 +237,7 @@ macro(__compiler_clang_cxx_standards lang) cxx_std_14 cxx_std_17 cxx_std_20 + cxx_std_23 ) _record_compiler_features(${lang} "" CMAKE_${lang}_COMPILE_FEATURES) endmacro() diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake index 94af401..a935416 100644 --- a/Modules/Compiler/GNU-ASM.cmake +++ b/Modules/Compiler/GNU-ASM.cmake @@ -6,7 +6,7 @@ set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm) __compiler_gnu(ASM) if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH STREQUAL "GNU assembler") - set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_ASM${ASM_DIALECT} "--MD <DEP_FILE>") set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_DEFINE_FLAG "--defsym ") diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index ca286b3..86b4d83 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1,6 +1,17 @@ include(Compiler/GNU) __compiler_gnu(C) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index fcaaeab..758d3c7 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1,6 +1,17 @@ include(Compiler/GNU) __compiler_gnu(CXX) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (WIN32) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport") diff --git a/Modules/Compiler/GNU-OBJC.cmake b/Modules/Compiler/GNU-OBJC.cmake index fb9b0b2..7eeed83 100644 --- a/Modules/Compiler/GNU-OBJC.cmake +++ b/Modules/Compiler/GNU-OBJC.cmake @@ -1,2 +1,11 @@ include(Compiler/GNU) __compiler_gnu(OBJC) + + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJC) + # dependencies are computed by the compiler itself + set(CMAKE_OBJC_DEPFILE_FORMAT gcc) + set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE) +endif() diff --git a/Modules/Compiler/GNU-OBJCXX.cmake b/Modules/Compiler/GNU-OBJCXX.cmake index 06f0244..1047b5d 100644 --- a/Modules/Compiler/GNU-OBJCXX.cmake +++ b/Modules/Compiler/GNU-OBJCXX.cmake @@ -1,6 +1,15 @@ include(Compiler/GNU) __compiler_gnu(OBJCXX) +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJCXX) + # dependencies are computed by the compiler itself + set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc) + set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE) +endif() + + if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.2) set(CMAKE_OBJCXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 81ab3a2..928e726 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -48,7 +48,7 @@ macro(__compiler_gnu lang) # distcc does not transform -o to -MT when invoking the preprocessor # internally, as it ought to. Work around this bug by setting -MT here # even though it isn't strictly necessary. - set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") endif() # Initial configuration flags. diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index f3938a9..b8c0770 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -49,7 +49,7 @@ macro(__compiler_iar_ilink lang) set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ") - set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEP_FILE>") string(APPEND CMAKE_${lang}_FLAGS_INIT " ") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r") @@ -85,7 +85,7 @@ macro(__compiler_iar_xlink lang) set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${CMAKE_IAR_${lang}_FLAG} --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -lAH <ASSEMBLY_SOURCE> -o <OBJECT>.dummy") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ") - set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "--dependencies=ns <DEP_FILE>") string(APPEND CMAKE_${lang}_FLAGS_INIT " ") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -r") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index ec3bfd8..ead9069 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -5,10 +5,17 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC) set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) @@ -28,6 +35,8 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") else() + set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index b71b946..37f339a 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -5,7 +5,13 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") @@ -42,6 +48,8 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") else() + set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") diff --git a/Modules/Compiler/Intel-ISPC.cmake b/Modules/Compiler/Intel-ISPC.cmake index aa9ecea..be64cf7 100644 --- a/Modules/Compiler/Intel-ISPC.cmake +++ b/Modules/Compiler/Intel-ISPC.cmake @@ -3,7 +3,13 @@ include(Compiler/CMakeCommonCompilerMacros) # Not aware of any verbose flag for ISPC #set(CMAKE_ISPC_VERBOSE_FLAG ) -set(CMAKE_DEPFILE_FLAGS_ISPC "-M -MT <OBJECT> -MF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_ISPC "-M -MT <DEP_TARGET> -MF <DEP_FILE>") +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_ISPC_DEPFILE_FORMAT gcc) + set(CMAKE_ISPC_DEPENDS_USE_COMPILER TRUE) +endif() string(APPEND CMAKE_ISPC_FLAGS_INIT " ") string(APPEND CMAKE_ISPC_FLAGS_DEBUG_INIT "-O0 -g") diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index 31ae7fd..9a5104b 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -27,6 +27,7 @@ else() set(CMAKE_C_STANDARD_DEFAULT "") endif() +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -TC) set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") # There are no C compiler modes so we hard-code the known compiler supported diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index 95a51f6..eb80675 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -28,7 +28,14 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # The -MD flag was only added to nvcc in 10.2 so # before that we had to invoke the compiler twice # to get header dependency information - set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") +else() + set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>") +endif() +set(CMAKE_CUDA_DEPFILE_FORMAT gcc) +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE) endif() if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index 2d7a303..3254353 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -18,7 +18,6 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions) - set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() endif() diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index 10e1389..7fbfd10 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -14,7 +14,7 @@ macro(__compiler_qcc lang) set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "-Wc,-isysroot,") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEPFILE> -Wp,-MT,<OBJECT> -Wp,-MF,<DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEP_FILE> -Wp,-MT,<DEP_TARGET> -Wp,-MF,<DEP_FILE>") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 7e962b8..c98656f 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -22,7 +22,7 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_C "-xMD -xMF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_C "-xMD -xMF <DEP_FILE>") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index c946c64..aa8a9c5 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -22,7 +22,7 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -xO2 -xspace -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -xO3 -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_CXX "-xMD -xMF <DEPFILE>") +set(CMAKE_DEPFILE_FLAGS_CXX "-xMD -xMF <DEP_FILE>") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake index f631688..c8c1635 100644 --- a/Modules/Compiler/TI.cmake +++ b/Modules/Compiler/TI.cmake @@ -18,7 +18,7 @@ macro(__compiler_ti lang) set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=") set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=") - set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=<DEP_FILE>") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> --preproc_only ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> --compile_only --skip_assembler ${__COMPILER_TI_SOURCE_FLAG_${lang}}=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index fc71ab4..8b9d4a9 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -30,5 +30,5 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") - set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEPFILE> -qmakedep=gcc") + set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEP_FILE> -qmakedep=gcc") endmacro() diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake index 54c18a6..1668a4d 100644 --- a/Modules/Compiler/XLClang-C.cmake +++ b/Modules/Compiler/XLClang-C.cmake @@ -1,6 +1,8 @@ include(Compiler/XLClang) __compiler_xlclang(C) +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index 9ea3d7c..02638c7 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -1,6 +1,8 @@ include(Compiler/XLClang) __compiler_xlclang(CXX) +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 90a56e2..e5b1e5d 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -83,10 +83,6 @@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ CoverageCommand: @COVERAGE_COMMAND@ CoverageExtraFlags: @COVERAGE_EXTRA_FLAGS@ -# Cluster commands -SlurmBatchCommand: @SLURM_SBATCH_COMMAND@ -SlurmRunCommand: @SLURM_SRUN_COMMAND@ - # Testing options # TimeOut is the amount of time in seconds to wait for processes # to complete during testing. After TimeOut seconds, the diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index c297231..2430f85 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -5,6 +5,9 @@ Documentation ------------- +.. deprecated:: 3.18 + This module does nothing, unless policy :policy:`CMP0106` is set to ``OLD``. + This module provides support for the VTK documentation framework. It relies on several tools (Doxygen, Perl, etc). #]=======================================================================] diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 6fe8685..d6fbae9 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -78,7 +78,8 @@ Module Functions manage local instances of data files stored externally:: ExternalData_Add_Target( - <target> # Name of data management target + <target> # Name of data management target + [SHOW_PROGRESS <ON|OFF>] # Show progress during the download ) It creates custom commands in the target as necessary to make data @@ -89,6 +90,12 @@ Module Functions in one of the paths specified in the ``ExternalData_OBJECT_STORES`` variable. + .. versionadded:: 3.20 + The ``SHOW_PROGRESS`` argument may be passed to suppress progress information + during the download of objects. If not provided, it defaults to ``OFF`` for + :generator:`Ninja` and :generator:`Ninja Multi-Config` generators and ``ON`` + otherwise. + Typically only one target is needed to manage all external data within a project. Call this function once at the end of configuration after all data references have been processed. @@ -108,6 +115,8 @@ calling any of the functions provided by this module. .. variable:: ExternalData_CUSTOM_SCRIPT_<key> + .. versionadded:: 3.2 + Specify a full path to a ``.cmake`` custom fetch script identified by ``<key>`` in entries of the ``ExternalData_URL_TEMPLATES`` list. See `Custom Fetch Scripts`_. @@ -126,6 +135,8 @@ calling any of the functions provided by this module. .. variable:: ExternalData_NO_SYMLINKS + .. versionadded:: 3.3 + The real data files named by expanded ``DATA{}`` references may be made available under ``ExternalData_BINARY_ROOT`` using symbolic links on some platforms. The ``ExternalData_NO_SYMLINKS`` variable may be set @@ -171,6 +182,8 @@ calling any of the functions provided by this module. .. variable:: ExternalData_URL_ALGO_<algo>_<key> + .. versionadded:: 3.3 + Specify a custom URL component to be substituted for URL template placeholders of the form ``%(algo:<key>)``, where ``<key>`` is a valid C identifier, when fetching an object referenced via hash @@ -201,10 +214,11 @@ For example, the argument ``DATA{img.png}`` may be satisfied by either a real ``img.png`` file in the current source directory or a ``img.png.md5`` file containing its MD5 sum. -Multiple content links of the same name with different hash algorithms -are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as -they all correspond to the same real file. This allows objects to be -fetched from sources indexed by different hash algorithms. +.. versionadded:: 3.8 + Multiple content links of the same name with different hash algorithms + are supported (e.g. ``img.png.sha256`` and ``img.png.sha1``) so long as + they all correspond to the same real file. This allows objects to be + fetched from sources indexed by different hash algorithms. Referencing File Series """"""""""""""""""""""" @@ -263,8 +277,11 @@ associated file options. For example, the argument ``DATA{MyDataDir/,REGEX:.*}`` will pass the full path to a ``MyDataDir`` directory on the command line and ensure that the directory contains files corresponding to every file or content link in the ``MyDataDir`` -source directory. In order to match associated files in subdirectories, -specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``. +source directory. + +.. versionadded:: 3.3 + In order to match associated files in subdirectories, + specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``. Hash Algorithms ^^^^^^^^^^^^^^^ @@ -284,6 +301,9 @@ The following hash algorithms are supported:: SHA3_384 .sha3-384 Keccak SHA-3 SHA3_512 .sha3-512 Keccak SHA-3 +.. versionadded:: 3.8 + Added the ``SHA3_*`` hash algorithms. + Note that the hashes are used only for unique data identification and download verification. @@ -292,6 +312,8 @@ download verification. Custom Fetch Scripts ^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.2 + When a data file must be fetched from one of the URL templates specified in the ``ExternalData_URL_TEMPLATES`` variable, it is normally downloaded using the :command:`file(DOWNLOAD)` command. @@ -344,6 +366,30 @@ function(ExternalData_add_target target) endif() set(_ExternalData_CONFIG_CODE "") + cmake_parse_arguments(PARSE_ARGV 1 _ExternalData_add_target + "" + "SHOW_PROGRESS" + "") + if (_ExternalData_add_target_UNPARSED_ARGUMENTS) + message(AUTHOR_WARNING + "Ignoring unrecognized arguments passed to ExternalData_add_target: " + "`${_ExternalData_add_target_UNPARSED_ARGUMENTS}`") + endif () + + # Turn `SHOW_PROGRESS` into a boolean + if (NOT DEFINED _ExternalData_add_target_SHOW_PROGRESS) + # The default setting + if (CMAKE_GENERATOR MATCHES "Ninja") + set(_ExternalData_add_target_SHOW_PROGRESS OFF) + else () + set(_ExternalData_add_target_SHOW_PROGRESS ON) + endif () + elseif (_ExternalData_add_target_SHOW_PROGRESS) + set(_ExternalData_add_target_SHOW_PROGRESS ON) + else () + set(_ExternalData_add_target_SHOW_PROGRESS OFF) + endif () + # Store custom script configuration. foreach(url_template IN LISTS ExternalData_URL_TEMPLATES) if("${url_template}" MATCHES "^ExternalDataCustomScript://([^/]*)/(.*)$") @@ -423,6 +469,7 @@ function(ExternalData_add_target target) COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} -Dfile=${file} -Dname=${name} -DExternalData_ACTION=local + -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS} -DExternalData_CONFIG=${config} -P ${_ExternalData_SELF} MAIN_DEPENDENCY "${name}" @@ -459,6 +506,7 @@ function(ExternalData_add_target target) COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} -Dfile=${file} -Dname=${name} -Dexts=${exts} -DExternalData_ACTION=fetch + -DExternalData_SHOW_PROGRESS=${_ExternalData_add_target_SHOW_PROGRESS} -DExternalData_CONFIG=${config} -P ${_ExternalData_SELF} # Update whenever the object hash changes. @@ -925,7 +973,11 @@ function(_ExternalData_download_file url file err_var msg_var) else() set(absolute_timeout "") endif() - file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} SHOW_PROGRESS) + set(show_progress_args) + if (ExternalData_SHOW_PROGRESS) + list(APPEND show_progress_args SHOW_PROGRESS) + endif () + file(DOWNLOAD "${url}" "${file}" STATUS status LOG log ${inactivity_timeout} ${absolute_timeout} ${show_progress_args}) list(GET status 0 err) list(GET status 1 msg) if(err) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 8bbaf5a..f0ce7d4 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -56,6 +56,8 @@ External Project Definition (see *Logging Options* below). ``LOG_DIR <dir>`` + .. versionadded:: 3.14 + Directory in which to store the logs of each step. ``DOWNLOAD_DIR <dir>`` @@ -144,6 +146,9 @@ External Project Definition is determined by inspecting the actual content rather than using logic based on the file extension. + .. versionchanged:: 3.7 + Multiple URLs are allowed. + ``URL_HASH <algo>=<hashValue>`` Hash of the archive file to be downloaded. The argument should be of the form ``<algo>=<hashValue>`` where ``algo`` can be any of the hashing @@ -164,6 +169,8 @@ External Project Definition of code internal to the ``ExternalProject`` module. ``DOWNLOAD_NO_EXTRACT <bool>`` + .. versionadded:: 3.6 + Allows the extraction part of the download step to be disabled by passing a boolean true value for this option. If this option is not given, the downloaded contents will be unpacked automatically if @@ -180,15 +187,23 @@ External Project Definition Maximum time allowed for file download operations. ``INACTIVITY_TIMEOUT <seconds>`` + .. versionadded:: 3.19 + Terminate the operation after a period of inactivity. ``HTTP_USERNAME <username>`` + .. versionadded:: 3.7 + Username for the download operation if authentication is required. ``HTTP_PASSWORD <password>`` + .. versionadded:: 3.7 + Password for the download operation if authentication is required. ``HTTP_HEADER <header1> [<header2>...]`` + .. versionadded:: 3.7 + Provides an arbitrary list of HTTP headers for the download operation. This can be useful for accessing content in systems like AWS, etc. @@ -201,6 +216,9 @@ External Project Definition cannot be provided, this option can be an alternative verification measure. + .. versionchanged:: 3.6 + This option also applies to ``git clone`` invocations. + ``TLS_CAINFO <file>`` Specify a custom certificate authority file to use if ``TLS_VERIFY`` is enabled. If this option is not specified, the value of the @@ -208,6 +226,8 @@ External Project Definition :command:`file(DOWNLOAD)`) ``NETRC <level>`` + .. versionadded:: 3.11 + Specify whether the ``.netrc`` file is to be used for operation. If this option is not specified, the value of the ``CMAKE_NETRC`` variable will be used instead (see :command:`file(DOWNLOAD)`) @@ -225,11 +245,16 @@ External Project Definition is ignored. ``NETRC_FILE <file>`` + .. versionadded:: 3.11 + Specify an alternative ``.netrc`` file to the one in your home directory if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will be used instead (see :command:`file(DOWNLOAD)`) + .. versionadded:: 3.1 + Added support for `tbz2`, `.tar.xz`, `.txz`, and `.7z` extensions. + *Git* NOTE: A git version of 1.6.5 or later is required if this download method is used. @@ -267,22 +292,30 @@ External Project Definition ``GIT_SUBMODULES <module>...`` Specific git submodules that should also be updated. If this option is - not provided, all git submodules will be updated. When :policy:`CMP0097` - is set to ``NEW`` if this value is set to an empty string then no submodules - are initialized or updated. + not provided, all git submodules will be updated. + + .. versionchanged:: 3.16 + When :policy:`CMP0097` is set to ``NEW``, if this value is set + to an empty string then no submodules are initialized or updated. ``GIT_SUBMODULES_RECURSE <bool>`` + .. versionadded:: 3.17 + Specify whether git submodules (if any) should update recursively by passing the ``--recursive`` flag to ``git submodule update``. If not specified, the default is on. ``GIT_SHALLOW <bool>`` + .. versionadded:: 3.6 + When this option is enabled, the ``git clone`` operation will be given the ``--depth 1`` option. This performs a shallow clone, which avoids downloading the whole history and instead retrieves just the commit denoted by the ``GIT_TAG`` option. ``GIT_PROGRESS <bool>`` + .. versionadded:: 3.8 + When enabled, this option instructs the ``git clone`` operation to report its progress by passing it the ``--progress`` option. Without this option, the clone step for large projects may appear to make the @@ -292,12 +325,16 @@ External Project Definition overly noisy if lots of external projects are used. ``GIT_CONFIG <option1> [<option2>...]`` + .. versionadded:: 3.8 + Specify a list of config options to pass to ``git clone``. Each option listed will be transformed into its own ``--config <option>`` on the ``git clone`` command line, with each option required to be in the form ``key=value``. ``GIT_REMOTE_UPDATE_STRATEGY <strategy>`` + .. versionadded:: 3.18 + When ``GIT_TAG`` refers to a remote branch, this option can be used to specify how the update step behaves. The ``<strategy>`` must be one of the following: @@ -379,6 +416,8 @@ External Project Definition :manual:`generator expressions <cmake-generator-expressions(7)>`. ``UPDATE_DISCONNECTED <bool>`` + .. versionadded:: 3.2 + When enabled, this option causes the update step to be skipped. It does not, however, prevent the download step. The update step can still be added as a step target (see :command:`ExternalProject_Add_StepTargets`) @@ -436,6 +475,8 @@ External Project Definition ``CONFIGURE_COMMAND`` option. ``CMAKE_GENERATOR_PLATFORM <platform>`` + .. versionadded:: 3.1 + Pass a generator-specific platform name to the CMake command (see :variable:`CMAKE_GENERATOR_PLATFORM`). It is an error to provide this option without the ``CMAKE_GENERATOR`` option. @@ -446,6 +487,8 @@ External Project Definition option without the ``CMAKE_GENERATOR`` option. ``CMAKE_GENERATOR_INSTANCE <instance>`` + .. versionadded:: 3.11 + Pass a generator-specific instance selection to the CMake command (see :variable:`CMAKE_GENERATOR_INSTANCE`). It is an error to provide this option without the ``CMAKE_GENERATOR`` option. @@ -454,8 +497,10 @@ External Project Definition The specified arguments are passed to the ``cmake`` command line. They can be any argument the ``cmake`` command understands, not just cache values defined by ``-D...`` arguments (see also - :manual:`CMake Options <cmake(1)>`). In addition, arguments may use - :manual:`generator expressions <cmake-generator-expressions(7)>`. + :manual:`CMake Options <cmake(1)>`). + + .. versionadded:: 3.3 + Arguments may use :manual:`generator expressions <cmake-generator-expressions(7)>`. ``CMAKE_CACHE_ARGS <arg>...`` This is an alternate way of specifying cache variables where command line @@ -463,10 +508,14 @@ External Project Definition the form ``-Dvar:STRING=value``, which are then transformed into CMake :command:`set` commands with the ``FORCE`` option used. These ``set()`` commands are written to a pre-load script which is then applied - using the :manual:`cmake -C <cmake(1)>` command line option. Arguments - may use :manual:`generator expressions <cmake-generator-expressions(7)>`. + using the :manual:`cmake -C <cmake(1)>` command line option. + + .. versionadded:: 3.3 + Arguments may use :manual:`generator expressions <cmake-generator-expressions(7)>`. ``CMAKE_CACHE_DEFAULT_ARGS <arg>...`` + .. versionadded:: 3.2 + This is the same as the ``CMAKE_CACHE_ARGS`` option except the ``set()`` commands do not include the ``FORCE`` keyword. This means the values act as initial defaults only and will not override any variables already set @@ -474,20 +523,25 @@ External Project Definition different behavior depending on whether the build starts from a fresh build directory or re-uses previous build contents. - If the CMake generator is the ``Green Hills MULTI`` and not overridden then - the original project's settings for the GHS toolset and target system - customization cache variables are propagated into the external project. + .. versionadded:: 3.15 + If the CMake generator is the ``Green Hills MULTI`` and not overridden then + the original project's settings for the GHS toolset and target system + customization cache variables are propagated into the external project. ``SOURCE_SUBDIR <dir>`` + .. versionadded:: 3.7 + When no ``CONFIGURE_COMMAND`` option is specified, the configure step assumes the external project has a ``CMakeLists.txt`` file at the top of its source tree (i.e. in ``SOURCE_DIR``). The ``SOURCE_SUBDIR`` option can be used to point to an alternative directory within the source tree to use as the top of the CMake source tree instead. This must be a relative path and it will be interpreted as being relative to - ``SOURCE_DIR``. When ``BUILD_IN_SOURCE 1`` is specified, the - ``BUILD_COMMAND`` is used to point to an alternative directory within the - source tree. + ``SOURCE_DIR``. + + .. versionadded:: 3.14 + When ``BUILD_IN_SOURCE`` option is enabled, the ``BUILD_COMMAND`` + is used to point to an alternative directory within the source tree. **Build Step Options:** If the configure step assumed the external project uses CMake as its build @@ -524,6 +578,8 @@ External Project Definition developers might modify the sources in ``SOURCE_DIR``). ``BUILD_BYPRODUCTS <file>...`` + .. versionadded:: 3.2 + Specifies files that will be generated by the build command but which might or might not have their modification time updated by subsequent builds. These ultimately get passed through as ``BYPRODUCTS`` to the @@ -578,6 +634,8 @@ External Project Definition ``TEST_AFTER_INSTALL`` are enabled, the latter is silently ignored. ``TEST_EXCLUDE_FROM_MAIN <bool>`` + .. versionadded:: 3.2 + If enabled, the main build's default ALL target will not depend on the test step. This can be a useful way of ensuring the test step is defined but only gets invoked when manually requested. @@ -597,6 +655,8 @@ External Project Definition When enabled, the output of the update step is logged to files. ``LOG_PATCH <bool>`` + .. versionadded:: 3.14 + When enabled, the output of the patch step is logged to files. ``LOG_CONFIGURE <bool>`` @@ -612,10 +672,14 @@ External Project Definition When enabled, the output of the test step is logged to files. ``LOG_MERGED_STDOUTERR <bool>`` + .. versionadded:: 3.14 + When enabled, stdout and stderr will be merged for any step whose output is being logged to files. ``LOG_OUTPUT_ON_FAILURE <bool>`` + .. versionadded:: 3.14 + This option only has an effect if at least one of the other ``LOG_<step>`` options is enabled. If an error occurs for a step which has logging to file enabled, that step's output will be printed to the console if @@ -624,6 +688,8 @@ External Project Definition console. **Terminal Access Options:** + .. versionadded:: 3.4 + Steps can be given direct access to the terminal in some cases. Giving a step access to the terminal may allow it to receive terminal input if required, such as for authentication details not provided by other options. @@ -673,8 +739,9 @@ External Project Definition discussion of the effects of this option. ``INDEPENDENT_STEP_TARGETS <step-target>...`` - Deprecated. This is allowed only if policy :policy:`CMP0114` is not set - to ``NEW``. + .. deprecated:: 3.19 + This is allowed only if policy :policy:`CMP0114` is not set to ``NEW``. + Generates custom targets for the specified steps and prevent these targets from having the usual dependencies applied to them. If this option is not specified, the default value is taken from the @@ -780,6 +847,8 @@ control needed to implement such step-level capabilities. Files on which this custom step depends. ``INDEPENDENT <bool>`` + .. versionadded:: 3.19 + Specifies whether this step is independent of the external dependencies specified by the :command:`ExternalProject_Add`'s ``DEPENDS`` option. The default is ``FALSE``. Steps marked as independent may depend only @@ -795,6 +864,8 @@ control needed to implement such step-level capabilities. on the external targets, but may depend on targets for other steps. ``BYPRODUCTS <file>...`` + .. versionadded:: 3.2 + Files that will be generated by this custom step but which might or might not have their modification time updated by subsequent builds. This list of files will ultimately be passed through as the ``BYPRODUCTS`` option to the @@ -831,6 +902,12 @@ control needed to implement such step-level capabilities. corresponding property values defined in the original call to :command:`ExternalProject_Add`. + .. versionadded:: 3.3 + Token replacement is extended to byproducts. + + .. versionadded:: 3.11 + The ``<DOWNLOAD_DIR>`` substitution token. + .. command:: ExternalProject_Add_StepTargets The ``ExternalProject_Add_StepTargets()`` function generates targets for the @@ -868,15 +945,16 @@ control needed to implement such step-level capabilities. can save having to repeatedly specify the same set of step targets when multiple external projects are being defined. - If :policy:`CMP0114` is set to ``NEW``, step targets are fully responsible - for holding the custom commands implementing their steps. The primary target - created by ``ExternalProject_Add`` depends on the step targets, and the - step targets depend on each other. The target-level dependencies match - the file-level dependencies used by the custom commands for each step. - The targets for steps created with :command:`ExternalProject_Add_Step`'s - ``INDEPENDENT`` option do not depend on the external targets specified - by :command:`ExternalProject_Add`'s ``DEPENDS`` option. The predefined - steps ``mkdir``, ``download``, ``update``, and ``patch`` are independent. + .. versionadded:: 3.19 + If :policy:`CMP0114` is set to ``NEW``, step targets are fully responsible + for holding the custom commands implementing their steps. The primary target + created by ``ExternalProject_Add`` depends on the step targets, and the + step targets depend on each other. The target-level dependencies match + the file-level dependencies used by the custom commands for each step. + The targets for steps created with :command:`ExternalProject_Add_Step`'s + ``INDEPENDENT`` option do not depend on the external targets specified + by :command:`ExternalProject_Add`'s ``DEPENDS`` option. The predefined + steps ``mkdir``, ``download``, ``update``, and ``patch`` are independent. If :policy:`CMP0114` is not ``NEW``, the following deprecated behavior is available: @@ -901,6 +979,8 @@ control needed to implement such step-level capabilities. .. command:: ExternalProject_Add_StepDependencies + .. versionadded:: 3.2 + The ``ExternalProject_Add_StepDependencies()`` function can be used to add dependencies to a step. The dependencies added must be targets CMake already knows about (these can be ordinary executable or library targets, custom diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 4a3e83a..77c66d1 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -66,6 +66,8 @@ The default value for this global property is ``OPTIONAL``. .. variable:: FeatureSummary_<TYPE>_DESCRIPTION +.. versionadded:: 3.9 + The global property :variable:`FeatureSummary_<TYPE>_DESCRIPTION` can be defined for each type to replace the type name with the specified string whenever the package type is used in an output string. @@ -242,12 +244,13 @@ endfunction() ``<TYPE>_PACKAGES_NOT_FOUND`` only those packages which have not been found which have the type <TYPE> - With the exception of the ``ALL`` value, these values can be combined - in order to customize the output. For example: + .. versionchanged:: 3.1 + With the exception of the ``ALL`` value, these values can be combined + in order to customize the output. For example: - .. code-block:: cmake + .. code-block:: cmake - feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) + feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) If a ``FILENAME`` is given, the information is printed into this file. If ``APPEND`` is used, it is appended to this file, otherwise the file is @@ -268,14 +271,18 @@ endfunction() The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property is ``REQUIRED``. + .. versionadded:: 3.9 + The ``DEFAULT_DESCRIPTION`` option. + The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be modified to change the default package type assigned when not explicitly assigned by the user. - If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was - requested, and no packages belonging to that category were found, then no - output (including the ``DESCRIPTION``) is printed or added to the ``VAR`` - variable. + .. versionadded:: 3.8 + If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was + requested, and no packages belonging to that category were found, then no + output (including the ``DESCRIPTION``) is printed or added to the ``VAR`` + variable. Example 1, append everything to a file: @@ -617,6 +624,9 @@ endfunction() be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and ``DISABLED_FEATURES`` respectively. + .. versionchanged:: 3.8 + ``<enabled>`` can be a list of conditions. + Example for setting the info for a feature: .. code-block:: cmake diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 40cc362..8fabcdc 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -77,6 +77,9 @@ operation and would not normally be the way the module is used, but it is sometimes useful as part of implementing some higher level feature or to populate some content in CMake's script mode. +.. versionchanged:: 3.14 + ``FetchContent`` commands can access the terminal. This is necessary + for password prompts and real-time progress displays to work. Commands ^^^^^^^^ @@ -371,6 +374,8 @@ is simpler and provides additional features over the pattern above. :variable:`CMAKE_MAKE_PROGRAM` variables will need to be set appropriately on the command line invoking the script. + .. versionadded:: 3.18 + Added support for ``DOWNLOAD_NO_EXTRACT`` and ``SOURCE_SUBDIR`` options. .. command:: FetchContent_GetProperties @@ -416,6 +421,8 @@ is simpler and provides additional features over the pattern above. FetchContent_MakeAvailable( <name1> [<name2>...] ) + .. versionadded:: 3.14 + This command implements the common pattern typically needed for most dependencies. It iterates over each of the named dependencies in turn and for each one it loosely follows the diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index 88e2681..627866a 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -12,6 +12,8 @@ Find the alsa libraries (``asound``) IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + This module defines :prop_tgt:`IMPORTED` target ``ALSA::ALSA``, if ALSA has been found. diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index c8a31a0..f959356 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -8,6 +8,9 @@ FindArmadillo Find the Armadillo C++ library. Armadillo is a library for linear algebra & scientific computing. +.. versionadded:: 3.18 + Support for linking wrapped libraries directly (``ARMA_DONT_USE_WRAPPER``). + Using Armadillo: :: diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 1e1a5a3..3515bf0 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -35,21 +35,31 @@ the path to a yacc file. ``<CodeOutput>`` is the name of the source file generated by bison. A header file is also be generated, and contains the token list. +.. versionchanged:: 3.14 + When :policy:`CMP0088` is set to ``NEW``, ``bison`` runs in the + :variable:`CMAKE_CURRENT_BINARY_DIR` directory. + The options are: ``COMPILE_FLAGS <flags>`` Specify flags to be added to the ``bison`` command line. ``DEFINES_FILE <file>`` + .. versionadded:: 3.4 + Specify a non-default header ``<file>`` to be generated by ``bison``. ``VERBOSE [<file>]`` Tell ``bison`` to write a report file of the grammar and parser. - If ``<file>`` is given, it specifies path the report file is copied to. - ``[<file>]`` is left for backward compatibility of this module. - Use ``VERBOSE REPORT_FILE <file>``. + + .. deprecated:: 3.7 + If ``<file>`` is given, it specifies path the report file is copied to. + ``[<file>]`` is left for backward compatibility of this module. + Use ``VERBOSE REPORT_FILE <file>``. ``REPORT_FILE <file>`` + .. versionadded:: 3.7 + Specify a non-default report ``<file>``, if generated. The macro defines the following variables: diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index e4353df..01d0236 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -53,18 +53,46 @@ The following variables may be set to influence this module's behavior: * ``Arm_mp`` * ``Arm_ilp64`` * ``Arm_ilp64_mp`` + * ``EML`` + * ``EML_mt`` * ``Generic`` + .. versionadded:: 3.6 + ``OpenBLAS`` support. + + .. versionadded:: 3.11 + ``FLAME`` support. + + .. versionadded:: 3.13 + Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``). + + .. versionadded:: 3.17 + Added single dynamic library MKL variant (``Intel10_64_dyn``). + + .. versionadded:: 3.18 + Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``, + ``Arm_ilp64_mp``). + + .. versionadded:: 3.19 + ``FlexiBLAS`` support. + + .. versionadded:: 3.20 + Elbrus Math Library support (``EML``, ``EML_mt``). + ``BLA_F95`` if ``ON`` tries to find the BLAS95 interfaces ``BLA_PREFER_PKGCONFIG`` + .. versionadded:: 3.11 + if set ``pkg-config`` will be used to search for a BLAS library first and if one is found that is preferred Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.18 + This module defines the following :prop_tgt:`IMPORTED` target: ``BLAS::BLAS`` @@ -104,10 +132,13 @@ This module defines the following variables: Hints ^^^^^ -Set the ``MKLROOT`` environment variable to a directory that contains an MKL -installation, or add the directory to the dynamic library loader environment -variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or -``LD_LIBRARY_PATH``). +``MKLROOT`` + .. versionadded:: 3.15 + + Set this environment variable to a directory that contains an MKL + installation, or add the directory to the dynamic library loader environment + variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or + ``LD_LIBRARY_PATH``). #]=======================================================================] @@ -586,16 +617,22 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") else() find_package(Threads REQUIRED) endif() + set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}") + if(BLA_STATIC) + find_package(OpenMP COMPONENTS C) + list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") + endif() check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "openblas" - "${CMAKE_THREAD_LIBS_INIT}" + "${_threadlibs}" "" "" ) + unset(_threadlibs) endif() endif() @@ -951,6 +988,31 @@ if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") endif() endif() +# Elbrus Math Library? +if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All") + + set(BLAS_EML_LIB "eml") + + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + set(BLAS_EML_LIB "${BLAS_EML_LIB}_mt") + endif() + + if(NOT BLAS_LIBRARIES) + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "${BLAS_EML_LIB}" + "" + "" + "" + ) + endif() + +endif() + # Generic BLAS library? if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 5704d1d..355c4bb 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -10,6 +10,8 @@ Try to find BZip2 IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if BZip2 has been found. @@ -21,7 +23,8 @@ This module defines the following variables: ``BZIP2_FOUND`` system has BZip2 ``BZIP2_INCLUDE_DIRS`` - the BZip2 include directories + .. versionadded:: 3.12 + the BZip2 include directories ``BZIP2_LIBRARIES`` Link these to use BZip2 ``BZIP2_NEED_PREFIX`` diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 00e4ff1..e41e864 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -7,7 +7,9 @@ FindBoost Find Boost include dirs and libraries -Use this module by invoking find_package with the form:: +Use this module by invoking :command:`find_package` with the form: + +.. code-block:: cmake find_package(Boost [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0 @@ -20,97 +22,134 @@ Use this module by invoking find_package with the form:: This module finds headers and requested component libraries OR a CMake package configuration file provided by a "Boost CMake" build. For the -latter case skip to the "Boost CMake" section below. For the former -case results are reported in variables:: - - Boost_FOUND - True if headers and requested libraries were found - Boost_INCLUDE_DIRS - Boost include directories - Boost_LIBRARY_DIRS - Link directories for Boost libraries - Boost_LIBRARIES - Boost component libraries to be linked - Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case) - Boost_<C>_LIBRARY - Libraries to link for component <C> (may include - target_link_libraries debug/optimized keywords) - Boost_VERSION_MACRO - BOOST_VERSION value from boost/version.hpp - Boost_VERSION_STRING - Boost version number in x.y.z format - Boost_VERSION - if CMP0093 NEW => same as Boost_VERSION_STRING - if CMP0093 OLD or unset => same as Boost_VERSION_MACRO - Boost_LIB_VERSION - Version string appended to library filenames - Boost_VERSION_MAJOR - Boost major version number (X in X.y.z) - alias: Boost_MAJOR_VERSION - Boost_VERSION_MINOR - Boost minor version number (Y in x.Y.z) - alias: Boost_MINOR_VERSION - Boost_VERSION_PATCH - Boost subminor version number (Z in x.y.Z) - alias: Boost_SUBMINOR_VERSION - Boost_VERSION_COUNT - Amount of version components (3) - Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) - - Pass to add_definitions() to have diagnostic - information about Boost's automatic linking - displayed during compilation - -Note that Boost Python components require a Python version suffix -(Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the -versions built against Python 3.6 and 2.7, respectively. This also -applies to additional components using Python including -``mpi_python`` and ``numpy``. Earlier Boost releases may use -distribution-specific suffixes such as ``2``, ``3`` or ``2.7``. -These may also be used as suffixes, but note that they are not -portable. - -This module reads hints about search locations from variables:: - - BOOST_ROOT - Preferred installation prefix - (or BOOSTROOT) - BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include - BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib - Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not - specified by these hint variables. Default is OFF. - Boost_ADDITIONAL_VERSIONS - - List of Boost versions not known to this module - (Boost install locations may contain the version) - -and saves search results persistently in CMake cache entries:: - - Boost_INCLUDE_DIR - Directory containing Boost headers - Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries - Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries - Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant - Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant - -The following :prop_tgt:`IMPORTED` targets are also defined:: - - Boost::headers - Target for header-only dependencies - (Boost include directory) - alias: Boost::boost - Boost::<C> - Target for specific component dependency - (shared or static library); <C> is lower- - case - Boost::diagnostic_definitions - interface target to enable diagnostic - information about Boost's automatic linking - during compilation (adds BOOST_LIB_DIAGNOSTIC) - Boost::disable_autolinking - interface target to disable automatic - linking with MSVC (adds BOOST_ALL_NO_LIB) - Boost::dynamic_linking - interface target to enable dynamic linking - linking with MSVC (adds BOOST_ALL_DYN_LINK) +latter case skip to the :ref:`Boost CMake` section below. -Implicit dependencies such as ``Boost::filesystem`` requiring -``Boost::system`` will be automatically detected and satisfied, even -if system is not specified when using :command:`find_package` and if -``Boost::system`` is not added to :command:`target_link_libraries`. If using -``Boost::thread``, then ``Threads::Threads`` will also be added automatically. +.. versionadded:: 3.7 + ``bzip2`` and ``zlib`` components (Windows only). -It is important to note that the imported targets behave differently -than variables created by this module: multiple calls to -:command:`find_package(Boost)` in the same directory or sub-directories with -different options (e.g. static or shared) will not override the -values of the targets created by the first call. +.. versionadded:: 3.11 + The ``OPTIONAL_COMPONENTS`` option. + +.. versionadded:: 3.13 + ``stacktrace_*`` components. + +.. versionadded:: 3.19 + ``bzip2`` and ``zlib`` components on all platforms. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``Boost_FOUND`` + True if headers and requested libraries were found. + +``Boost_INCLUDE_DIRS`` + Boost include directories. + +``Boost_LIBRARY_DIRS`` + Link directories for Boost libraries. + +``Boost_LIBRARIES`` + Boost component libraries to be linked. + +``Boost_<COMPONENT>_FOUND`` + True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case). + +``Boost_<COMPONENT>_LIBRARY`` + Libraries to link for component ``<COMPONENT>`` (may include + :command:`target_link_libraries` debug/optimized keywords). + +``Boost_VERSION_MACRO`` + ``BOOST_VERSION`` value from ``boost/version.hpp``. + +``Boost_VERSION_STRING`` + Boost version number in ``X.Y.Z`` format. + +``Boost_VERSION`` + Boost version number in ``X.Y.Z`` format (same as ``Boost_VERSION_STRING``). + + .. versionchanged:: 3.15 + In previous CMake versions, this variable used the raw version string + from the Boost header (same as ``Boost_VERSION_MACRO``). + See policy :policy:`CMP0093`. + +``Boost_LIB_VERSION`` + Version string appended to library filenames. + +``Boost_VERSION_MAJOR``, ``Boost_MAJOR_VERSION`` + Boost major version number (``X`` in ``X.Y.Z``). + +``Boost_VERSION_MINOR``, ``Boost_MINOR_VERSION`` + Boost minor version number (``Y`` in ``X.Y.Z``). + +``Boost_VERSION_PATCH``, ``Boost_SUBMINOR_VERSION`` + Boost subminor version number (``Z`` in ``X.Y.Z``). + +``Boost_VERSION_COUNT`` + Amount of version components (3). + +``Boost_LIB_DIAGNOSTIC_DEFINITIONS`` (Windows-specific) + Pass to :command:`add_definitions` to have diagnostic + information about Boost's automatic linking + displayed during compilation + +.. versionadded:: 3.15 + The ``Boost_VERSION_<PART>`` variables. + +Cache variables +^^^^^^^^^^^^^^^ + +Search results are saved persistently in CMake cache entries: + +``Boost_INCLUDE_DIR`` + Directory containing Boost headers. + +``Boost_LIBRARY_DIR_RELEASE`` + Directory containing release Boost libraries. + +``Boost_LIBRARY_DIR_DEBUG`` + Directory containing debug Boost libraries. + +``Boost_<COMPONENT>_LIBRARY_DEBUG`` + Component ``<COMPONENT>`` library debug variant. + +``Boost_<COMPONENT>_LIBRARY_RELEASE`` + Component ``<COMPONENT>`` library release variant. + +.. versionadded:: 3.3 + Per-configuration variables ``Boost_LIBRARY_DIR_RELEASE`` and + ``Boost_LIBRARY_DIR_DEBUG``. + +Hints +^^^^^ + +This module reads hints about search locations from variables: + +``BOOST_ROOT``, ``BOOSTROOT`` + Preferred installation prefix. + +``BOOST_INCLUDEDIR`` + Preferred include directory e.g. ``<prefix>/include``. + +``BOOST_LIBRARYDIR`` + Preferred library directory e.g. ``<prefix>/lib``. + +``Boost_NO_SYSTEM_PATHS`` + Set to ``ON`` to disable searching in locations not + specified by these hint variables. Default is ``OFF``. + +``Boost_ADDITIONAL_VERSIONS`` + List of Boost versions not known to this module. + (Boost install locations may contain the version). Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but instead use the above result variables. Note that some hint names start in upper-case -"BOOST". One may specify these as environment variables if they are +``BOOST``. One may specify these as environment variables if they are not specified as CMake variables or cache entries. -This module first searches for the ``Boost`` header files using the above +This module first searches for the Boost header files using the above hint variables (excluding ``BOOST_LIBRARYDIR``) and saves the result in ``Boost_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints (excluding ``BOOST_INCLUDEDIR`` and @@ -118,83 +157,164 @@ using the above hints (excluding ``BOOST_INCLUDEDIR`` and and the library name configuration settings below. It saves the library directories in ``Boost_LIBRARY_DIR_DEBUG`` and ``Boost_LIBRARY_DIR_RELEASE`` and individual library -locations in ``Boost_<C>_LIBRARY_DEBUG`` and ``Boost_<C>_LIBRARY_RELEASE``. +locations in ``Boost_<COMPONENT>_LIBRARY_DEBUG`` and ``Boost_<COMPONENT>_LIBRARY_RELEASE``. When one changes settings used by previous searches in the same build tree (excluding environment variables) this module discards previous search results affected by the changes and searches again. +Imported Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.5 + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Boost::boost`` + Target for header-only dependencies. (Boost include directory). + +``Boost::headers`` + .. versionadded:: 3.15 + Alias for ``Boost::boost``. + +``Boost::<component>`` + Target for specific component dependency (shared or static library); + ``<component>`` name is lower-case. + +``Boost::diagnostic_definitions`` + Interface target to enable diagnostic information about Boost's automatic + linking during compilation (adds ``-DBOOST_LIB_DIAGNOSTIC``). + +``Boost::disable_autolinking`` + Interface target to disable automatic linking with MSVC + (adds ``-DBOOST_ALL_NO_LIB``). + +``Boost::dynamic_linking`` + Interface target to enable dynamic linking linking with MSVC + (adds ``-DBOOST_ALL_DYN_LINK``). + +Implicit dependencies such as ``Boost::filesystem`` requiring +``Boost::system`` will be automatically detected and satisfied, even +if system is not specified when using :command:`find_package` and if +``Boost::system`` is not added to :command:`target_link_libraries`. If using +``Boost::thread``, then ``Threads::Threads`` will also be added automatically. + +It is important to note that the imported targets behave differently +than variables created by this module: multiple calls to +:command:`find_package(Boost)` in the same directory or sub-directories with +different options (e.g. static or shared) will not override the +values of the targets created by the first call. + +Other Variables +^^^^^^^^^^^^^^^ + Boost libraries come in many variants encoded in their file name. Users or projects may tell this module which variant to find by -setting variables:: - - Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search - and use the debug libraries. Default is ON. - Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search - and use the release libraries. Default is ON. - Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded - libraries ('mt' tag). Default is ON. - Boost_USE_STATIC_LIBS - Set to ON to force the use of the static - libraries. Default is OFF. - Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use - libraries linked statically to the C++ runtime - ('s' tag). Default is platform dependent. - Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use - libraries linked to the MS debug C++ runtime - ('g' tag). Default is ON. - Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a - debug Python build ('y' tag). Default is OFF. - Boost_USE_STLPORT - Set to ON to use libraries compiled with - STLPort ('p' tag). Default is OFF. - Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS - - Set to ON to use libraries compiled with - STLPort deprecated "native iostreams" - ('n' tag). Default is OFF. - Boost_COMPILER - Set to the compiler-specific library suffix - (e.g. "-gcc43"). Default is auto-computed - for the C++ compiler in use. A list may be - used if multiple compatible suffixes should - be tested for, in decreasing order of - preference. - Boost_LIB_PREFIX - Set to the platform-specific library name - prefix (e.g. "lib") used by Boost static libs. - This is needed only on platforms where CMake - does not know the prefix by default. - Boost_ARCHITECTURE - Set to the architecture-specific library suffix - (e.g. "-x64"). Default is auto-computed for the - C++ compiler in use. - Boost_THREADAPI - Suffix for "thread" component library name, - such as "pthread" or "win32". Names with - and without this suffix will both be tried. - Boost_NAMESPACE - Alternate namespace used to build boost with - e.g. if set to "myboost", will search for - myboost_thread instead of boost_thread. - -Other variables one may set to control this module are:: - - Boost_DEBUG - Set to ON to enable debug output from FindBoost. - Please enable this before filing any bug report. - Boost_REALPATH - Set to ON to resolve symlinks for discovered - libraries to assist with packaging. For example, - the "system" component library may be resolved to - "/usr/lib/libboost_system.so.1.67.0" instead of - "/usr/lib/libboost_system.so". This does not - affect linking and should not be enabled unless - the user needs this information. - Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and - Boost_LIBRARY_DIR_DEBUG. +setting variables: + +``Boost_USE_DEBUG_LIBS`` + .. versionadded:: 3.10 + + Set to ``ON`` or ``OFF`` to specify whether to search and use the debug + libraries. Default is ``ON``. + +``Boost_USE_RELEASE_LIBS`` + .. versionadded:: 3.10 + + Set to ``ON`` or ``OFF`` to specify whether to search and use the release + libraries. Default is ``ON``. + +``Boost_USE_MULTITHREADED`` + Set to OFF to use the non-multithreaded libraries ("mt" tag). Default is + ``ON``. + +``Boost_USE_STATIC_LIBS`` + Set to ON to force the use of the static libraries. Default is ``OFF``. + +``Boost_USE_STATIC_RUNTIME`` + Set to ``ON`` or ``OFF`` to specify whether to use libraries linked + statically to the C++ runtime ("s" tag). Default is platform dependent. + +``Boost_USE_DEBUG_RUNTIME`` + Set to ``ON`` or ``OFF`` to specify whether to use libraries linked to the + MS debug C++ runtime ("g" tag). Default is ``ON``. + +``Boost_USE_DEBUG_PYTHON`` + Set to ``ON`` to use libraries compiled with a debug Python build ("y" + tag). Default is ``OFF``. + +``Boost_USE_STLPORT`` + Set to ``ON`` to use libraries compiled with STLPort ("p" tag). Default is + ``OFF``. + +``Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS`` + Set to ON to use libraries compiled with STLPort deprecated "native + iostreams" ("n" tag). Default is ``OFF``. + +``Boost_COMPILER`` + Set to the compiler-specific library suffix (e.g. ``-gcc43``). Default is + auto-computed for the C++ compiler in use. + + .. versionchanged:: 3.9 + A list may be used if multiple compatible suffixes should be tested for, + in decreasing order of preference. + +``Boost_LIB_PREFIX`` + .. versionadded:: 3.18 + + Set to the platform-specific library name prefix (e.g. ``lib``) used by + Boost static libs. This is needed only on platforms where CMake does not + know the prefix by default. + +``Boost_ARCHITECTURE`` + .. versionadded:: 3.13 + + Set to the architecture-specific library suffix (e.g. ``-x64``). + Default is auto-computed for the C++ compiler in use. + +``Boost_THREADAPI`` + Suffix for ``thread`` component library name, such as ``pthread`` or + ``win32``. Names with and without this suffix will both be tried. + +``Boost_NAMESPACE`` + Alternate namespace used to build boost with e.g. if set to ``myboost``, + will search for ``myboost_thread`` instead of ``boost_thread``. + +Other variables one may set to control this module are: + +``Boost_DEBUG`` + Set to ``ON`` to enable debug output from ``FindBoost``. + Please enable this before filing any bug report. + +``Boost_REALPATH`` + Set to ``ON`` to resolve symlinks for discovered libraries to assist with + packaging. For example, the "system" component library may be resolved to + ``/usr/lib/libboost_system.so.1.67.0`` instead of + ``/usr/lib/libboost_system.so``. This does not affect linking and should + not be enabled unless the user needs this information. + +``Boost_LIBRARY_DIR`` + Default value for ``Boost_LIBRARY_DIR_RELEASE`` and + ``Boost_LIBRARY_DIR_DEBUG``. On Visual Studio and Borland compilers Boost headers request automatic linking to corresponding libraries. This requires matching libraries to be linked explicitly or available in the link library search path. In this case setting ``Boost_USE_STATIC_LIBS`` to ``OFF`` may not achieve dynamic linking. Boost automatic linking typically requests static -libraries with a few exceptions (such as ``Boost.Python``). Use:: +libraries with a few exceptions (such as ``Boost.Python``). Use: + +.. code-block:: cmake add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) to ask Boost to report information about automatic linking requests. -Example to find Boost headers only:: +Examples +^^^^^^^^ + +Find Boost headers only: + +.. code-block:: cmake find_package(Boost 1.36.0) if(Boost_FOUND) @@ -202,7 +322,9 @@ Example to find Boost headers only:: add_executable(foo foo.cc) endif() -Example to find Boost libraries and use imported targets:: +Find Boost libraries and use imported targets: + +.. code-block:: cmake find_package(Boost 1.56 REQUIRED COMPONENTS date_time filesystem iostreams) @@ -210,17 +332,21 @@ Example to find Boost libraries and use imported targets:: target_link_libraries(foo Boost::date_time Boost::filesystem Boost::iostreams) -Example to find Boost Python 3.6 libraries and use imported targets:: +Find Boost Python 3.6 libraries and use imported targets: + +.. code-block:: cmake find_package(Boost 1.67 REQUIRED COMPONENTS python36 numpy36) add_executable(foo foo.cc) target_link_libraries(foo Boost::python36 Boost::numpy36) -Example to find Boost headers and some *static* (release only) libraries:: +Find Boost headers and some *static* (release only) libraries: + +.. code-block:: cmake set(Boost_USE_STATIC_LIBS ON) # only find static libs - set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and + set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and set(Boost_USE_RELEASE_LIBS ON) # only find release libs set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) @@ -231,6 +357,8 @@ Example to find Boost headers and some *static* (release only) libraries:: target_link_libraries(foo ${Boost_LIBRARIES}) endif() +.. _`Boost CMake`: + Boost CMake ^^^^^^^^^^^ @@ -238,7 +366,7 @@ If Boost was built using the boost-cmake project or from Boost 1.70.0 on it provides a package configuration file for use with find_package's config mode. This module looks for the package configuration file called ``BoostConfig.cmake`` or ``boost-config.cmake`` and stores the result in -``CACHE`` entry "Boost_DIR". If found, the package configuration file is loaded +``CACHE`` entry ``Boost_DIR``. If found, the package configuration file is loaded and this module returns with no further action. See documentation of the Boost CMake package configuration for details on what it provides. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index f04f571..6daf81d 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -4,12 +4,6 @@ FindCUDA .. deprecated:: 3.10 - Superseded by first-class support for the CUDA language in CMake. - Superseded by the :module:`FindCUDAToolkit` for CUDA toolkit libraries. - -Replacement -^^^^^^^^^^^ - It is no longer necessary to use this module or call ``find_package(CUDA)`` for compiling CUDA code. Instead, list ``CUDA`` among the languages named in the top-level call to the :command:`project` command, or call the @@ -17,9 +11,10 @@ in the top-level call to the :command:`project` command, or call the Then one can add CUDA (``.cu``) sources to programs directly in calls to :command:`add_library` and :command:`add_executable`. -To find and use the CUDA toolkit libraries the :module:`FindCUDAToolkit` -module has superseded this module. It works whether or not the ``CUDA`` -language is enabled. +.. versionadded:: 3.17 + To find and use the CUDA toolkit libraries the :module:`FindCUDAToolkit` + module has superseded this module. It works whether or not the ``CUDA`` + language is enabled. Documentation of Deprecated Usage ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -30,6 +25,9 @@ This script locates the NVIDIA CUDA C tools. It should work on Linux, Windows, and macOS and should be reasonably up to date with CUDA C releases. +.. versionadded:: 3.19 + QNX support. + This script makes use of the standard :command:`find_package` arguments of ``<VERSION>``, ``REQUIRED`` and ``QUIET``. ``CUDA_FOUND`` will report if an acceptable version of CUDA was found. @@ -50,342 +48,476 @@ location. In newer versions of the toolkit the CUDA library is included with the graphics driver -- be sure that the driver version matches what is needed by the CUDA runtime version. +Input Variables +""""""""""""""" + The following variables affect the behavior of the macros in the script (in alphabetical order). Note that any of these flags can be changed multiple times in the same directory before calling -``CUDA_ADD_EXECUTABLE``, ``CUDA_ADD_LIBRARY``, ``CUDA_COMPILE``, -``CUDA_COMPILE_PTX``, ``CUDA_COMPILE_FATBIN``, ``CUDA_COMPILE_CUBIN`` -or ``CUDA_WRAP_SRCS``:: - - CUDA_64_BIT_DEVICE_CODE (Default matches host bit size) - -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code. - Note that making this different from the host code when generating object - or C files from CUDA code just won't work, because size_t gets defined by - nvcc in the generated source. If you compile to PTX and then load the - file yourself, you can mix bit sizes between device and host. - - CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON) - -- Set to ON if you want the custom build rule to be attached to the source - file in Visual Studio. Turn OFF if you add the same cuda file to multiple - targets. - - This allows the user to build the target from the CUDA file; however, bad - things can happen if the CUDA source file is added to multiple targets. - When performing parallel builds it is possible for the custom build - command to be run more than once and in parallel causing cryptic build - errors. VS runs the rules for every source file in the target, and a - source can have only one rule no matter how many projects it is added to. - When the rule is run from multiple targets race conditions can occur on - the generated file. Eventually everything will get built, but if the user - is unaware of this behavior, there may be confusion. It would be nice if - this script could detect the reuse of source files across multiple targets - and turn the option off for the user, but no good solution could be found. - - CUDA_BUILD_CUBIN (Default OFF) - -- Set to ON to enable and extra compilation pass with the -cubin option in - Device mode. The output is parsed and register, shared memory usage is - printed during build. - - CUDA_BUILD_EMULATION (Default OFF for device mode) - -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files - when CUDA_BUILD_EMULATION is TRUE. - - CUDA_LINK_LIBRARIES_KEYWORD (Default "") - -- The <PRIVATE|PUBLIC|INTERFACE> keyword to use for internal - target_link_libraries calls. The default is to use no keyword which - uses the old "plain" form of target_link_libraries. Note that is matters - because whatever is used inside the FindCUDA module must also be used - outside - the two forms of target_link_libraries cannot be mixed. - - CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR) - -- Set to the path you wish to have the generated files placed. If it is - blank output files will be placed in CMAKE_CURRENT_BINARY_DIR. - Intermediate files will always be placed in - CMAKE_CURRENT_BINARY_DIR/CMakeFiles. - - CUDA_HOST_COMPILATION_CPP (Default ON) - -- Set to OFF for C compilation of host code. - - CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER) - -- Set the host compiler to be used by nvcc. Ignored if -ccbin or - --compiler-bindir is already present in the CUDA_NVCC_FLAGS or - CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets, - the host compiler is constructed with one or more visual studio macros - such as $(VCInstallDir), that expands out to the path when - the command is run from within VS. - If the CUDAHOSTCXX environment variable is set it will - be used as the default. +``cuda_add_executable()``, ``cuda_add_library()``, ``cuda_compile()``, +``cuda_compile_ptx()``, ``cuda_compile_fatbin()``, ``cuda_compile_cubin()`` +or ``cuda_wrap_srcs()``: + +``CUDA_64_BIT_DEVICE_CODE`` (Default: host bit size) + Set to ``ON`` to compile for 64 bit device code, OFF for 32 bit device code. + Note that making this different from the host code when generating object + or C files from CUDA code just won't work, because size_t gets defined by + nvcc in the generated source. If you compile to PTX and then load the + file yourself, you can mix bit sizes between device and host. + +``CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE`` (Default: ``ON``) + Set to ``ON`` if you want the custom build rule to be attached to the source + file in Visual Studio. Turn OFF if you add the same cuda file to multiple + targets. + + This allows the user to build the target from the CUDA file; however, bad + things can happen if the CUDA source file is added to multiple targets. + When performing parallel builds it is possible for the custom build + command to be run more than once and in parallel causing cryptic build + errors. VS runs the rules for every source file in the target, and a + source can have only one rule no matter how many projects it is added to. + When the rule is run from multiple targets race conditions can occur on + the generated file. Eventually everything will get built, but if the user + is unaware of this behavior, there may be confusion. It would be nice if + this script could detect the reuse of source files across multiple targets + and turn the option off for the user, but no good solution could be found. + +``CUDA_BUILD_CUBIN`` (Default: ``OFF``) + Set to ``ON`` to enable and extra compilation pass with the ``-cubin`` option in + Device mode. The output is parsed and register, shared memory usage is + printed during build. + +``CUDA_BUILD_EMULATION`` (Default: ``OFF`` for device mode) + Set to ``ON`` for Emulation mode. ``-D_DEVICEEMU`` is defined for CUDA C files + when ``CUDA_BUILD_EMULATION`` is ``TRUE``. + +``CUDA_LINK_LIBRARIES_KEYWORD`` (Default: ``""``) + .. versionadded:: 3.9 + + The ``<PRIVATE|PUBLIC|INTERFACE>`` keyword to use for internal + :command:`target_link_libraries` calls. The default is to use no keyword which + uses the old "plain" form of :command:`target_link_libraries`. Note that is matters + because whatever is used inside the ``FindCUDA`` module must also be used + outside - the two forms of :command:`target_link_libraries` cannot be mixed. + +``CUDA_GENERATED_OUTPUT_DIR`` (Default: :variable:`CMAKE_CURRENT_BINARY_DIR`) + Set to the path you wish to have the generated files placed. If it is + blank output files will be placed in :variable:`CMAKE_CURRENT_BINARY_DIR`. + Intermediate files will always be placed in + ``CMAKE_CURRENT_BINARY_DIR/CMakeFiles``. + +``CUDA_HOST_COMPILATION_CPP`` (Default: ``ON``) + Set to ``OFF`` for C compilation of host code. + +``CUDA_HOST_COMPILER`` (Default: ``CMAKE_C_COMPILER``) + Set the host compiler to be used by nvcc. Ignored if ``-ccbin`` or + ``--compiler-bindir`` is already present in the ``CUDA_NVCC_FLAGS`` or + ``CUDA_NVCC_FLAGS_<CONFIG>`` variables. For Visual Studio targets, + the host compiler is constructed with one or more visual studio macros + such as ``$(VCInstallDir)``, that expands out to the path when + the command is run from within VS. + + .. versionadded:: 3.13 + If the :envvar:`CUDAHOSTCXX` environment variable is set it will + be used as the default. + +``CUDA_NVCC_FLAGS``, ``CUDA_NVCC_FLAGS_<CONFIG>`` + Additional NVCC command line arguments. NOTE: multiple arguments must be + semi-colon delimited (e.g. ``--compiler-options;-Wall``) + + .. versionadded:: 3.6 + Contents of these variables may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. + +``CUDA_PROPAGATE_HOST_FLAGS`` (Default: ``ON``) + Set to ``ON`` to propagate :variable:`CMAKE_{C,CXX}_FLAGS <CMAKE_<LANG>_FLAGS>` and their configuration + dependent counterparts (e.g. ``CMAKE_C_FLAGS_DEBUG``) automatically to the + host compiler through nvcc's ``-Xcompiler`` flag. This helps make the + generated host code match the rest of the system better. Sometimes + certain flags give nvcc problems, and this will help you turn the flag + propagation off. This does not affect the flags supplied directly to nvcc + via ``CUDA_NVCC_FLAGS`` or through the ``OPTION`` flags specified through + ``cuda_add_library()``, ``cuda_add_executable()``, or ``cuda_wrap_srcs()``. Flags used for + shared library compilation are not affected by this flag. - CUDA_NVCC_FLAGS - CUDA_NVCC_FLAGS_<CONFIG> - -- Additional NVCC command line arguments. NOTE: multiple arguments must be - semi-colon delimited (e.g. --compiler-options;-Wall) - - CUDA_PROPAGATE_HOST_FLAGS (Default ON) - -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration - dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the - host compiler through nvcc's -Xcompiler flag. This helps make the - generated host code match the rest of the system better. Sometimes - certain flags give nvcc problems, and this will help you turn the flag - propagation off. This does not affect the flags supplied directly to nvcc - via CUDA_NVCC_FLAGS or through the OPTION flags specified through - CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for - shared library compilation are not affected by this flag. - - CUDA_SEPARABLE_COMPILATION (Default OFF) - -- If set this will enable separable compilation for all CUDA runtime object - files. If used outside of CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY - (e.g. calling CUDA_WRAP_SRCS directly), - CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and - CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called. - - CUDA_SOURCE_PROPERTY_FORMAT - -- If this source file property is set, it can override the format specified - to CUDA_WRAP_SRCS (OBJ, PTX, CUBIN, or FATBIN). If an input source file - is not a .cu file, setting this file will cause it to be treated as a .cu - file. See documentation for set_source_files_properties on how to set - this property. - - CUDA_USE_STATIC_CUDA_RUNTIME (Default ON) - -- When enabled the static version of the CUDA runtime library will be used - in CUDA_LIBRARIES. If the version of CUDA configured doesn't support - this option, then it will be silently disabled. - - CUDA_VERBOSE_BUILD (Default OFF) - -- Set to ON to see all the commands used when building the CUDA file. When - using a Makefile generator the value defaults to VERBOSE (run make - VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will - always print the output. - -The script creates the following macros (in alphabetical order):: - - CUDA_ADD_CUFFT_TO_TARGET( cuda_target ) - -- Adds the cufft library to the target (can be any target). Handles whether - you are in emulation mode or not. - - CUDA_ADD_CUBLAS_TO_TARGET( cuda_target ) - -- Adds the cublas library to the target (can be any target). Handles - whether you are in emulation mode or not. - - CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ... - [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) - -- Creates an executable "cuda_target" which is made up of the files - specified. All of the non CUDA C files are compiled using the standard - build rules specified by CMAKE and the cuda files are compiled to object - files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is - added automatically to include_directories(). Some standard CMake target - calls can be used on the target after calling this macro - (e.g. set_target_properties and target_link_libraries), but setting - properties that adjust compilation flags will not affect code compiled by - nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE, - CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS. - - CUDA_ADD_LIBRARY( cuda_target file0 file1 ... - [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) - -- Same as CUDA_ADD_EXECUTABLE except that a library is created. - - CUDA_BUILD_CLEAN_TARGET() - -- Creates a convenience target that deletes all the dependency files - generated. You should make clean after running this target to ensure the - dependency files get regenerated. - - CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE] - [OPTIONS ...] ) - -- Returns a list of generated files from the input source files to be used - with ADD_LIBRARY or ADD_EXECUTABLE. - - CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] ) - -- Returns a list of PTX files generated from the input source files. - - CUDA_COMPILE_FATBIN( generated_files file0 file1 ... [OPTIONS ...] ) - -- Returns a list of FATBIN files generated from the input source files. - - CUDA_COMPILE_CUBIN( generated_files file0 file1 ... [OPTIONS ...] ) - -- Returns a list of CUBIN files generated from the input source files. - - CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var - cuda_target - object_files ) - -- Compute the name of the intermediate link file used for separable - compilation. This file name is typically passed into - CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS. output_file_var is produced - based on cuda_target the list of objects files that need separable - compilation as specified by object_files. If the object_files list is - empty, then output_file_var will be empty. This function is called - automatically for CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE. Note that - this is a function and not a macro. - - CUDA_INCLUDE_DIRECTORIES( path0 path1 ... ) - -- Sets the directories that should be passed to nvcc - (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu - files. - - - CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target - nvcc_flags object_files) - -- Generates the link object required by separable compilation from the given - object files. This is called automatically for CUDA_ADD_EXECUTABLE and - CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS - directly. When called from CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE the - nvcc_flags passed in are the same as the flags passed in via the OPTIONS - argument. The only nvcc flag added automatically is the bitness flag as - specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function - instead of a macro. - - CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures]) - -- Selects GPU arch flags for nvcc based on target_CUDA_architectures - target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...) - - "Auto" detects local machine GPU compute arch at runtime. - - "Common" and "All" cover common and entire subsets of architectures - ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX - NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal - NUM: Any number. Only those pairs are currently accepted by NVCC though: - 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 - Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable} - Additionally, sets ${out_variable}_readable to the resulting numeric list - Example: - CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell) - LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS}) - - More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA - Note that this is a function instead of a macro. - - CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ... - [STATIC | SHARED | MODULE] [OPTIONS ...] ) - -- This is where all the magic happens. CUDA_ADD_EXECUTABLE, - CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this - function under the hood. - - Given the list of files (file0 file1 ... fileN) this macro generates - custom commands that generate either PTX or linkable objects (use "PTX" or - "OBJ" for the format argument to switch). Files that don't end with .cu - or have the HEADER_FILE_ONLY property are ignored. - - The arguments passed in after OPTIONS are extra command line options to - give to nvcc. You can also specify per configuration options by - specifying the name of the configuration followed by the options. General - options must precede configuration specific options. Not all - configurations need to be specified, only the ones provided will be used. - - OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag" - DEBUG -g - RELEASE --use_fast_math - RELWITHDEBINFO --use_fast_math;-g - MINSIZEREL --use_fast_math - - For certain configurations (namely VS generating object files with - CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will - be produced for the given cuda file. This is because when you add the - cuda file to Visual Studio it knows that this file produces an object file - and will link in the resulting object file automatically. - - This script will also generate a separate cmake script that is used at - build time to invoke nvcc. This is for several reasons. - - 1. nvcc can return negative numbers as return values which confuses - Visual Studio into thinking that the command succeeded. The script now - checks the error codes and produces errors when there was a problem. - - 2. nvcc has been known to not delete incomplete results when it - encounters problems. This confuses build systems into thinking the - target was generated when in fact an unusable file exists. The script - now deletes the output files if there was an error. - - 3. By putting all the options that affect the build into a file and then - make the build rule dependent on the file, the output files will be - regenerated when the options change. - - This script also looks at optional arguments STATIC, SHARED, or MODULE to - determine when to target the object compilation for a shared library. - BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in - CUDA_ADD_LIBRARY. On some systems special flags are added for building - objects intended for shared libraries. A preprocessor macro, - <target_name>_EXPORTS is defined when a shared library compilation is - detected. - - Flags passed into add_definitions with -D or /D are passed along to nvcc. - - - -The script defines the following variables:: - - CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc. - CUDA_VERSION_MINOR -- The minor version. - CUDA_VERSION - CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR - CUDA_HAS_FP16 -- Whether a short float (float16,fp16) is supported. - - CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set). - CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the - SDK. This script will not directly support finding - specific libraries or headers, as that isn't - supported by NVIDIA. If you want to change - libraries when the path changes see the - FindCUDA.cmake script for an example of how to clear - these variables. There are also examples of how to - use the CUDA_SDK_ROOT_DIR to locate headers or - libraries, if you so choose (at your own risk). - CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically - for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY. - CUDA_LIBRARIES -- Cuda RT library. - CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT - implementation (alternative to: - CUDA_ADD_CUFFT_TO_TARGET macro) - CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS - implementation (alternative to: - CUDA_ADD_CUBLAS_TO_TARGET macro). - CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library. - Only available for CUDA version 5.5+ - CUDA_cudadevrt_LIBRARY -- Device runtime library. - Required for separable compilation. - CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library. - Only available for CUDA version 4.0+. - CUDA_curand_LIBRARY -- CUDA Random Number Generation library. - Only available for CUDA version 3.2+. - CUDA_cusolver_LIBRARY -- CUDA Direct Solver library. - Only available for CUDA version 7.0+. - CUDA_cusparse_LIBRARY -- CUDA Sparse Matrix library. - Only available for CUDA version 3.2+. - CUDA_npp_LIBRARY -- NVIDIA Performance Primitives lib. - Only available for CUDA version 4.0+. - CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core). - Only available for CUDA version 5.5+. - CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 5.5 - 8.0. - CUDA_nppial_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppicc_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppicom_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0 - 10.2. - Replaced by nvjpeg. - CUDA_nppidei_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppif_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppig_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppim_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppist_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppisu_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_nppitc_LIBRARY -- NVIDIA Performance Primitives lib (image processing). - Only available for CUDA version 9.0. - CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing). - Only available for CUDA version 5.5+. - CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library. - Only available for CUDA version 3.2+. - Windows only. - CUDA_nvcuvid_LIBRARY -- CUDA Video Decoder library. - Only available for CUDA version 3.2+. - Windows only. - CUDA_nvToolsExt_LIBRARY - -- NVIDA CUDA Tools Extension library. - Available for CUDA version 5+. - CUDA_OpenCL_LIBRARY -- NVIDA CUDA OpenCL library. - Available for CUDA version 5+. +``CUDA_SEPARABLE_COMPILATION`` (Default: ``OFF``) + If set this will enable separable compilation for all CUDA runtime object + files. If used outside of ``cuda_add_executable()`` and ``cuda_add_library()`` + (e.g. calling ``cuda_wrap_srcs()`` directly), + ``cuda_compute_separable_compilation_object_file_name()`` and + ``cuda_link_separable_compilation_objects()`` should be called. + +``CUDA_SOURCE_PROPERTY_FORMAT`` + .. versionadded:: 3.3 + + If this source file property is set, it can override the format specified + to ``cuda_wrap_srcs()`` (``OBJ``, ``PTX``, ``CUBIN``, or ``FATBIN``). If an input source file + is not a ``.cu`` file, setting this file will cause it to be treated as a ``.cu`` + file. See documentation for set_source_files_properties on how to set + this property. + +``CUDA_USE_STATIC_CUDA_RUNTIME`` (Default: ``ON``) + .. versionadded:: 3.3 + + When enabled the static version of the CUDA runtime library will be used + in ``CUDA_LIBRARIES``. If the version of CUDA configured doesn't support + this option, then it will be silently disabled. + +``CUDA_VERBOSE_BUILD`` (Default: ``OFF``) + Set to ``ON`` to see all the commands used when building the CUDA file. When + using a Makefile generator the value defaults to ``VERBOSE`` (run + ``make VERBOSE=1`` to see output), although setting ``CUDA_VERBOSE_BUILD`` to ``ON`` will + always print the output. + +Commands +"""""""" + +The script creates the following functions and macros (in alphabetical order): + +.. code-block:: cmake + + cuda_add_cufft_to_target(<cuda_target>) + +Adds the cufft library to the target (can be any target). Handles whether +you are in emulation mode or not. + +.. code-block:: cmake + + cuda_add_cublas_to_target(<cuda_target>) + +Adds the cublas library to the target (can be any target). Handles +whether you are in emulation mode or not. + +.. code-block:: cmake + + cuda_add_executable(<cuda_target> <file>... + [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...]) + +Creates an executable ``<cuda_target>`` which is made up of the files +specified. All of the non CUDA C files are compiled using the standard +build rules specified by CMake and the CUDA files are compiled to object +files using nvcc and the host compiler. In addition ``CUDA_INCLUDE_DIRS`` is +added automatically to :command:`include_directories`. Some standard CMake target +calls can be used on the target after calling this macro +(e.g. :command:`set_target_properties` and :command:`target_link_libraries`), but setting +properties that adjust compilation flags will not affect code compiled by +nvcc. Such flags should be modified before calling ``cuda_add_executable()``, +``cuda_add_library()`` or ``cuda_wrap_srcs()``. + +.. code-block:: cmake + + cuda_add_library(<cuda_target> <file>... + [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...]) + +Same as ``cuda_add_executable()`` except that a library is created. + +.. code-block:: cmake + + cuda_build_clean_target() + +Creates a convenience target that deletes all the dependency files +generated. You should make clean after running this target to ensure the +dependency files get regenerated. + +.. code-block:: cmake + + cuda_compile(<generated_files> <file>... [STATIC | SHARED | MODULE] + [OPTIONS ...]) + +Returns a list of generated files from the input source files to be used +with :command:`add_library` or :command:`add_executable`. + +.. code-block:: cmake + + cuda_compile_ptx(<generated_files> <file>... [OPTIONS ...]) + +Returns a list of ``PTX`` files generated from the input source files. + +.. code-block:: cmake + + cuda_compile_fatbin(<generated_files> <file>... [OPTIONS ...]) + +.. versionadded:: 3.1 + +Returns a list of ``FATBIN`` files generated from the input source files. + +.. code-block:: cmake + + cuda_compile_cubin(<generated_files> <file>... [OPTIONS ...]) + +.. versionadded:: 3.1 + +Returns a list of ``CUBIN`` files generated from the input source files. + +.. code-block:: cmake + + cuda_compute_separable_compilation_object_file_name(<output_file_var> + <cuda_target> + <object_files>) + +Compute the name of the intermediate link file used for separable +compilation. This file name is typically passed into +``CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS``. output_file_var is produced +based on cuda_target the list of objects files that need separable +compilation as specified by ``<object_files>``. If the ``<object_files>`` list is +empty, then ``<output_file_var>`` will be empty. This function is called +automatically for ``cuda_add_library()`` and ``cuda_add_executable()``. Note that +this is a function and not a macro. + +.. code-block:: cmake + + cuda_include_directories(path0 path1 ...) + +Sets the directories that should be passed to nvcc +(e.g. ``nvcc -Ipath0 -Ipath1 ...``). These paths usually contain other ``.cu`` +files. + +.. code-block:: cmake + + cuda_link_separable_compilation_objects(<output_file_var> <cuda_target> + <nvcc_flags> <object_files>) + +Generates the link object required by separable compilation from the given +object files. This is called automatically for ``cuda_add_executable()`` and +``cuda_add_library()``, but can be called manually when using ``cuda_wrap_srcs()`` +directly. When called from ``cuda_add_library()`` or ``cuda_add_executable()`` the +``<nvcc_flags>`` passed in are the same as the flags passed in via the ``OPTIONS`` +argument. The only nvcc flag added automatically is the bitness flag as +specified by ``CUDA_64_BIT_DEVICE_CODE``. Note that this is a function +instead of a macro. + +.. code-block:: cmake + + cuda_select_nvcc_arch_flags(<out_variable> [<target_CUDA_architecture> ...]) + +Selects GPU arch flags for nvcc based on ``target_CUDA_architecture``. + +Values for ``target_CUDA_architecture``: + +* ``Auto``: detects local machine GPU compute arch at runtime. +* ``Common`` and ``All``: cover common and entire subsets of architectures. +* ``<name>``: one of ``Fermi``, ``Kepler``, ``Maxwell``, ``Kepler+Tegra``, ``Kepler+Tesla``, ``Maxwell+Tegra``, ``Pascal``. +* ``<ver>``, ``<ver>(<ver>)``, ``<ver>+PTX``, where ``<ver>`` is one of + ``2.0``, ``2.1``, ``3.0``, ``3.2``, ``3.5``, ``3.7``, ``5.0``, ``5.2``, ``5.3``, ``6.0``, ``6.2``. + +Returns list of flags to be added to ``CUDA_NVCC_FLAGS`` in ``<out_variable>``. +Additionally, sets ``<out_variable>_readable`` to the resulting numeric list. + +Example:: + + cuda_select_nvcc_arch_flags(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell) + list(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS}) + +More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA. +Note that this is a function instead of a macro. + +.. code-block:: cmake + + cuda_wrap_srcs(<cuda_target> <format> <generated_files> <file>... + [STATIC | SHARED | MODULE] [OPTIONS ...]) + +This is where all the magic happens. ``cuda_add_executable()``, +``cuda_add_library()``, ``cuda_compile()``, and ``cuda_compile_ptx()`` all call this +function under the hood. + +Given the list of files ``<file>...`` this macro generates +custom commands that generate either PTX or linkable objects (use ``PTX`` or +``OBJ`` for the ``<format>`` argument to switch). Files that don't end with ``.cu`` +or have the ``HEADER_FILE_ONLY`` property are ignored. + +The arguments passed in after ``OPTIONS`` are extra command line options to +give to nvcc. You can also specify per configuration options by +specifying the name of the configuration followed by the options. General +options must precede configuration specific options. Not all +configurations need to be specified, only the ones provided will be used. +For example: + +.. code-block:: cmake + + cuda_add_executable(... + OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag" + DEBUG -g + RELEASE --use_fast_math + RELWITHDEBINFO --use_fast_math;-g + MINSIZEREL --use_fast_math) + +For certain configurations (namely VS generating object files with +``CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE`` set to ``ON``), no generated file will +be produced for the given cuda file. This is because when you add the +cuda file to Visual Studio it knows that this file produces an object file +and will link in the resulting object file automatically. + +This script will also generate a separate cmake script that is used at +build time to invoke nvcc. This is for several reasons: + +* nvcc can return negative numbers as return values which confuses + Visual Studio into thinking that the command succeeded. The script now + checks the error codes and produces errors when there was a problem. + +* nvcc has been known to not delete incomplete results when it + encounters problems. This confuses build systems into thinking the + target was generated when in fact an unusable file exists. The script + now deletes the output files if there was an error. + +* By putting all the options that affect the build into a file and then + make the build rule dependent on the file, the output files will be + regenerated when the options change. + +This script also looks at optional arguments ``STATIC``, ``SHARED``, or ``MODULE`` to +determine when to target the object compilation for a shared library. +:variable:`BUILD_SHARED_LIBS` is ignored in ``cuda_wrap_srcs()``, but it is respected in +``cuda_add_library()``. On some systems special flags are added for building +objects intended for shared libraries. A preprocessor macro, +``<target_name>_EXPORTS`` is defined when a shared library compilation is +detected. + +Flags passed into add_definitions with ``-D`` or ``/D`` are passed along to nvcc. + +Result Variables +"""""""""""""""" + +The script defines the following variables: + +``CUDA_VERSION_MAJOR`` + The major version of cuda as reported by nvcc. + +``CUDA_VERSION_MINOR`` + The minor version. + +``CUDA_VERSION``, ``CUDA_VERSION_STRING`` + Full version in the ``X.Y`` format. + +``CUDA_HAS_FP16`` + .. versionadded:: 3.6 + Whether a short float (``float16``, ``fp16``) is supported. + +``CUDA_TOOLKIT_ROOT_DIR`` + Path to the CUDA Toolkit (defined if not set). + +``CUDA_SDK_ROOT_DIR`` + Path to the CUDA SDK. Use this to find files in the SDK. This script will + not directly support finding specific libraries or headers, as that isn't + supported by NVIDIA. If you want to change libraries when the path changes + see the ``FindCUDA.cmake`` script for an example of how to clear these + variables. There are also examples of how to use the ``CUDA_SDK_ROOT_DIR`` + to locate headers or libraries, if you so choose (at your own risk). + +``CUDA_INCLUDE_DIRS`` + Include directory for cuda headers. Added automatically + for ``cuda_add_executable()`` and ``cuda_add_library()``. + +``CUDA_LIBRARIES`` + Cuda RT library. + +``CUDA_CUFFT_LIBRARIES`` + Device or emulation library for the Cuda FFT implementation (alternative to + ``cuda_add_cufft_to_target()`` macro) + +``CUDA_CUBLAS_LIBRARIES`` + Device or emulation library for the Cuda BLAS implementation (alternative to + ``cuda_add_cublas_to_target()`` macro). + +``CUDA_cudart_static_LIBRARY`` + Statically linkable cuda runtime library. + Only available for CUDA version 5.5+. + +``CUDA_cudadevrt_LIBRARY`` + .. versionadded:: 3.7 + Device runtime library. Required for separable compilation. + +``CUDA_cupti_LIBRARY`` + CUDA Profiling Tools Interface library. + Only available for CUDA version 4.0+. + +``CUDA_curand_LIBRARY`` + CUDA Random Number Generation library. + Only available for CUDA version 3.2+. + +``CUDA_cusolver_LIBRARY`` + .. versionadded:: 3.2 + CUDA Direct Solver library. + Only available for CUDA version 7.0+. + +``CUDA_cusparse_LIBRARY`` + CUDA Sparse Matrix library. + Only available for CUDA version 3.2+. + +``CUDA_npp_LIBRARY`` + NVIDIA Performance Primitives lib. + Only available for CUDA version 4.0+. + +``CUDA_nppc_LIBRARY`` + NVIDIA Performance Primitives lib (core). + Only available for CUDA version 5.5+. + +``CUDA_nppi_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 5.5 - 8.0. + +``CUDA_nppial_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppicc_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppicom_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0 - 10.2. + Replaced by nvjpeg. + +``CUDA_nppidei_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppif_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppig_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppim_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppist_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppisu_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_nppitc_LIBRARY`` + NVIDIA Performance Primitives lib (image processing). + Only available for CUDA version 9.0. + +``CUDA_npps_LIBRARY`` + NVIDIA Performance Primitives lib (signal processing). + Only available for CUDA version 5.5+. + +``CUDA_nvcuvenc_LIBRARY`` + CUDA Video Encoder library. + Only available for CUDA version 3.2+. + Windows only. + +``CUDA_nvcuvid_LIBRARY`` + CUDA Video Decoder library. + Only available for CUDA version 3.2+. + Windows only. + +``CUDA_nvToolsExt_LIBRARY`` + .. versionadded:: 3.16 + NVIDA CUDA Tools Extension library. + Available for CUDA version 5+. + +``CUDA_OpenCL_LIBRARY`` + .. versionadded:: 3.16 + NVIDA CUDA OpenCL library. + Available for CUDA version 5+. #]=======================================================================] diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index b3c8569..61e264b 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -11,6 +11,9 @@ This script locates the NVIDIA CUDA toolkit and the associated libraries, but does not require the ``CUDA`` language be enabled for a given project. This module does not search for the NVIDIA CUDA Samples. +.. versionadded:: 3.19 + QNX support. + Search Behavior ^^^^^^^^^^^^^^^ @@ -426,6 +429,8 @@ Result variables Runtime library ``cudart``. ``CUDAToolkit_LIBRARY_ROOT`` + .. versionadded:: 3.18 + The path to the CUDA Toolkit directory containing the nvvm directory and version.txt. diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 74b36c6..e37d225 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -7,8 +7,11 @@ FindCURL Find the native CURL headers and libraries. -This module accept optional COMPONENTS to check supported features and -protocols:: +.. versionadded:: 3.14 + This module accept optional COMPONENTS to check supported features and + protocols: + +:: PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP @@ -18,6 +21,8 @@ protocols:: IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if curl has been found. @@ -38,9 +43,14 @@ This module defines the following variables: ``CURL_VERSION_STRING`` The version of ``curl`` found. +.. versionadded:: 3.13 + Debug and Release variants are found separately. + CURL CMake ^^^^^^^^^^ +.. versionadded:: 3.17 + If CURL was built using the CMake buildsystem then it provides its own ``CURLConfig.cmake`` file for use with the :command:`find_package` command's config mode. This module looks for this file and, if found, diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 4e8232d..cf0d341 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -13,6 +13,8 @@ features this function (i.e. at least ``1.1.19``) Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.15 + This module defines :prop_tgt:`IMPORTED` target ``Cups::Cups``, if Cups has been found. diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index cde3a4d..5e25deb 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -19,6 +19,8 @@ This module defines the following variables: ``CURSES_LIBRARIES`` The libraries needed to use Curses. ``CURSES_CFLAGS`` + .. versionadded:: 3.16 + Parameters which ought be given to C/C++ compilers when using Curses. ``CURSES_HAVE_CURSES_H`` True if curses.h is available. @@ -31,8 +33,10 @@ This module defines the following variables: Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the ``find_package(Curses)`` call if NCurses functionality is required. -Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the -``find_package(Curses)`` call if unicode functionality is required. + +.. versionadded:: 3.10 + Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the + ``find_package(Curses)`` call if unicode functionality is required. Backward Compatibility ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 81fbbb7..bbf941e 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -6,8 +6,7 @@ FindDoxygen ----------- Doxygen is a documentation generation tool (see http://www.doxygen.org). -This module looks for Doxygen and some optional tools it supports. These -tools are enabled as components in the :command:`find_package` command: +This module looks for Doxygen and some optional tools it supports: ``dot`` `Graphviz <http://graphviz.org>`_ ``dot`` utility used to render various @@ -19,7 +18,9 @@ tools are enabled as components in the :command:`find_package` command: `Dia <https://wiki.gnome.org/Apps/Dia>`_ the diagram editor used by Doxygen's ``\diafile`` command. -Examples: +.. versionadded:: 3.9 + These tools are available as components in the :command:`find_package` command. + For example: .. code-block:: cmake @@ -38,12 +39,13 @@ The following variables are defined by this module: The version reported by ``doxygen --version``. -The module defines ``IMPORTED`` targets for Doxygen and each component found. -These can be used as part of custom commands, etc. and should be preferred over -old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The -following import targets are defined if their corresponding executable could be -found (the component import targets will only be defined if that component was -requested): +.. versionadded:: 3.9 + The module defines ``IMPORTED`` targets for Doxygen and each component found. + These can be used as part of custom commands, etc. and should be preferred over + old-style (and now deprecated) variables like ``DOXYGEN_EXECUTABLE``. The + following import targets are defined if their corresponding executable could be + found (the component import targets will only be defined if that component was + requested): :: @@ -58,6 +60,8 @@ Functions .. command:: doxygen_add_docs + .. versionadded:: 3.9 + This function is intended as a convenience for adding a target for generating documentation with Doxygen. It aims to provide sensible defaults so that projects can generally just provide the input files and directories and that @@ -93,19 +97,21 @@ Functions the :command:`add_custom_target` command used to create the custom target internally. - If ``ALL`` is set, the target will be added to the default build target. - - If ``USE_STAMP_FILE`` is set, the custom command defined by this function will - create a stamp file with the name ``<targetName>.stamp`` in the current - binary directory whenever doxygen is re-run. With this option present, all - items in ``<filesOrDirs>`` must be files (i.e. no directories, symlinks or - wildcards) and each of the files must exist at the time - ``doxygen_add_docs()`` is called. An error will be raised if any of the - items listed is missing or is not a file when ``USE_STAMP_FILE`` is given. - A dependency will be created on each of the files so that doxygen will only - be re-run if one of the files is updated. Without the ``USE_STAMP_FILE`` - option, doxygen will always be re-run if the ``<targetName>`` target is built - regardless of whether anything listed in ``<filesOrDirs>`` has changed. + .. versionadded:: 3.12 + If ``ALL`` is set, the target will be added to the default build target. + + .. versionadded:: 3.16 + If ``USE_STAMP_FILE`` is set, the custom command defined by this function will + create a stamp file with the name ``<targetName>.stamp`` in the current + binary directory whenever doxygen is re-run. With this option present, all + items in ``<filesOrDirs>`` must be files (i.e. no directories, symlinks or + wildcards) and each of the files must exist at the time + ``doxygen_add_docs()`` is called. An error will be raised if any of the + items listed is missing or is not a file when ``USE_STAMP_FILE`` is given. + A dependency will be created on each of the files so that doxygen will only + be re-run if one of the files is updated. Without the ``USE_STAMP_FILE`` + option, doxygen will always be re-run if the ``<targetName>`` target is built + regardless of whether anything listed in ``<filesOrDirs>`` has changed. The contents of the generated ``Doxyfile`` can be customized by setting CMake variables before calling ``doxygen_add_docs()``. Any variable with a name of @@ -308,18 +314,19 @@ if they contain at least one space: WARN_LOGFILE XML_OUTPUT -There are situations where it may be undesirable for a particular config option -to be automatically quoted by ``doxygen_add_docs()``, such as ``ALIASES`` which -may need to include its own embedded quoting. The ``DOXYGEN_VERBATIM_VARS`` -variable can be used to specify a list of Doxygen variables (including the -leading ``DOXYGEN_`` prefix) which should not be quoted. The project is then -responsible for ensuring that those variables' values make sense when placed -directly in the Doxygen input file. In the case of list variables, list items -are still separated by spaces, it is only the automatic quoting that is -skipped. For example, the following allows ``doxygen_add_docs()`` to apply -quoting to ``DOXYGEN_PROJECT_BRIEF``, but not each item in the -``DOXYGEN_ALIASES`` list (:ref:`bracket syntax <Bracket Argument>` can also -be used to make working with embedded quotes easier): +.. versionadded:: 3.11 + There are situations where it may be undesirable for a particular config option + to be automatically quoted by ``doxygen_add_docs()``, such as ``ALIASES`` which + may need to include its own embedded quoting. The ``DOXYGEN_VERBATIM_VARS`` + variable can be used to specify a list of Doxygen variables (including the + leading ``DOXYGEN_`` prefix) which should not be quoted. The project is then + responsible for ensuring that those variables' values make sense when placed + directly in the Doxygen input file. In the case of list variables, list items + are still separated by spaces, it is only the automatic quoting that is + skipped. For example, the following allows ``doxygen_add_docs()`` to apply + quoting to ``DOXYGEN_PROJECT_BRIEF``, but not each item in the + ``DOXYGEN_ALIASES`` list (:ref:`bracket syntax <Bracket Argument>` can also + be used to make working with embedded quotes easier): .. code-block:: cmake @@ -341,6 +348,8 @@ The resultant ``Doxyfile`` will contain the following lines: Deprecated Result Variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. deprecated:: 3.9 + For compatibility with previous versions of CMake, the following variables are also defined but they are deprecated and should no longer be used: @@ -375,6 +384,8 @@ are also defined but they are deprecated and should no longer be used: Deprecated Hint Variables ^^^^^^^^^^^^^^^^^^^^^^^^^ +.. deprecated:: 3.9 + .. variable:: DOXYGEN_SKIP_DOT This variable has no effect for the component form of ``find_package``. diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index b0bb02a..f9cb432 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -11,6 +11,8 @@ Expat is a stream-oriented XML parser library written in C. Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.10 + This module defines the following :prop_tgt:`IMPORTED` targets: ``EXPAT::EXPAT`` diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 1384736..e67e931 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -37,11 +37,20 @@ If flex is found on the system, the module provides the macro: ) which creates a custom command to generate the ``FlexOutput`` file from -the ``FlexInput`` file. If ``COMPILE_FLAGS`` option is specified, the next -parameter is added to the flex command line. If flex is configured to -output a header file, the ``DEFINES_FILE`` option may be used to specify its -name. Name is an alias used to get details of this custom command. -Indeed the macro defines the following variables: +the ``FlexInput`` file. Name is an alias used to get details of this custom +command. If ``COMPILE_FLAGS`` option is specified, the next +parameter is added to the flex command line. + +.. versionadded:: 3.5 + If flex is configured to + output a header file, the ``DEFINES_FILE`` option may be used to specify its + name. + +.. versionchanged:: 3.17 + When :policy:`CMP0098` is set to ``NEW``, ``flex`` runs in the + :variable:`CMAKE_CURRENT_BINARY_DIR` directory. + +The macro defines the following variables: :: diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index e273642..e1e239a 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -77,6 +77,10 @@ The following cache variables are also available to set or use: ``FLTK_IMAGES_LIBRARY_DEBUG`` The FLTK Images library (debug) + +.. versionadded:: 3.11 + Debug and Release variants are found separately and use per-configuration + variables. #]=======================================================================] if(NOT FLTK_SKIP_OPENGL) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 3e6a177..82885cb 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -10,6 +10,8 @@ Find the FreeType font renderer includes and library. Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.10 + This module defines the following :prop_tgt:`IMPORTED` target: ``Freetype::Freetype`` @@ -33,7 +35,10 @@ This module will set the following variables in your project: ``FREETYPE_LIBRARIES`` the library to link against ``FREETYPE_VERSION_STRING`` - the version of freetype found (since CMake 2.8.8) + the version of freetype found + +.. versionadded:: 3.7 + Debug and Release variants are found separately. Hints ^^^^^ diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index fde84d4..406a738 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -10,6 +10,8 @@ Find Geospatial Data Abstraction Library (GDAL). IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.14 + This module defines :prop_tgt:`IMPORTED` target ``GDAL::GDAL`` if GDAL has been found. @@ -25,7 +27,8 @@ This module will set the following variables in your project: ``GDAL_LIBRARIES`` Libraries to link to GDAL. ``GDAL_VERSION`` - The version of GDAL found. + .. versionadded:: 3.14 + The version of GDAL found. Cache variables ^^^^^^^^^^^^^^^ diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index 187b6a8..b9ebe08 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -21,6 +21,8 @@ The following variables may be set to influence this module's behavior: Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.1 + This module defines the following :ref:`Imported Targets <Imported Targets>`: @@ -55,6 +57,9 @@ This module defines the following variables: ``GLEW_VERSION_MICRO`` GLEW micro version +.. versionadded:: 3.7 + Debug and Release variants are found separately. + #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index a22bf5b..c81d971 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -10,6 +10,8 @@ Find OpenGL Utility Toolkit (GLUT) library and include files. IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.1 + This module defines the :prop_tgt:`IMPORTED` targets: ``GLUT::GLUT`` @@ -33,6 +35,9 @@ Also defined, but not for general use are: GLUT_glut_LIBRARY = the full path to the glut library. GLUT_Xmu_LIBRARY = the full path to the Xmu library. GLUT_Xi_LIBRARY = the full path to the Xi Library. + +.. versionadded:: 3.13 + Debug and Release variants are found separately. #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 62f1614..7036b66 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -16,6 +16,23 @@ module. See example below. * ``glade`` * ``glademm`` +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets (subject to +component selection): + +``GTK2::atk``, ``GTK2::atkmm``, ``GTK2::cairo``, ``GTK2::cairomm``, +``GTK2::gdk_pixbuf``, ``GTK2::gdk``, ``GTK2::gdkmm``, ``GTK2::gio``, +``GTK2::giomm``, ``GTK2::glade``, ``GTK2::glademm``, ``GTK2::glib``, +``GTK2::glibmm``, ``GTK2::gmodule``, ``GTK2::gobject``, ``GTK2::gthread``, +``GTK2::gtk``, ``GTK2::gtkmm``, ``GTK2::harfbuzz``, ``GTK2::pango``, +``GTK2::pangocairo``, ``GTK2::pangoft2``, ``GTK2::pangomm``, +``GTK2::pangoxft``, ``GTK2::sigc``. + +.. versionadded:: 3.16.7 + Added the ``GTK2::harfbuzz`` target. + Result Variables ^^^^^^^^^^^^^^^^ @@ -28,7 +45,8 @@ The following variables will be defined for your use ``GTK2_LIBRARIES`` All libraries ``GTK2_TARGETS`` - All imported targets + .. versionadded:: 3.5 + All imported targets ``GTK2_DEFINITIONS`` Additional compiler flags ``GTK2_VERSION`` @@ -40,6 +58,10 @@ The following variables will be defined for your use ``GTK2_PATCH_VERSION`` The patch version of GTK2 +.. versionadded:: 3.5 + When ``GTK2_USE_IMPORTED_TARGETS`` is set to ``TRUE``, ``GTK2_LIBRARIES`` + will list imported targets instead of library paths. + Input Variables ^^^^^^^^^^^^^^^ diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 53cab1a..8e22f79 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -7,10 +7,24 @@ FindGTest Locate the Google C++ Testing Framework. +.. versionadded:: 3.20 + Upstream ``GTestConfig.cmake`` is used if possible. + Imported targets ^^^^^^^^^^^^^^^^ -This module defines the following :prop_tgt:`IMPORTED` targets: +.. versionadded:: 3.20 + This module defines the following :prop_tgt:`IMPORTED` targets: + +``GTest::gtest`` + The Google Test ``gtest`` library, if found; adds Thread::Thread + automatically +``GTest::gtest_main`` + The Google Test ``gtest_main`` library, if found + +.. deprecated:: 3.20 + For backwards compatibility, this module defines additionally the + following deprecated :prop_tgt:`IMPORTED` targets (available since 3.5): ``GTest::GTest`` The Google Test ``gtest`` library, if found; adds Thread::Thread @@ -24,7 +38,7 @@ Result variables This module will set the following variables in your project: -``GTEST_FOUND`` +``GTest_FOUND`` Found the Google Testing framework ``GTEST_INCLUDE_DIRS`` the directory containing the Google Test headers @@ -62,7 +76,7 @@ Example usage find_package(GTest REQUIRED) add_executable(foo foo.cc) - target_link_libraries(foo GTest::GTest GTest::Main) + target_link_libraries(foo GTest::gtest GTest::gtest_main) add_test(AllTestsInFoo foo) @@ -72,6 +86,10 @@ Deeper integration with CTest See :module:`GoogleTest` for information on the :command:`gtest_add_tests` and :command:`gtest_discover_tests` commands. + +.. versionchanged:: 3.9 + Previous CMake versions defined :command:`gtest_add_tests` macro in this + module. #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake) @@ -146,8 +164,41 @@ function(__gtest_import_library _target _var _config) endif() endfunction() +function(__gtest_define_backwards_compatible_library_targets) + set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} PARENT_SCOPE) + + # Add targets mapping the same library names as defined in + # older versions of CMake's FindGTest + if(NOT TARGET GTest::GTest) + add_library(GTest::GTest INTERFACE IMPORTED) + target_link_libraries(GTest::GTest INTERFACE GTest::gtest) + endif() + if(NOT TARGET GTest::Main) + add_library(GTest::Main INTERFACE IMPORTED) + target_link_libraries(GTest::Main INTERFACE GTest::gtest_main) + endif() +endfunction() + # +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# first specifically look for the CMake version of GTest +find_package(GTest QUIET NO_MODULE) + +# if we found the GTest cmake package then we are done, and +# can print what we found and return. +if(GTest_FOUND) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest HANDLE_COMPONENTS CONFIG_MODE) + + set(GTEST_LIBRARIES GTest::gtest) + set(GTEST_MAIN_LIBRARIES GTest::gtest_main) + + __gtest_define_backwards_compatible_library_targets() + + return() +endif() + if(NOT DEFINED GTEST_MSVC_SEARCH) set(GTEST_MSVC_SEARCH MD) endif() @@ -201,54 +252,43 @@ else() __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) -if(GTEST_FOUND) +if(GTest_FOUND) set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) __gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) __gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) - set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) find_package(Threads QUIET) - if(NOT TARGET GTest::GTest) + if(NOT TARGET GTest::gtest) __gtest_determine_library_type(GTEST_LIBRARY) - add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED) + add_library(GTest::gtest ${GTEST_LIBRARY_TYPE} IMPORTED) if(TARGET Threads::Threads) - set_target_properties(GTest::GTest PROPERTIES + set_target_properties(GTest::gtest PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads) endif() if(GTEST_LIBRARY_TYPE STREQUAL "SHARED") - set_target_properties(GTest::GTest PROPERTIES + set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") endif() if(GTEST_INCLUDE_DIRS) - set_target_properties(GTest::GTest PROPERTIES + set_target_properties(GTest::gtest PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}") endif() - __gtest_import_library(GTest::GTest GTEST_LIBRARY "") - __gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE") - __gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG") + __gtest_import_library(GTest::gtest GTEST_LIBRARY "") + __gtest_import_library(GTest::gtest GTEST_LIBRARY "RELEASE") + __gtest_import_library(GTest::gtest GTEST_LIBRARY "DEBUG") endif() - if(NOT TARGET GTest::Main) + if(NOT TARGET GTest::gtest_main) __gtest_determine_library_type(GTEST_MAIN_LIBRARY) - add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED) - set_target_properties(GTest::Main PROPERTIES - INTERFACE_LINK_LIBRARIES "GTest::GTest") - __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "") - __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE") - __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG") + add_library(GTest::gtest_main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED) + set_target_properties(GTest::gtest_main PROPERTIES + INTERFACE_LINK_LIBRARIES "GTest::gtest") + __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "") + __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "RELEASE") + __gtest_import_library(GTest::gtest_main GTEST_MAIN_LIBRARY "DEBUG") endif() - # Add targets mapping the same library names as defined in - # GTest's CMake package config. - if(NOT TARGET GTest::gtest) - add_library(GTest::gtest INTERFACE IMPORTED) - target_link_libraries(GTest::gtest INTERFACE GTest::GTest) - endif() - if(NOT TARGET GTest::gtest_main) - add_library(GTest::gtest_main INTERFACE IMPORTED) - target_link_libraries(GTest::gtest_main INTERFACE GTest::Main) - endif() + __gtest_define_backwards_compatible_library_targets() endif() diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 213ad13..252f2ae 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -54,7 +54,7 @@ PO_FILES <po1> <po2> ... ) If ALL is specified, the po files are processed when building the all traget. It creates a custom target "pofiles". -.. note:: +.. versionadded:: 3.2 If you wish to use the Gettext library (libintl), use :module:`FindIntl`. #]=======================================================================] diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 3491cdc..f8346b6 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -5,12 +5,6 @@ FindGit ------- -The module defines the following ``IMPORTED`` targets (when -:prop_gbl:`CMAKE_ROLE` is ``PROJECT``): - -``Git::Git`` - Executable of the Git command-line client. - The module defines the following variables: ``GIT_EXECUTABLE`` @@ -20,6 +14,13 @@ The module defines the following variables: ``GIT_VERSION_STRING`` The version of Git found. +.. versionadded:: 3.14 + The module defines the following ``IMPORTED`` targets (when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): + +``Git::Git`` + Executable of the Git command-line client. + Example usage: .. code-block:: cmake diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 819f000..782a72b 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -10,6 +10,8 @@ Find the GNU Transport Layer Security library (gnutls) IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + This module defines :prop_tgt:`IMPORTED` target ``GnuTLS::GnuTLS``, if gnutls has been found. diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 0c1e93b..12f4c17 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -32,6 +32,9 @@ static link to a dynamic link for ``HDF5`` and all of it's dependencies. To use this feature, make sure that the ``HDF5_USE_STATIC_LIBRARIES`` variable is set before the call to find_package. +.. versionadded:: 3.10 + Support for ``HDF5_USE_STATIC_LIBRARIES`` on Windows. + Both the serial and parallel ``HDF5`` wrappers are considered and the first directory to contain either one will be used. In the event that both appear in the same directory the serial version is preferentially selected. This @@ -51,7 +54,8 @@ This module will set the following variables in your project: ``HDF5_FOUND`` HDF5 was found on the system ``HDF5_VERSION`` - HDF5 library version + .. versionadded:: 3.3 + HDF5 library version ``HDF5_INCLUDE_DIRS`` Location of the HDF5 header files ``HDF5_DEFINITIONS`` @@ -128,12 +132,18 @@ Hints The following variables can be set to guide the search for HDF5 libraries and includes: ``HDF5_PREFER_PARALLEL`` + .. versionadded:: 3.4 + set ``true`` to prefer parallel HDF5 (by default, serial is preferred) ``HDF5_FIND_DEBUG`` + .. versionadded:: 3.9 + Set ``true`` to get extra debugging output. ``HDF5_NO_FIND_PACKAGE_CONFIG_FILE`` + .. versionadded:: 3.8 + Set ``true`` to skip trying to find ``hdf5-config.cmake``. #]=======================================================================] diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index 1358363..e9f2c82 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -15,7 +15,8 @@ The module defines the following variables: HG_FOUND - true if the command line client was found HG_VERSION_STRING - the version of mercurial found -If the command line client executable is found the following macro is defined: +.. versionadded:: 3.1 + If the command line client executable is found the following macro is defined: :: diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake index c8b3e1f..2bb49ad 100644 --- a/Modules/FindICU.cmake +++ b/Modules/FindICU.cmake @@ -18,6 +18,9 @@ Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named ``in``; any of the names may be used, and the appropriate platform-specific library name will be automatically selected. +.. versionadded:: 3.11 + Added support for static libraries on Windows. + This module reports information about the ICU installation in several variables. General variables:: @@ -31,7 +34,7 @@ Imported targets:: ICU::<C> Where ``<C>`` is the name of an ICU component, for example -``ICU::i18n``. +``ICU::i18n``; ``<C>`` is lower-case. ICU programs are reported in:: @@ -54,16 +57,14 @@ ICU programs are reported in:: ICU component libraries are reported in:: - ICU_<C>_FOUND - ON if component was found - ICU_<C>_LIBRARIES - libraries for component + ICU_<C>_FOUND - ON if component was found; ``<C>`` is upper-case. + ICU_<C>_LIBRARIES - libraries for component; ``<C>`` is upper-case. ICU datafiles are reported in:: ICU_MAKEFILE_INC - Makefile.inc ICU_PKGDATA_INC - pkgdata.inc -Note that ``<C>`` is the uppercased name of the component. - This module reads hints about search results from:: ICU_ROOT - the root of the ICU installation @@ -73,9 +74,9 @@ ICU_ROOT variable takes precedence. The following cache variables may also be set:: - ICU_<P>_EXECUTABLE - the path to executable <P> + ICU_<P>_EXECUTABLE - the path to executable <P>; ``<P>`` is upper-case. ICU_INCLUDE_DIR - the directory containing the ICU headers - ICU_<C>_LIBRARY - the library for component <C> + ICU_<C>_LIBRARY - the library for component <C>; ``<C>`` is upper-case. .. note:: @@ -188,7 +189,8 @@ function(_ICU_FIND) set(component_cache "ICU_${component_upcase}_LIBRARY") set(component_cache_release "${component_cache}_RELEASE") set(component_cache_debug "${component_cache}_DEBUG") - set(component_found "${component_upcase}_FOUND") + set(component_found "ICU_${component_upcase}_FOUND") + set(component_found_compat "${component_upcase}_FOUND") set(component_libnames "icu${component}") set(component_debug_libnames "icu${component}d") @@ -250,12 +252,15 @@ function(_ICU_FIND) mark_as_advanced("${component_cache_release}" "${component_cache_debug}") if(${component_cache}) set("${component_found}" ON) + set("${component_found_compat}" ON) list(APPEND ICU_LIBRARY "${${component_cache}}") endif() mark_as_advanced("${component_found}") + mark_as_advanced("${component_found_compat}") set("${component_cache}" "${${component_cache}}" PARENT_SCOPE) set("${component_found}" "${${component_found}}" PARENT_SCOPE) - if(${component_found}) + set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE) + if(component_found OR component_found_compat) if (ICU_FIND_REQUIRED_${component}) list(APPEND ICU_LIBS_FOUND "${component} (required)") else() @@ -346,7 +351,7 @@ if(ICU_FOUND) set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE") set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG") set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES") - set(_ICU_component_found "${_ICU_component_upcase}_FOUND") + set(_ICU_component_found "ICU_${_ICU_component_upcase}_FOUND") set(_ICU_imported_target "ICU::${_ICU_component}") if(${_ICU_component_found}) set("${_ICU_component_lib}" "${${_ICU_component_cache}}") @@ -400,7 +405,7 @@ if(ICU_DEBUG) foreach(program IN LISTS icu_programs) string(TOUPPER "${program}" program_upcase) set(program_lib "ICU_${program_upcase}_EXECUTABLE") - message(STATUS "${program} program: ${${program_lib}}") + message(STATUS "${program} program: ${program_lib}=${${program_lib}}") unset(program_upcase) unset(program_lib) endforeach() @@ -409,7 +414,7 @@ if(ICU_DEBUG) string(TOUPPER "${data}" data_upcase) string(REPLACE "." "_" data_upcase "${data_upcase}") set(data_lib "ICU_${data_upcase}") - message(STATUS "${data} data: ${${data_lib}}") + message(STATUS "${data} data: ${data_lib}=${${data_lib}}") unset(data_upcase) unset(data_lib) endforeach() @@ -417,12 +422,15 @@ if(ICU_DEBUG) foreach(component IN LISTS ICU_FIND_COMPONENTS) string(TOUPPER "${component}" component_upcase) set(component_lib "ICU_${component_upcase}_LIBRARIES") - set(component_found "${component_upcase}_FOUND") - message(STATUS "${component} library found: ${${component_found}}") - message(STATUS "${component} library: ${${component_lib}}") + set(component_found "ICU_${component_upcase}_FOUND") + set(component_found_compat "${component_upcase}_FOUND") + message(STATUS "${component} library found: ${component_found}=${${component_found}}") + message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}") + message(STATUS "${component} library: ${component_lib}=${${component_lib}}") unset(component_upcase) unset(component_lib) unset(component_found) + unset(component_found_compat) endforeach() message(STATUS "----------------") endif() diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 0f821e8..543e10c 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -23,6 +23,15 @@ Ice 3.7 and later also include C++11-specific components: Note that the set of supported components is Ice version-specific. +.. versionadded:: 3.4 + Imported targets for components and most ``EXECUTABLE`` variables. + +.. versionadded:: 3.7 + Debug and Release variants are found separately. + +.. versionadded:: 3.10 + Ice 3.7 support, including new components, programs and the Nuget package. + This module reports information about the Ice installation in several variables. General variables:: @@ -56,6 +65,9 @@ Ice slice programs are reported in:: Ice_SLICE2PY_EXECUTABLE - path to slice2py executable Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable +.. versionadded:: 3.14 + Variables for ``slice2confluence`` and ``slice2matlab``. + Ice programs are reported in:: Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 8bf5123..d7de0dd 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -7,6 +7,9 @@ FindImageMagick Find ImageMagick binary suite. +.. versionadded:: 3.9 + Added support for ImageMagick 7. + This module will search for a set of ImageMagick tools specified as components in the :command:`find_package` call. Typical components include, but are not limited to (future versions of ImageMagick might have diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake index 1a09a60..686c818 100644 --- a/Modules/FindIntl.cmake +++ b/Modules/FindIntl.cmake @@ -16,10 +16,21 @@ installation in several variables. General variables:: Intl_INCLUDE_DIRS - the directory containing the libintl headers Intl_LIBRARIES - libintl libraries to be linked +.. versionadded:: 3.20 + This module defines :prop_tgt:`IMPORTED` target ``Intl::Intl``. + The following cache variables may also be set:: Intl_INCLUDE_DIR - the directory containing the libintl headers Intl_LIBRARY - the libintl library (if any) + Intl_HAVE_GETTEXT_BUILTIN - check if gettext is in the C library + Intl_HAVE_DCGETTEXT_BUILTIN - check if dcgettext is in the C library + Intl_IS_BUILTIN - whether intl is a part of the C library determined + from the result of Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN + +.. versionadded:: 3.20 + Added the ``Intl_HAVE_GETTEXT_BUILTIN``, ``Intl_HAVE_DCGETTEXT_BUILTIN`` and + ``Intl_IS_BUILTIN`` variables. .. note:: On some platforms, such as Linux with GNU libc, the gettext @@ -35,6 +46,22 @@ The following cache variables may also be set:: # Written by Roger Leigh <rleigh@codelibre.net> +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) + +# Check if we have libintl is a part of libc +cmake_push_check_state(RESET) +set(CMAKE_REQUIRED_QUIET TRUE) +check_symbol_exists(gettext libintl.h Intl_HAVE_GETTEXT_BUILTIN) +check_symbol_exists(dcgettext libintl.h Intl_HAVE_DCGETTEXT_BUILTIN) # redundant check +cmake_pop_check_state() + +if(Intl_HAVE_GETTEXT_BUILTIN AND Intl_HAVE_DCGETTEXT_BUILTIN) + set(Intl_IS_BUILTIN TRUE) +else() + set(Intl_IS_BUILTIN FALSE) +endif() + # Find include directory find_path(Intl_INCLUDE_DIR NAMES "libintl.h" @@ -42,21 +69,28 @@ find_path(Intl_INCLUDE_DIR mark_as_advanced(Intl_INCLUDE_DIR) # Find all Intl libraries -find_library(Intl_LIBRARY "intl" NAMES_PER_DIR - DOC "libintl libraries (if not in the C library)") -mark_as_advanced(Intl_LIBRARY) +set(Intl_REQUIRED_VARS) +if(NOT Intl_IS_BUILTIN) + find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR + DOC "libintl libraries (if not in the C library)") + mark_as_advanced(Intl_LIBRARY) + list(APPEND Intl_REQUIRED_VARS Intl_LIBRARY) +endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl FOUND_VAR Intl_FOUND - REQUIRED_VARS Intl_INCLUDE_DIR + REQUIRED_VARS Intl_INCLUDE_DIR ${Intl_REQUIRED_VARS} FAIL_MESSAGE "Failed to find Gettext libintl") +unset(Intl_REQUIRED_VARS) if(Intl_FOUND) set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}") - if(Intl_LIBRARY) - set(Intl_LIBRARIES "${Intl_LIBRARY}") - else() - unset(Intl_LIBRARIES) + set(Intl_LIBRARIES "${Intl_LIBRARY}") + if(NOT TARGET Intl::Intl) + add_library(Intl::Intl INTERFACE IMPORTED) + set_target_properties(Intl::Intl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Intl_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}") endif() endif() diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 632fc9a..3f243de 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -10,6 +10,8 @@ Find the Joint Photographic Experts Group (JPEG) library (``libjpeg``) Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + This module defines the following :prop_tgt:`IMPORTED` targets: ``JPEG::JPEG`` @@ -27,7 +29,8 @@ This module will set the following variables in your project: ``JPEG_LIBRARIES`` the libraries needed to use JPEG. ``JPEG_VERSION`` - the version of the JPEG library found + .. versionadded:: 3.12 + the version of the JPEG library found Cache variables ^^^^^^^^^^^^^^^ @@ -41,6 +44,9 @@ The following cache variables may also be set: ``JPEG_LIBRARY_DEBUG`` where to find the JPEG library (debug). +.. versionadded:: 3.12 + Debug and Release variand are found separately. + Obsolete variables ^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9db740b..4f0e0fe 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -13,6 +13,9 @@ to specify a Java installation prefix explicitly. See also the :module:`FindJNI` module to find Java Native Interface (JNI). +.. versionadded:: 3.10 + Added support for Java 9+ version parsing. + Specify one or more of the following components as you call this find module. See example below. :: @@ -41,7 +44,9 @@ This module sets the following result variables: Java_VERSION_TWEAK = The tweak version of the package found (after '_') Java_VERSION = This is set to: $major[.$minor[.$patch[.$tweak]]] - +.. versionadded:: 3.4 + Added the ``Java_IDLJ_EXECUTABLE`` and ``Java_JARSIGNER_EXECUTABLE`` + variables. The minimum required version of Java can be specified using the :command:`find_package` syntax, e.g. diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 4b71cee..d5af5da 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -43,14 +43,40 @@ The following variables may be set to influence this module's behavior: * ``Arm_mp`` * ``Arm_ilp64`` * ``Arm_ilp64_mp`` + * ``EML`` + * ``EML_mt`` * ``Generic`` + .. versionadded:: 3.6 + ``OpenBLAS`` support. + + .. versionadded:: 3.11 + ``FLAME`` support. + + .. versionadded:: 3.13 + Added ILP64 MKL variants (``Intel10_64ilp``, ``Intel10_64ilp_seq``). + + .. versionadded:: 3.17 + Added single dynamic library MKL variant (``Intel10_64_dyn``). + + .. versionadded:: 3.18 + Arm Performance Libraries support (``Arm``, ``Arm_mp``, ``Arm_ilp64``, + ``Arm_ilp64_mp``). + + .. versionadded:: 3.19 + ``FlexiBLAS`` support. + + .. versionadded:: 3.20 + Elbrus Math Library support (``EML``, ``EML_mt``). + ``BLA_F95`` if ``ON`` tries to find the BLAS95/LAPACK95 interfaces Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.18 + This module defines the following :prop_tgt:`IMPORTED` target: ``LAPACK::LAPACK`` @@ -494,6 +520,30 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) ) endif() + # Elbrus Math Library? + if(NOT LAPACK_LIBRARIES + AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")) + + set(LAPACK_EML_LIB "eml") + + # Check for OpenMP support, VIA BLA_VENDOR of eml_mt + if(BLA_VENDOR MATCHES "_mt") + set(LAPACK_EML_LIB "${LAPACK_EML_LIB}_mt") + endif() + + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "${LAPACK_EML_LIB}" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + # Generic LAPACK library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Generic" diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index b0dad7d..1e82651 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -11,6 +11,10 @@ This module finds an installed LaTeX and determines the location of the compiler. Additionally the module looks for Latex-related software like BibTeX. +.. versionadded:: 3.2 + Component processing; support for htlatex, pdftops, Biber, xindy, XeLaTeX, + LuaLaTeX. + This module sets the following result variables:: LATEX_FOUND: whether found Latex and requested components diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake index ce3c8b8..08078a2 100644 --- a/Modules/FindLibArchive.cmake +++ b/Modules/FindLibArchive.cmake @@ -22,6 +22,10 @@ The module defines the following ``IMPORTED`` targets: :: LibArchive::LibArchive - target for linking against libarchive + +.. versionadded:: 3.6 + Support for new libarchive 3.2 version string format. + #]=======================================================================] find_path(LibArchive_INCLUDE_DIR diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 4a79a10..9ec8f07 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -11,6 +11,8 @@ Find LZMA compression algorithm headers and library. Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.14 + This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if liblzma has been found. diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 0631607..ce28d03 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -10,12 +10,16 @@ Find the XML processing library (libxml2). IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + The following :prop_tgt:`IMPORTED` targets may be defined: ``LibXml2::LibXml2`` - If the libxml2 library has been found + libxml2 library. ``LibXml2::xmllint`` - If the xmllint command-line executable has been found + .. versionadded:: 3.17 + + xmllint command-line executable. Result variables ^^^^^^^^^^^^^^^^ diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index fc7adeb..97943d6 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -11,6 +11,8 @@ Transformations (XSLT) library (LibXslt) IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.18 + The following :prop_tgt:`IMPORTED` targets may be defined: ``LibXslt::LibXslt`` @@ -35,7 +37,8 @@ Additionally, the following two variables are set (but not required for using xslt): ``LIBXSLT_EXSLT_INCLUDE_DIR`` - The include directory for exslt. + .. versionadded:: 3.18 + The include directory for exslt. ``LIBXSLT_EXSLT_LIBRARIES`` Link to these if you need to link against the exslt library. ``LIBXSLT_XSLTPROC_EXECUTABLE`` diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index c4361b7..32642fe 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -5,10 +5,11 @@ FindLua ------- - - Locate Lua library. +.. versionadded:: 3.18 + Support for Lua 5.4. + This module defines:: :: diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index b531e47..19e6e57 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -12,6 +12,10 @@ high-performance distributed-memory parallel applications, and is typically deployed on a cluster. MPI is a standard interface (defined by the MPI forum) for which many implementations are available. +.. versionadded:: 3.10 + Major overhaul of the module: many new variables, per-language components, + support for a wider variety of runtimes. + Variables for using MPI ^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +54,8 @@ project, where ``<lang>`` is one of C, CXX, or Fortran: ``MPI_<lang>_LIBRARIES`` All libraries to link MPI programs against. -Additionally, the following :prop_tgt:`IMPORTED` targets are defined: +.. versionadded:: 3.9 + Additionally, the following :prop_tgt:`IMPORTED` targets are defined: ``MPI::MPI_<lang>`` Target for using MPI from ``<lang>``. @@ -236,8 +241,10 @@ If the following variables are set to true, the respective search will be perfor Backward Compatibility ^^^^^^^^^^^^^^^^^^^^^^ +.. deprecated:: 3.10 + For backward compatibility with older versions of FindMPI, these -variables are set, but deprecated: +variables are set: :: diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 01f0492..8b4c397 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -17,6 +17,9 @@ can also be used: * to retrieve various information from Matlab (mex extensions, versions and release queries, ...) +.. versionadded:: 3.12 + Added Matlab Compiler Runtime (MCR) support. + The module supports the following components: * ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the ``ENG`` and ``MAT`` @@ -28,6 +31,17 @@ The module supports the following components: * ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on. * ``SIMULINK`` the Simulink environment. +.. versionadded:: 3.7 + Added the ``MAT_LIBRARY`` component. + +.. versionadded:: 3.13 + Added the ``ENGINE_LIBRARY``, ``DATAARRAY_LIBRARY`` and ``MCC_COMPILER`` + components. + +.. versionchanged:: 3.14 + Removed the ``MX_LIBRARY``, ``ENGINE_LIBRARY`` and ``DATAARRAY_LIBRARY`` + components. These libraries are found unconditionally. + .. note:: The version given to the :command:`find_package` directive is the Matlab @@ -107,8 +121,12 @@ Result variables Matlab matrix library. Available only if the component ``MAT_LIBRARY`` is requested. ``Matlab_ENGINE_LIBRARY`` + .. versionadded:: 3.13 + Matlab C++ engine library, always available for R2018a and newer. ``Matlab_DATAARRAY_LIBRARY`` + .. versionadded:: 3.13 + Matlab C++ data array library, always available for R2018a and newer. ``Matlab_LIBRARIES`` the whole set of libraries of Matlab @@ -116,6 +134,8 @@ Result variables the mex compiler of Matlab. Currently not used. Available only if the component ``MEX_COMPILER`` is requested. ``Matlab_MCC_COMPILER`` + .. versionadded:: 3.13 + the mcc compiler of Matlab. Included with the Matlab Compiler add-on. Available only if the component ``MCC_COMPILER`` is requested. @@ -923,14 +943,26 @@ endfunction() the same folder without any processing, with the same name as the final mex file, and with extension `.m`. In that case, typing ``help <name>`` in Matlab prints the documentation contained in this file. - ``R2017b`` or ``R2018a`` may be given to specify the version of the C API + ``R2017b`` or ``R2018a`` + .. versionadded:: 3.14 + + May be given to specify the version of the C API to use: ``R2017b`` specifies the traditional (separate complex) C API, and corresponds to the ``-R2017b`` flag for the `mex` command. ``R2018a`` specifies the new interleaved complex C API, and corresponds to the ``-R2018a`` flag for the `mex` command. Ignored if MATLAB version prior to R2018a. Defaults to ``R2017b``. - ``MODULE`` or ``SHARED`` may be given to specify the type of library to be - created. ``EXECUTABLE`` may be given to create an executable instead of + + ``MODULE`` or ``SHARED`` + .. versionadded:: 3.7 + + May be given to specify the type of library to be + created. + + ``EXECUTABLE`` + .. versionadded:: 3.7 + + May be given to create an executable instead of a library. If no type is given explicitly, the type is ``SHARED``. ``EXCLUDE_FROM_ALL`` This option has the same meaning as for :prop_tgt:`EXCLUDE_FROM_ALL` and diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake index ed52e35..da050cd 100644 --- a/Modules/FindOpenACC.cmake +++ b/Modules/FindOpenACC.cmake @@ -14,6 +14,16 @@ If the compiler supports OpenACC, the flags required to compile with OpenACC support are returned in variables for the different languages. Currently, only PGI, GNU and Cray compilers are supported. +Imported Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.16 + +The module provides :prop_tgt:`IMPORTED` targets: + +``OpenACC::OpenACC_<lang>`` + Target for using OpenACC from ``<lang>``. + Variables ^^^^^^^^^ @@ -25,14 +35,11 @@ project, where ``<lang>`` is one of C, CXX, or Fortran: ``OpenACC_<lang>_FLAGS`` OpenACC compiler flags for ``<lang>``, separated by spaces. ``OpenACC_<lang>_OPTIONS`` + .. versionadded:: 3.16 + OpenACC compiler flags for ``<lang>``, as a list. Suitable for usage with target_compile_options or target_link_options. -Additionally, the module provides :prop_tgt:`IMPORTED` targets: - -``OpenACC::OpenACC_<lang>`` - Target for using OpenACC from ``<lang>``. - The module will also try to provide the OpenACC version variables: ``OpenACC_<lang>_SPEC_DATE`` diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index b3e5a9f..1b4662b 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -9,9 +9,14 @@ FindOpenCL Finds Open Computing Language (OpenCL) +.. versionadded:: 3.10 + Detection of OpenCL 2.1 and 2.2. + IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.7 + This module defines :prop_tgt:`IMPORTED` target ``OpenCL::OpenCL``, if OpenCL has been found. diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 110e7f9..4766102 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -7,27 +7,41 @@ FindOpenGL FindModule for OpenGL and OpenGL Utility Library (GLU). +.. versionchanged:: 3.2 + X11 is no longer added as a dependency on Unix/Linux systems. + +.. versionadded:: 3.10 + GLVND support on Linux. See the :ref:`Linux Specific` section below. + Optional COMPONENTS ^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.10 + This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and ``OpenGL``. There are corresponding import targets for each of these flags. IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.8 + This module defines the :prop_tgt:`IMPORTED` targets: ``OpenGL::GL`` - Defined to the platform-specific OpenGL libraries if the system has OpenGL. -``OpenGL::OpenGL`` - Defined to libOpenGL if the system is GLVND-based. + Defined to the platform-specific OpenGL libraries if the system has OpenGL. ``OpenGL::GLU`` - Defined if the system has OpenGL Utility Library (GLU). + Defined if the system has OpenGL Utility Library (GLU). + +.. versionadded:: 3.10 + Additionally, the following GLVND-specific library targets are defined: + +``OpenGL::OpenGL`` + Defined to libOpenGL if the system is GLVND-based. ``OpenGL::GLX`` - Defined if the system has OpenGL Extension to the X Window System (GLX). + Defined if the system has OpenGL Extension to the X Window System (GLX). ``OpenGL::EGL`` - Defined if the system has EGL. + Defined if the system has EGL. Result Variables ^^^^^^^^^^^^^^^^ @@ -55,6 +69,9 @@ This module sets the following variables: On Linux, this assumes GLX and is never correct for EGL-based targets. Clients are encouraged to use the ``OpenGL::*`` import targets instead. +.. versionadded:: 3.10 + Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``. + Cache variables ^^^^^^^^^^^^^^^ @@ -72,6 +89,11 @@ The following cache variables may also be set: Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import targets. +.. versionadded:: 3.10 + Variables for GLVND-specific libraries ``OpenGL``, ``EGL`` and ``GLX``. + +.. _`Linux Specific`: + Linux-specific ^^^^^^^^^^^^^^ @@ -97,14 +119,14 @@ The value may be one of: ``GLVND`` If the GLVND OpenGL and GLX libraries are available, prefer them. This forces ``OPENGL_gl_LIBRARY`` to be empty. - This is the default if components were requested (since components - correspond to GLVND libraries) or if policy :policy:`CMP0072` is - set to ``NEW``. + + .. versionchanged:: 3.11 + This is the default, unless policy :policy:`CMP0072` is set to ``OLD`` + and no components are requeted (since components + correspond to GLVND libraries). ``LEGACY`` Prefer to use the legacy libGL library, if available. - This is the default if no components were requested and - policy :policy:`CMP0072` is not set to ``NEW``. For EGL targets the client must rely on GLVND support on the user's system. Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES* diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index bb38e28..fc5bffa 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -13,11 +13,15 @@ OpenMP support are returned in variables for the different languages. The variables may be empty if the compiler does not need a special flag to support OpenMP. +.. versionadded:: 3.5 + Clang support. + Variables ^^^^^^^^^ -The module exposes the components ``C``, ``CXX``, and ``Fortran``. -Each of these controls the various languages to search OpenMP support for. +.. versionadded:: 3.10 + The module exposes the components ``C``, ``CXX``, and ``Fortran``. + Each of these controls the various languages to search OpenMP support for. Depending on the enabled components the following variables will be set: @@ -65,6 +69,8 @@ Specifically for Fortran, the module sets the following variables: The module will also try to provide the OpenMP version variables: ``OpenMP_<lang>_SPEC_DATE`` + .. versionadded:: 3.7 + Date of the OpenMP specification implemented by the ``<lang>`` compiler. ``OpenMP_<lang>_VERSION_MAJOR`` Major version of OpenMP implemented by the ``<lang>`` compiler. diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 91a65fd..03b699b 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -7,15 +7,22 @@ FindOpenSSL Find the OpenSSL encryption library. +.. versionadded:: 3.18 + Support for OpenSSL 3.0. + Optional COMPONENTS ^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.12 + This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both components have associated imported targets, as described below. Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.4 + This module defines the following :prop_tgt:`IMPORTED` targets: ``OpenSSL::SSL`` @@ -23,6 +30,8 @@ This module defines the following :prop_tgt:`IMPORTED` targets: ``OpenSSL::Crypto`` The OpenSSL ``crypto`` library, if found. ``OpenSSL::applink`` + .. versionadded:: 3.18 + The OpenSSL ``applink`` components that might be need to be compiled into projects under MSVC. This target is available only if found OpenSSL version is not less than 0.9.8. By linking this target the above OpenSSL targets can @@ -75,8 +84,12 @@ Hints ^^^^^ Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. -Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. -Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. + +.. versionadded:: 3.4 + Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. + +.. versionadded:: 3.5 + Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. #]=======================================================================] macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index fd0e4e9..51f2c7d 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -10,6 +10,8 @@ Find libpng, the official reference library for the PNG image format. Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.5 + This module defines the following :prop_tgt:`IMPORTED` target: ``PNG::PNG`` diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 7e17277..fbcf7cd 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -51,7 +51,9 @@ implementing :command:`find_package(<PackageName>)` calls. (recommended). Not valid in the full signature. ``FOUND_VAR <result-var>`` - Obsolete. Specifies either ``<PackageName>_FOUND`` or + .. deprecated:: 3.3 + + Specifies either ``<PackageName>_FOUND`` or ``<PACKAGENAME>_FOUND`` as the result variable. This exists only for compatibility with older versions of CMake and is now ignored. Result variables of both names are always set for compatibility. @@ -61,8 +63,10 @@ implementing :command:`find_package(<PackageName>)` calls. These may be named in the generated failure message asking the user to set the missing variable values. Therefore these should typically be cache entries such as ``FOO_LIBRARY`` and not output - variables like ``FOO_LIBRARIES``. This option is mandatory if - ``HANDLE_COMPONENTS`` is not specified. + variables like ``FOO_LIBRARIES``. + + .. versionchanged:: 3.18 + If ``HANDLE_COMPONENTS`` is specified, this option can be omitted. ``VERSION_VAR <version-var>`` Specify the name of a variable that holds the version of the package @@ -74,6 +78,8 @@ implementing :command:`find_package(<PackageName>)` calls. if the version is ok or not. ``HANDLE_VERSION_RANGE`` + .. versionadded:: 3.19 + Enable handling of a version range, if one is specified. Without this option, a developer warning will be displayed if a version range is specified. @@ -94,6 +100,8 @@ implementing :command:`find_package(<PackageName>)` calls. was found. ``REASON_FAILURE_MESSAGE <reason-failure-message>`` + .. versionadded:: 3.16 + Specify a custom message of the reason for the failure which will be appended to the default generated message. @@ -102,6 +110,8 @@ implementing :command:`find_package(<PackageName>)` calls. generated message. Not recommended. ``NAME_MISMATCHED`` + .. versionadded:: 3.17 + Indicate that the ``<PackageName>`` does not match ``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a warning, but it may be intentional for usage of the command for components @@ -163,6 +173,8 @@ message. .. command:: find_package_check_version + .. versionadded:: 3.19 + Helper function which can be used to check if a ``<version>`` is valid against version-related arguments of :command:`find_package`. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 2ad2c7e..b41c2c3 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -632,19 +632,38 @@ endmacro() When the ``QUIET`` argument is given, no status messages will be printed. - By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or - later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set to a - boolean ``True`` value, then the :variable:`CMAKE_PREFIX_PATH`, - :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` cache - and environment variables will be added to the ``pkg-config`` search path. - The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments - disable this behavior for the cache variables and environment variables - respectively. - - The ``IMPORTED_TARGET`` argument will create an imported target named - ``PkgConfig::<prefix>`` that can be passed directly as an argument to - :command:`target_link_libraries`. The ``GLOBAL`` argument will make the - imported target available in global scope. + .. versionadded:: 3.1 + The :variable:`CMAKE_PREFIX_PATH`, + :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` cache + and environment variables will be added to the ``pkg-config`` search path. + The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments + disable this behavior for the cache variables and environment variables + respectively. + The :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` variable set to ``FALSE`` + disables this behavior globally. + + .. This didn't actually work until 3.3. + + .. versionadded:: 3.6 + The ``IMPORTED_TARGET`` argument will create an imported target named + ``PkgConfig::<prefix>`` that can be passed directly as an argument to + :command:`target_link_libraries`. + + .. This didn't actually work until 3.7. + + .. versionadded:: 3.13 + The ``GLOBAL`` argument will make the + imported target available in global scope. + + .. versionadded:: 3.15 + Non-library linker options reported by ``pkg-config`` are stored in the + :prop_tgt:`INTERFACE_LINK_OPTIONS` target property. + + .. versionchanged:: 3.18 + Include directories specified with ``-isystem`` are stored in the + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property. Previous + versions of CMake left them in the :prop_tgt:`INTERFACE_COMPILE_OPTIONS` + property. Each ``<moduleSpec>`` can be either a bare module name or it can be a module name with a version constraint (operators ``=``, ``<``, ``>``, @@ -683,6 +702,11 @@ endmacro() All but ``<XXX>_FOUND`` may be a :ref:`;-list <CMake Language Lists>` if the associated variable returned from ``pkg-config`` has multiple values. + .. versionchanged:: 3.18 + Include directories specified with ``-isystem`` are stored in the + ``<XXX>_INCLUDE_DIRS`` variable. Previous versions of CMake left them + in ``<XXX>_CFLAGS_OTHER``. + There are some special variables whose prefix depends on the number of ``<moduleSpec>`` given. When there is only one ``<moduleSpec>``, ``<YYY>`` will simply be ``<prefix>``, but if two or more ``<moduleSpec>`` @@ -697,6 +721,16 @@ endmacro() ``<YYY>_LIBDIR`` lib directory of the module + .. versionchanged:: 3.8 + For any given ``<prefix>``, ``pkg_check_modules()`` can be called multiple + times with different parameters. Previous versions of CMake cached and + returned the first successful result. + + .. versionchanged:: 3.16 + If a full path to the found library can't be determined, but it's still + visible to the linker, pass it through as ``-l<name>``. Previous versions + of CMake failed in this case. + Examples: .. code-block:: cmake @@ -768,9 +802,10 @@ endmacro() [IMPORTED_TARGET [GLOBAL]] <moduleSpec> [<moduleSpec>...]) - If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the - name of the matching module. This variable can be used if you need to run - :command:`pkg_get_variable`. + .. versionadded:: 3.16 + If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the + name of the matching module. This variable can be used if you need to run + :command:`pkg_get_variable`. Example: @@ -815,6 +850,8 @@ endmacro() #[========================================[.rst: .. command:: pkg_get_variable + .. versionadded:: 3.4 + Retrieves the value of a pkg-config variable ``varName`` and stores it in the result variable ``resultVar`` in the calling scope. @@ -849,10 +886,15 @@ Variables Affecting Behavior This can be set to the path of the pkg-config executable. If not provided, it will be set by the module as a result of calling :command:`find_program` - internally. The ``PKG_CONFIG`` environment variable can be used as a hint. + internally. + + .. versionadded:: 3.1 + The ``PKG_CONFIG`` environment variable can be used as a hint. .. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH + .. versionadded:: 3.1 + Specifies whether :command:`pkg_check_modules` and :command:`pkg_search_module` should add the paths in the :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH` and diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 1970b26..cd50d8c 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -10,6 +10,8 @@ Find the PostgreSQL installation. IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.14 + This module defines :prop_tgt:`IMPORTED` target ``PostgreSQL::PostgreSQL`` if PostgreSQL has been found. diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 4bf54ef..4b1e336 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -7,6 +7,13 @@ FindProtobuf Locate and configure the Google Protocol Buffers library. +.. versionadded:: 3.6 + Support for :command:`find_package` version checks. + +.. versionchanged:: 3.6 + All input and output variables use the ``Protobuf_`` prefix. + Variables with ``PROTOBUF_`` prefix are still supported for compatibility. + The following variables can be set and are optional: ``Protobuf_SRC_ROOT_FOLDER`` @@ -19,8 +26,12 @@ The following variables can be set and are optional: List of additional directories to be searched for imported .proto files. ``Protobuf_DEBUG`` + .. versionadded:: 3.6 + Show debug messages. ``Protobuf_USE_STATIC_LIBS`` + .. versionadded:: 3.9 + Set to ON to force the use of the static libraries. Default is OFF. @@ -30,6 +41,8 @@ Defines the following variables: Found the Google Protocol Buffers library (libprotobuf & header files) ``Protobuf_VERSION`` + .. versionadded:: 3.6 + Version of package found. ``Protobuf_INCLUDE_DIRS`` Include directories for Google Protocol Buffers @@ -40,7 +53,8 @@ Defines the following variables: ``Protobuf_LITE_LIBRARIES`` The protobuf-lite libraries -The following :prop_tgt:`IMPORTED` targets are also defined: +.. versionadded:: 3.9 + The following :prop_tgt:`IMPORTED` targets are also defined: ``protobuf::libprotobuf`` The protobuf library. @@ -49,7 +63,8 @@ The following :prop_tgt:`IMPORTED` targets are also defined: ``protobuf::libprotoc`` The protoc library. ``protobuf::protoc`` - The protoc compiler. + .. versionadded:: 3.10 + The protoc compiler. The following cache variables are also available to set or use: @@ -101,7 +116,8 @@ Example: ``HDRS`` Variable to define with autogenerated header files ``DESCRIPTORS`` - Variable to define with autogenerated descriptor files, if requested. + .. versionadded:: 3.10 + Variable to define with autogenerated descriptor files, if requested. ``EXPORT_MACRO`` is a macro which should expand to ``__declspec(dllexport)`` or ``__declspec(dllimport)`` depending on what is being compiled. @@ -110,6 +126,8 @@ Example: .. command:: protobuf_generate_python + .. versionadded:: 3.4 + Add custom commands to process ``.proto`` files to Python:: protobuf_generate_python (<PY> [<ARGN>...]) @@ -204,7 +222,7 @@ function(protobuf_generate) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) get_filename_component(_abs_dir ${_abs_file} DIRECTORY) - get_filename_component(_basename ${_proto} NAME_WE) + get_filename_component(_basename ${_proto} NAME_WLE) file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir}) set(_possible_rel_dir) diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 5fc6a3b..a4b7a03 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -10,25 +10,32 @@ FindPython Find Python interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. The following components are supported: * ``Interpreter``: search for Python interpreter. * ``Compiler``: search for Python compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python module - developments. - * ``Development.Embed``: search for artifacts for Python embedding - developments. + .. versionadded:: 3.18 + This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python module + developments. + * ``Development.Embed``: search for artifacts for Python embedding + developments. * ``NumPy``: search for NumPy include directories. +.. versionadded:: 3.14 + Added the ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -56,20 +63,30 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python::Interpreter`` Python interpreter. Target defined if component ``Interpreter`` is found. ``Python::Compiler`` Python compiler. Target defined if component ``Compiler`` is found. + ``Python::Module`` + .. versionadded:: 3.15 + Python library for Python module. Target defined if component ``Development.Module`` is found. + ``Python::Python`` Python library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python::NumPy`` + .. versionadded:: 3.14 + NumPy Python library. Target defined if component ``NumPy`` is found. Result Variables @@ -116,7 +133,10 @@ This module will set the following variables in your project Information returned by ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` or else ``sysconfig.get_path('platlib')``. + ``Python_SOABI`` + .. versionadded:: 3.17 + Extension suffix for modules. Information returned by @@ -125,6 +145,7 @@ This module will set the following variables in your project ``python-config --extension-suffix``. If package ``distutils.sysconfig`` is not available, ``sysconfig.get_config_var('SOABI')`` or ``sysconfig.get_config_var('EXT_SUFFIX')`` are used. + ``Python_Compiler_FOUND`` System has the Python compiler. ``Python_COMPILER`` @@ -132,19 +153,35 @@ This module will set the following variables in your project ``Python_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python_Development_FOUND`` System has the Python development artifacts. + ``Python_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python module. + ``Python_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python embedding. + ``Python_INCLUDE_DIRS`` + The Python include directories. + ``Python_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python link options. Some configurations require specific link options for a correct build and execution. + ``Python_LIBRARIES`` The Python libraries. ``Python_LIBRARY_DIRS`` @@ -159,13 +196,25 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. + ``Python_PyPy_VERSION`` + .. versionadded:: 3.18 + Python PyPy version. + ``Python_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -181,6 +230,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python_FIND_ABI`` + .. versionadded:: 3.16 + This variable defines which ABIs, as defined in `PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched. @@ -226,6 +277,8 @@ Hints each flag is ``OFF`` or ``ANY``. ``Python_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python_FIND_STRATEGY`` variable can be set to one of the following: @@ -238,6 +291,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. the ``Python_FIND_REGISTRY`` variable can be set to one of the following: @@ -248,6 +303,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -261,6 +318,8 @@ Hints variable will be used, if any. ``Python_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -279,6 +338,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -286,6 +348,8 @@ Hints result. ``Python_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -318,9 +382,26 @@ Hints ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available through the ``PATH`` variable. +``Python_FIND_UNVERSIONED_NAMES`` + .. versionadded:: 3.20 + + This variable defines how the generic names will be searched. Currently, it + only applies to the generic names of the interpreter, namely, ``python3`` or + ``python2`` and ``python``. + The ``Python_FIND_UNVERSIONED_NAMES`` variable can be set to one of the + following values: + + * ``FIRST``: The generic names are searched before the more specialized ones + (such as ``python2.5`` for example). + * ``LAST``: The generic names are searched after the more specialized ones. + This is the default. + * ``NEVER``: The generic name are not searched at all. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -331,6 +412,8 @@ setting the following variables: The path to the compiler. ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python_LIBRARY`` @@ -367,6 +450,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact @@ -389,8 +474,9 @@ Python module naming rules:: If the library type is not specified, ``MODULE`` is assumed. -For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the -module suffix will include the ``Python_SOABI`` value, if any. +.. versionadded:: 3.17 + For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the + module suffix will include the ``Python_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 79b1d18..0c775f7 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -337,6 +337,9 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) foreach (implementation IN LISTS _PGN_IMPLEMENTATIONS) if (implementation STREQUAL "CPython") + if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "FIRST") + list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python) + endif() foreach (version IN LISTS _PGN_VERSION) if (_PGN_WIN32) string (REPLACE "." "" version_no_dots ${version}) @@ -386,7 +389,7 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) endif() endif() endforeach() - if (_PGN_INTERPRETER) + if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "LAST") list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python) endif() elseif (implementation STREQUAL "IronPython") @@ -1372,9 +1375,22 @@ else() endif() +# Python naming handling +if (DEFINED ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES) + if (NOT ${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES MATCHES "^(FIRST|LAST|NEVER)$") + message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}: invalid value for '${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES'. 'FIRST', 'LAST' or 'NEVER' expected. 'LAST' will be used instead.") + set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST) + else() + set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES ${${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}) + endif() +else() + set (_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES LAST) +endif() + + # Compute search signature # This signature will be used to check validity of cached variables on new search -set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}") +set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}${_${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES}") if (NOT WIN32) string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:") endif() @@ -3005,8 +3021,9 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS unset(_${_PYTHON_PREFIX}_is_prefix) foreach (_${_PYTHON_PREFIX}_implementation IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) foreach (_${_PYTHON_PREFIX}_framework IN LISTS _${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_implementation}_FRAMEWORKS) - if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "^${_${_PYTHON_PREFIX}_framework}") - get_filename_component (_${_PYTHON_PREFIX}_framework "${_${_PYTHON_PREFIX}_framework}" DIRECTORY) + cmake_path (IS_PREFIX _${_PYTHON_PREFIX}_framework "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" _${_PYTHON_PREFIX}_is_prefix) + if (_${_PYTHON_PREFIX}_is_prefix) + cmake_path (GET _${_PYTHON_PREFIX}_framework PARENT_PATH _${_PYTHON_PREFIX}_framework) set (${_PYTHON_PREFIX}_LINK_OPTIONS "LINKER:-rpath,${_${_PYTHON_PREFIX}_framework}") break() endif() diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index 9cd22e1..bb965b9 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -10,25 +10,32 @@ FindPython2 Find Python 2 interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. The following components are supported: * ``Interpreter``: search for Python 2 interpreter * ``Compiler``: search for Python 2 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python 2 module - developments. - * ``Development.Embed``: search for artifacts for Python 2 embedding - developments. + .. versionadded:: 3.18 + This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python 2 module + developments. + * ``Development.Embed``: search for artifacts for Python 2 embedding + developments. * ``NumPy``: search for NumPy include directories. +.. versionadded:: 3.14 + Added the ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -57,20 +64,29 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python2::Interpreter`` Python 2 interpreter. Target defined if component ``Interpreter`` is found. ``Python2::Compiler`` Python 2 compiler. Target defined if component ``Compiler`` is found. ``Python2::Module`` + .. versionadded:: 3.15 + Python 2 library for Python module. Target defined if component ``Development.Module`` is found. + ``Python2::Python`` Python 2 library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python2::NumPy`` + .. versionadded:: 3.14 + NumPy library for Python 2. Target defined if component ``NumPy`` is found. Result Variables @@ -124,19 +140,34 @@ This module will set the following variables in your project ``Python2_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python2_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python2_Development_FOUND`` System has the Python 2 development artifacts. + ``Python2_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python 2 development artifacts for Python module. + ``Python2_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python 2 development artifacts for Python embedding. + ``Python2_INCLUDE_DIRS`` The Python 2 include directories. + ``Python2_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python 2 link options. Some configurations require specific link options for a correct build and execution. + ``Python2_LIBRARIES`` The Python 2 libraries. ``Python2_LIBRARY_DIRS`` @@ -151,13 +182,25 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. + ``Python2_PyPy_VERSION`` + .. versionadded:: 3.18 + Python 2 PyPy version. + ``Python2_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python2_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python2_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -173,6 +216,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python2_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python2_FIND_STRATEGY`` variable can be set to one of the following: @@ -185,6 +230,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python2_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python2_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. the ``Python2_FIND_REGISTRY`` variable can be set to one of the following: @@ -195,6 +242,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python2_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -208,6 +257,8 @@ Hints variable will be used, if any. ``Python2_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -226,6 +277,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -233,6 +287,8 @@ Hints result. ``Python2_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python2_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -265,9 +321,26 @@ Hints ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available through the ``PATH`` variable. +``Python2_FIND_UNVERSIONED_NAMES`` + .. versionadded:: 3.20 + + This variable defines how the generic names will be searched. Currently, it + only applies to the generic names of the interpreter, namely, ``python2`` and + ``python``. + The ``Python2_FIND_UNVERSIONED_NAMES`` variable can be set to one of the + following values: + + * ``FIRST``: The generic names are searched before the more specialized ones + (such as ``python2.5`` for example). + * ``LAST``: The generic names are searched after the more specialized ones. + This is the default. + * ``NEVER``: The generic name are not searched at all. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -278,6 +351,8 @@ setting the following variables: The path to the compiler. ``Python2_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python2_LIBRARY`` @@ -314,6 +389,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python2_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index c79d482..f826fcf 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -10,25 +10,32 @@ FindPython3 Find Python 3 interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. The following components are supported: * ``Interpreter``: search for Python 3 interpreter * ``Compiler``: search for Python 3 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python 3 module - developments. - * ``Development.Embed``: search for artifacts for Python 3 embedding - developments. + .. versionadded:: 3.18 + This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python 3 module + developments. + * ``Development.Embed``: search for artifacts for Python 3 embedding + developments. * ``NumPy``: search for NumPy include directories. +.. versionadded:: 3.14 + Added the ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -57,20 +64,30 @@ for you. Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python3::Interpreter`` Python 3 interpreter. Target defined if component ``Interpreter`` is found. ``Python3::Compiler`` Python 3 compiler. Target defined if component ``Compiler`` is found. + ``Python3::Module`` + .. versionadded:: 3.15 + Python 3 library for Python module. Target defined if component ``Development.Module`` is found. + ``Python3::Python`` Python 3 library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python3::NumPy`` + .. versionadded:: 3.14 + NumPy library for Python 3. Target defined if component ``NumPy`` is found. Result Variables @@ -117,7 +134,10 @@ This module will set the following variables in your project Information returned by ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` or else ``sysconfig.get_path('platlib')``. + ``Python3_SOABI`` + .. versionadded:: 3.17 + Extension suffix for modules. Information returned by @@ -126,6 +146,7 @@ This module will set the following variables in your project ``python3-config --extension-suffix``. If package ``distutils.sysconfig`` is not available, ``sysconfig.get_config_var('SOABI')`` or ``sysconfig.get_config_var('EXT_SUFFIX')`` are used. + ``Python3_Compiler_FOUND`` System has the Python 3 compiler. ``Python3_COMPILER`` @@ -133,19 +154,36 @@ This module will set the following variables in your project ``Python3_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python3_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python3_Development_FOUND`` + System has the Python 3 development artifacts. + ``Python3_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python 3 development artifacts for Python module. + ``Python3_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python 3 development artifacts for Python embedding. + ``Python3_INCLUDE_DIRS`` + The Python 3 include directories. + ``Python3_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python 3 link options. Some configurations require specific link options for a correct build and execution. + ``Python3_LIBRARIES`` The Python 3 libraries. ``Python3_LIBRARY_DIRS`` @@ -160,13 +198,25 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. + ``Python3_PyPy_VERSION`` + .. versionadded:: 3.18 + Python 3 PyPy version. + ``Python3_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python3_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python3_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -182,6 +232,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python3_FIND_ABI`` + .. versionadded:: 3.16 + This variable defines which ABIs, as defined in `PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched. @@ -223,6 +275,8 @@ Hints each flag is ``OFF`` or ``ANY``. ``Python3_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python3_FIND_STRATEGY`` variable can be set to one of the following: @@ -235,6 +289,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python3_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python3_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. The ``Python3_FIND_REGISTRY`` variable can be set to one of the following: @@ -245,6 +301,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python3_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python3_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -258,6 +316,8 @@ Hints variable will be used, if any. ``Python3_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment is active (i.e. the ``activate`` script has been evaluated). In this case, it @@ -276,6 +336,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -283,6 +346,8 @@ Hints result. ``Python3_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python3_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -315,9 +380,26 @@ Hints ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available through the ``PATH`` variable. +``Python3_FIND_UNVERSIONED_NAMES`` + .. versionadded:: 3.20 + + This variable defines how the generic names will be searched. Currently, it + only applies to the generic names of the interpreter, namely, ``python3`` and + ``python``. + The ``Python3_FIND_UNVERSIONED_NAMES`` variable can be set to one of the + following values: + + * ``FIRST``: The generic names are searched before the more specialized ones + (such as ``python3.5`` for example). + * ``LAST``: The generic names are searched after the more specialized ones. + This is the default. + * ``NEVER``: The generic name are not searched at all. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -328,6 +410,8 @@ setting the following variables: The path to the compiler. ``Python3_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python3_LIBRARY`` @@ -364,6 +448,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python3_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact @@ -386,8 +472,9 @@ of Python module naming rules:: If the library type is not specified, ``MODULE`` is assumed. -For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the -module suffix will include the ``Python3_SOABI`` value, if any. +.. versionadded:: 3.17 + For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the + module suffix will include the ``Python3_SOABI`` value, if any. #]=======================================================================] diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index d6a0662..44a1f41 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -5,14 +5,14 @@ FindQt ------ +.. deprecated:: 3.14 + This module is available only if policy :policy:`CMP0084` is not set to ``NEW``. + Searches for all installed versions of Qt3 or Qt4. This module cannot handle Qt5 or any later versions. For those, see :manual:`cmake-qt(7)`. -This module exists for the :command:`find_package` command only if -policy :policy:`CMP0084` is not set to ``NEW``. - This module should only be used if your project can work with multiple versions of Qt. If not, you should just directly use FindQt4 or FindQt3. If multiple versions of Qt are found on the machine, then diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index d12f825..ee07f83 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -37,7 +37,8 @@ This module will set the following variables in your project: ``Ruby_INCLUDE_DIRS`` include dirs to be used when using the ruby library ``Ruby_LIBRARIES`` - libraries needed to use ruby from C. + .. versionadded:: 3.18 + libraries needed to use ruby from C. ``Ruby_VERSION`` the version of ruby which was found, e.g. "1.8.7" ``Ruby_VERSION_MAJOR`` @@ -47,9 +48,10 @@ This module will set the following variables in your project: ``Ruby_VERSION_PATCH`` Ruby patch version. - -The following variables are also provided for compatibility reasons, -don't use them in new code: +.. versionchanged:: 3.18 + Previous versions of CMake used the ``RUBY_`` prefix for all variables. + The following variables are provided for compatibility reasons, + don't use them in new code: ``RUBY_EXECUTABLE`` same as Ruby_EXECUTABLE. @@ -67,6 +69,8 @@ don't use them in new code: Hints ^^^^^ +.. versionadded:: 3.18 + ``Ruby_ROOT_DIR`` Define the root directory of a Ruby installation. diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 59eddbb..c68e18d 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -11,6 +11,8 @@ Locate the SDL library Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.19 + This module defines the following :prop_tgt:`IMPORTED` target: ``SDL::SDL`` @@ -36,6 +38,10 @@ This module will set the following variables in your project: ``SDL_VERSION_PATCH`` SDL patch version +.. versionadded:: 3.19 + Added the ``SDL_INCLUDE_DIRS``, ``SDL_LIBRARIES`` and ``SDL_VERSION[_<PART>]`` + variables. + Cache variables ^^^^^^^^^^^^^^^ @@ -63,6 +69,8 @@ This module responds to the flag: Obsolete variables ^^^^^^^^^^^^^^^^^^ +.. deprecated:: 3.19 + These variables are obsolete and provided for backwards compatibility: ``SDL_VERSION_STRING`` diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 87a3894..4c7ad89 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -7,14 +7,17 @@ FindSWIG Find the Simplified Wrapper and Interface Generator (SWIG_) executable. -This module finds an installed SWIG and determines its version. If a -``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to the -:command:`find_package` command, it will also determine supported target -languages. - -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +This module finds an installed SWIG and determines its version. + +.. versionadded:: 3.18 + If a ``COMPONENTS`` or ``OPTIONAL_COMPONENTS`` argument is given to the + :command:`find_package` command, it will also determine supported target + languages. + +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. The module defines the following variables: diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 91d1410..9a17fdb 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -47,7 +47,8 @@ to cmake using Squish >= 4.x: AUT targetName SUITE suiteName TEST squishTestName [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] ) - +.. versionchanged:: 3.18 + In previous CMake versions, this function was named ``squish_v4_add_test``. The arguments have the following meaning: diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 07cb770..7a9c440 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -31,9 +31,12 @@ If the command line client executable is found two macros are defined: ``Subversion_WC_INFO`` extracts information of a subversion working copy at a given location. This macro defines the following variables if running Subversion's ``info`` command on ``<dir>`` succeeds; otherwise a -``SEND_ERROR`` message is generated. The error can be ignored by providing the -``IGNORE_SVN_FAILURE`` option, which causes these variables to remain -undefined. +``SEND_ERROR`` message is generated. + +.. versionadded:: 3.13 + The error can be ignored by providing the + ``IGNORE_SVN_FAILURE`` option, which causes these variables to remain + undefined. :: diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 3b74c94..ed2657c 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -17,12 +17,16 @@ imported target, as described below. Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.5 + This module defines the following :prop_tgt:`IMPORTED` targets: ``TIFF::TIFF`` The TIFF library, if found. ``TIFF::CXX`` + .. versionadded:: 3.19 + The C++ wrapper libtiffxx, if requested by the `COMPONENTS CXX` option, if the compiler is not MSVC (which includes the C++ wrapper in libtiff), and if found. @@ -56,6 +60,9 @@ The following cache variables may also be set: the path to the TIFFXX library for release configurations ``TIFFXX_LIBRARY_DEBUG`` the path to the TIFFXX library for debug configurations + +.. versionadded:: 3.4 + Debug and Release variants are found separately. #]=======================================================================] cmake_policy(PUSH) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index e3e6591..87e88bc 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -10,6 +10,8 @@ This module determines the thread library of the system. Imported Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.1 + This module defines the following :prop_tgt:`IMPORTED` target: ``Threads::Threads`` @@ -38,6 +40,8 @@ Variables Affecting Behavior .. variable:: THREADS_PREFER_PTHREAD_FLAG + .. versionadded:: 3.1 + If the use of the -pthread compiler and linker flag is preferred then the caller can set this variable to TRUE. The compiler flag can only be used with the imported target. Use of both the imported target as well diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 0ec6013..ceb1921 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -16,8 +16,9 @@ IMPORTED Targets This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if Vulkan has been found. -This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if -Vulkan and the GLSLC SPIR-V compiler has been found. +.. versionadded:: 3.19 + This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if + Vulkan and the GLSLC SPIR-V compiler has been found. Result Variables ^^^^^^^^^^^^^^^^ @@ -37,6 +38,8 @@ The module will also define three cache variables:: Hints ^^^^^ +.. versionadded:: 3.18 + The ``VULKAN_SDK`` environment variable optionally specifies the location of the Vulkan SDK root directory for the given architecture. It is typically set by sourcing the toplevel diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index a865597..d480fc4 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -17,6 +17,9 @@ Try to find X11 on UNIX systems. The following values are defined and also the following more fine grained variables and targets: +.. versionadded:: 3.14 + Imported targets. + :: X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE @@ -62,6 +65,23 @@ and also the following more fine grained variables and targets: X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND X11_Xaw_INCLUDE_PATH, X11_Xaw_LIB X11_Xaw_FOUND X11::Xaw + +.. versionadded:: 3.14 + Renamed ``Xxf86misc``, ``X11_Xxf86misc``, ``X11_Xxf86vm``, ``X11_xkbfile``, + ``X11_Xtst``, and ``X11_Xss`` libraries to match their file names. + Deprecated the ``X11_Xinput`` library. Old names are still available + for compatibility. + +.. versionadded:: 3.14 + Added the ``X11_Xext_INCLUDE_PATH`` variable. + +.. versionadded:: 3.18 + Added the ``xcb``, ``X11-xcb``, ``xcb-icccm``, ``xcb-xkb``, ``xkbcommon``, + and ``xkbcommon-X11`` libraries. + +.. versionadded:: 3.19 + Added the ``Xaw``, ``xcb_util``, and ``xcb_xfixes`` libraries. + #]=======================================================================] if (UNIX) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index abe18c0..af1b0b4 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -12,6 +12,8 @@ Find the Apache Xerces-C++ validating XML parser headers and libraries. Imported targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.5 + This module defines the following :prop_tgt:`IMPORTED` targets: ``XercesC::XercesC`` @@ -40,6 +42,9 @@ The following cache variables may also be set: the directory containing the Xerces headers ``XercesC_LIBRARY`` the Xerces library + +.. versionadded:: 3.4 + Debug and Release variants are found separately. #]=======================================================================] # Written by Roger Leigh <rleigh@codelibre.net> diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 79e2313..5778b03 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -10,6 +10,8 @@ Find the native ZLIB includes and library. IMPORTED Targets ^^^^^^^^^^^^^^^^ +.. versionadded:: 3.1 + This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if ZLIB has been found. @@ -32,6 +34,9 @@ This module defines the following variables: ZLIB_VERSION_PATCH - The patch version of zlib ZLIB_VERSION_TWEAK - The tweak version of zlib +.. versionadded:: 3.4 + Debug and Release variants are found separately. + Backward Compatibility ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index eab09f1..63af9b6 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -14,6 +14,12 @@ package: find_package(wxWidgets COMPONENTS core base ... OPTIONAL_COMPONENTS net ...) +.. versionadded:: 3.4 + Support for :command:`find_package` version argument; ``webview`` component. + +.. versionadded:: 3.14 + ``OPTIONAL_COMPONENTS`` support. + There are two search branches: a windows style and a unix style. For windows, the following variables are searched for and set to defaults in case of multiple choices. Change them if the defaults are not @@ -82,6 +88,9 @@ and unix style: "`wx-config --cxxflags`". wxWidgets_USE_FILE - Convenience include file. +.. versionadded:: 3.11 + The following environment variables can be used as hints: ``WX_CONFIG``, + ``WXRC_CMD``. Sample usage: diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 547346b..733c723 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -343,6 +343,13 @@ function(FortranCInterface_VERIFY) set(_desc "Verifying Fortran/${lang} Compiler Compatibility") message(CHECK_START "${_desc}") + cmake_policy(GET CMP0056 _FortranCInterface_CMP0056) + if(_FortranCInterface_CMP0056 STREQUAL "NEW") + set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}") + else() + set(_FortranCInterface_EXE_LINKER_FLAGS "") + endif() + # Build a sample project which reports symbols. set(CMAKE_TRY_COMPILE_CONFIGURATION Release) try_compile(FortranCInterface_VERIFY_${lang}_COMPILED @@ -358,6 +365,7 @@ function(FortranCInterface_VERIFY) "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}" "-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}" "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}" + ${_FortranCInterface_EXE_LINKER_FLAGS} OUTPUT_VARIABLE _output) file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}") diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index c75067b..998faf1 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -26,6 +26,14 @@ unset(FortranCInterface_VERIFIED_CXX CACHE) set(_result) +cmake_policy(GET CMP0056 _FortranCInterface_CMP0056) +if(_FortranCInterface_CMP0056 STREQUAL "NEW") + set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}") +else() + set(_FortranCInterface_EXE_LINKER_FLAGS "") +endif() +unset(_FortranCInterface_CMP0056) + # Build a sample project which reports symbols. set(CMAKE_TRY_COMPILE_CONFIGURATION Release) try_compile(FortranCInterface_COMPILED @@ -38,9 +46,11 @@ try_compile(FortranCInterface_COMPILED "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}" "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}" + ${_FortranCInterface_EXE_LINKER_FLAGS} OUTPUT_VARIABLE FortranCInterface_OUTPUT) set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED}) unset(FortranCInterface_COMPILED CACHE) +unset(_FortranCInterface_EXE_LINKER_FLAGS) # Locate the sample project executable. set(FortranCInterface_EXE) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 13d067a..37869fb 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -46,7 +46,8 @@ where ``<dir>`` is one of: ``LOCALSTATEDIR`` modifiable single-machine data (``var``) ``RUNSTATEDIR`` - run-time variable data (``LOCALSTATEDIR/run``) + .. versionadded:: 3.9 + run-time variable data (``LOCALSTATEDIR/run``) ``LIBDIR`` object code libraries (``lib`` or ``lib64`` or ``lib/<multiarch-tuple>`` on Debian) @@ -73,6 +74,8 @@ used and the value will appear in the cache for editing by the user. Special Cases ^^^^^^^^^^^^^ +.. versionadded:: 3.4 + The following values of :variable:`CMAKE_INSTALL_PREFIX` are special: ``/`` @@ -113,7 +116,9 @@ Macros :: - GNUInstallDirs_get_absolute_install_dir(absvar var) + GNUInstallDirs_get_absolute_install_dir(absvar var dirname) + + .. versionadded:: 3.7 Set the given variable ``absvar`` to the absolute path contained within the variable ``var``. This is to allow the computation of an @@ -121,7 +126,12 @@ Macros above. While this macro is used to compute the various ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to allow users who create additional path variables to also compute - absolute paths where necessary, using the same logic. + absolute paths where necessary, using the same logic. ``dirname`` is + the directory name to get, e.g. ``BINDIR``. + + .. versionchanged:: 3.20 + Added the ``<dirname>`` parameter. Previous versions of CMake passed + this value through the variable ``${dir}``. #]=======================================================================] cmake_policy(PUSH) @@ -334,13 +344,25 @@ mark_as_advanced( ) macro(GNUInstallDirs_get_absolute_install_dir absvar var) + set(GGAID_extra_args ${ARGN}) + list(LENGTH GGAID_extra_args GGAID_extra_arg_count) + if(GGAID_extra_arg_count GREATER 0) + list(GET GGAID_extra_args 0 GGAID_dir) + else() + # Historical behaviour: use ${dir} from caller's scope + set(GGAID_dir "${dir}") + message(AUTHOR_WARNING + "GNUInstallDirs_get_absolute_install_dir called without third argument. " + "Using \${dir} from the caller's scope for compatibility with CMake 3.19 and below.") + endif() + if(NOT IS_ABSOLUTE "${${var}}") # Handle special cases: # - CMAKE_INSTALL_PREFIX == / # - CMAKE_INSTALL_PREFIX == /usr # - CMAKE_INSTALL_PREFIX == /opt/... if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") - if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR") + if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR") set(${absvar} "/${${var}}") else() if (NOT "${${var}}" MATCHES "^usr/") @@ -349,13 +371,13 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var) set(${absvar} "/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") - if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR") + if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR") set(${absvar} "/${${var}}") else() set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") - if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR" OR "${dir}" STREQUAL "RUNSTATEDIR") + if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR") set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}") else() set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") @@ -366,6 +388,10 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var) else() set(${absvar} "${${var}}") endif() + + unset(GGAID_dir) + unset(GGAID_extra_arg_count) + unset(GGAID_extra_args) endmacro() # Result directories @@ -388,7 +414,7 @@ foreach(dir MANDIR DOCDIR ) - GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir}) + GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir} ${dir}) endforeach() cmake_policy(POP) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index e4481f6..bc1eb17 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -9,6 +9,9 @@ Function for generation of export macros for libraries This module provides the function ``GENERATE_EXPORT_HEADER()``. +.. versionadded:: 3.12 + Added support for C projects. Previous versions supported C++ project only. + The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file suitable for preprocessor inclusion which contains EXPORT macros to be used in library classes:: @@ -27,7 +30,6 @@ used in library classes:: [CUSTOM_CONTENT_FROM_VARIABLE <variable>] ) - The target properties :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and :prop_tgt:`VISIBILITY_INLINES_HIDDEN` can be used to add the appropriate compile flags for targets. See the documentation of those target properties, @@ -170,20 +172,30 @@ For example: Generates the macros ``VTK_SOMELIB_EXPORT`` etc. +.. versionadded:: 3.1 + Library target can be an ``OBJECT`` library. + +.. versionadded:: 3.7 + Added the ``CUSTOM_CONTENT_FROM_VARIABLE`` option. + +.. versionadded:: 3.11 + Added the ``INCLUDE_GUARD_NAME`` option. + :: ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +.. deprecated:: 3.0 + Set the target properties + :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and + :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead. + The ``ADD_COMPILER_EXPORT_FLAGS`` function adds ``-fvisibility=hidden`` to :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` if supported, and is a no-op on Windows which does not need extra compiler flags for exporting support. You may optionally pass a single argument to ``ADD_COMPILER_EXPORT_FLAGS`` that will be populated with the ``CXX_FLAGS`` required to enable visibility support for the compiler/architecture in use. - -This function is deprecated. Set the target properties -:prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and -:prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead. #]=======================================================================] include(CheckCCompilerFlag) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index c99c772..f325cfb 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -25,6 +25,9 @@ files: ldd (Linux/Unix) otool (Mac OSX) +.. versionchanged:: 3.16 + The tool specified by ``CMAKE_OBJDUMP`` will be used, if set. + The following functions are provided by this module: :: @@ -42,9 +45,6 @@ The following functions are provided by this module: (projects can override with gp_resolved_file_type_override) gp_file_type -Requires CMake 2.6 or greater because it uses function, break, return -and PARENT_SCOPE. - :: GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse> @@ -67,8 +67,9 @@ searched first when a target without any path info is given. Then standard system locations are also searched: PATH, Framework locations, /usr/lib... -The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose -output. +.. versionadded:: 3.14 + The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose + output. :: diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 057b29d..2ea9e74 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -101,6 +101,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also with the list of discovered test cases. This allows the caller to do things like manipulate test properties of the discovered tests. + Usage example: + .. code-block:: cmake include(GoogleTest) @@ -157,6 +159,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also [DISCOVERY_MODE <POST_BUILD|PRE_TEST>] ) + .. versionadded:: 3.10 + ``gtest_discover_tests()`` sets up a post-build command on the test executable that generates the list of tests by parsing the output from running the test with the ``--gtest_list_tests`` argument. Compared to the source parsing @@ -223,6 +227,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also Note that this variable is only available in CTest. ``DISCOVERY_TIMEOUT num`` + .. versionadded:: 3.10.3 + Specifies how long (in seconds) CMake will wait for the test to enumerate available tests. If the test takes longer than this, discovery (and your build) will fail. Most test executables will enumerate their tests very @@ -241,6 +247,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also and 3.10.2 has not been preserved. ``XML_OUTPUT_DIR dir`` + .. versionadded:: 3.18 + If specified, the parameter is passed along with ``--gtest_output=xml:`` to test executable. The actual file name is the same as the test target, including prefix and suffix. This should be used instead of @@ -248,6 +256,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also XML result output when using parallel test execution. ``DISCOVERY_MODE`` + .. versionadded:: 3.18 + Provides greater control over when ``gtest_discover_tests()`` performs test discovery. By default, ``POST_BUILD`` sets up a post-build command to perform test discovery at build time. In certain scenarios, like diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 883e1f4..0f79c9a 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -136,7 +136,7 @@ function(gtest_discover_tests_impl) ${TEST_XML_OUTPUT_PARAM} ${extra_args} ) - if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") + if(suite MATCHES "^DISABLED_" OR test MATCHES "^DISABLED_") add_command(set_tests_properties "${testname}" PROPERTIES DISABLED TRUE diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index caca697..c34b819 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -27,14 +27,17 @@ may be set prior to including the module to adjust behavior: tools even if the release runtime libraries are also available. ``CMAKE_INSTALL_UCRT_LIBRARIES`` + .. versionadded:: 3.6 + Set to TRUE to install the Windows Universal CRT libraries for app-local deployment (e.g. to Windows XP). This is meaningful only with MSVC from Visual Studio 2015 or higher. - One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable* - to an absolute path to tell CMake to look for Windows 10 SDKs in - a custom location. The specified directory is expected to contain - ``Redist/ucrt/DLLs/*`` directories. + .. versionadded:: 3.9 + One may set a ``CMAKE_WINDOWS_KITS_10_DIR`` *environment variable* + to an absolute path to tell CMake to look for Windows 10 SDKs in + a custom location. The specified directory is expected to contain + ``Redist/ucrt/DLLs/*`` directories. ``CMAKE_INSTALL_MFC_LIBRARIES`` Set to TRUE to install the MSVC MFC runtime libraries. @@ -53,8 +56,13 @@ may be set prior to including the module to adjust behavior: not provide the redistributable files.) ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT`` + .. versionadded:: 3.3 + Specify the :command:`install(PROGRAMS)` command ``COMPONENT`` option. If not specified, no such option will be used. + +.. versionadded:: 3.10 + Support for installing Intel compiler runtimes. #]=======================================================================] cmake_policy(PUSH) diff --git a/Modules/Internal/CPack/CPack.NuGet.nuspec.in b/Modules/Internal/CPack/CPack.NuGet.nuspec.in index b7beb5d..d89d69f 100644 --- a/Modules/Internal/CPack/CPack.NuGet.nuspec.in +++ b/Modules/Internal/CPack/CPack.NuGet.nuspec.in @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> +<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <!-- Required elements--> <id>@CPACK_NUGET_PACKAGE_NAME@</id> @@ -12,11 +12,14 @@ @_CPACK_NUGET_OWNERS_TAG@ @_CPACK_NUGET_PROJECTURL_TAG@ @_CPACK_NUGET_LICENSEURL_TAG@ + @_CPACK_NUGET_LICENSE_TAG@ @_CPACK_NUGET_ICONURL_TAG@ + @_CPACK_NUGET_ICON_TAG@ @_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@ @_CPACK_NUGET_SUMMARY_TAG@ @_CPACK_NUGET_RELEASENOTES_TAG@ @_CPACK_NUGET_COPYRIGHT_TAG@ + @_CPACK_NUGET_LANGUAGE_TAG@ @_CPACK_NUGET_TAGS_TAG@ @_CPACK_NUGET_DEPENDENCIES_TAG@ </metadata> diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 431b074..48d451a 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -768,6 +768,10 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME "${CPACK_DBGSYM_OUTPUT_FILE_NAME}" PARENT_SCOPE) list(JOIN BUILD_IDS " " BUILD_IDS) set(GEN_BUILD_IDS "${BUILD_IDS}" PARENT_SCOPE) + else() + unset(GEN_DBGSYMDIR PARENT_SCOPE) + unset(GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME PARENT_SCOPE) + unset(GEN_BUILD_IDS PARENT_SCOPE) endif() endfunction() diff --git a/Modules/Internal/CPack/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake index 20eed2e..56bbffd 100644 --- a/Modules/Internal/CPack/CPackNuGet.cmake +++ b/Modules/Internal/CPack/CPackNuGet.cmake @@ -107,21 +107,44 @@ endfunction() function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME) set(_options) set(_one_value_args) - set(_multi_value_args FALLBACK_VARS) - cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + set(_multi_value_args FALLBACK_VARS ATTRIBUTES) + cmake_parse_arguments(PARSE_ARGV 2 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + + if(_args_ATTRIBUTES) + list(JOIN _args_ATTRIBUTES " " _attributes) + string(PREPEND _attributes " ") + endif() _cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA) + string(TOUPPER "${ELEMENT}" _ELEMENT_UP) if(_value) - string(TOUPPER "${ELEMENT}" _ELEMENT_UP) set( _CPACK_NUGET_${_ELEMENT_UP}_TAG - "<${ELEMENT}>${_value}</${ELEMENT}>" + "<${ELEMENT}${_attributes}>${_value}</${ELEMENT}>" + PARENT_SCOPE + ) + elseif(_attributes) + set( + _CPACK_NUGET_${_ELEMENT_UP}_TAG + "<${ELEMENT}${_attributes} />" PARENT_SCOPE ) endif() endfunction() +# Warn of obsolete nuspec fields, referencing CMake variables and suggested +# replacement, if any +function(_cpack_nuget_deprecation_warning NUGET_ELEMENT VARNAME REPLACEMENT) + if(${VARNAME}) + if(REPLACEMENT) + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider replacing `${VARNAME}` with `${REPLACEMENT}`") + else() + message(DEPRECATION "nuspec element `${NUGET_ELEMENT}` is deprecated in NuGet; consider removing `${VARNAME}`") + endif() + endif() +endfunction() + # Print some debug info _cpack_nuget_debug("---[CPack NuGet Input Variables]---") _cpack_nuget_debug_var(CPACK_PACKAGE_NAME) @@ -168,6 +191,21 @@ function(_cpack_nuget_render_spec) set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") endif() + # Warn about deprecated nuspec elements; warnings only display if + # variable is set + # Note that while nuspec's "summary" element is deprecated, there + # is no suggested replacement so (for now) no deprecation warning + # is shown for `CPACK_NUGET_*_DESCRIPTION_SUMMARY` + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_PACKAGE_LICENSEURL + "CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME or CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("licenseUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSEURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_FILE_NAME or CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_LICENSE_EXPRESSION") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_PACKAGE_ICONURL + "CPACK_NUGET_PACKAGE_ICON") + _cpack_nuget_deprecation_warning("iconUrl" CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICONURL + "CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_ICON") + + # Set nuspec fields _cpack_nuget_variable_fallback( CPACK_NUGET_PACKAGE_VERSION VERSION FALLBACK_VARS @@ -207,8 +245,35 @@ function(_cpack_nuget_render_spec) FALLBACK_VARS CPACK_PACKAGE_HOMEPAGE_URL ) + + # "licenseUrl" is deprecated in favor of "license" _cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL) + + # "iconUrl" is deprecated in favor of "icon" _cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL) + + # "license" takes a "type" attribute of either "file" or "expression" + # "file" refers to a file path of a .txt or .md file relative to the installation root + # "expression" refers to simple or compound expression of license identifiers + # listed at https://spdx.org/licenses/ + # Note that only one of CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME and + # CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION may be specified. If both are specified, + # CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME takes precedence and CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION is ignored. + if(CPACK_NUGET_PACKAGE_LICENSE_FILE_NAME) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_FILE_NAME + ATTRIBUTES [[type="file"]] + ) + elseif(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION) + _cpack_nuget_variable_fallback_and_wrap_into_element( + license LICENSE_EXPRESSION + ATTRIBUTES [[type="expression"]] + ) + endif() + + # "icon" refers to a file path relative to the installation root + _cpack_nuget_variable_fallback_and_wrap_into_element(icon ICON) + # "summary" is deprecated in favor of "description" _cpack_nuget_variable_fallback_and_wrap_into_element( summary DESCRIPTION_SUMMARY FALLBACK_VARS @@ -222,7 +287,12 @@ function(_cpack_nuget_render_spec) endif() _cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES) _cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT) + # "language" is a locale identifier such as "en_CA" + _cpack_nuget_variable_fallback_and_wrap_into_element(language LANGUAGE) _cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ") + # "repository" holds repository metadata consisting of four optional + # attributes: "type", "url", "branch", and "commit". While all fields are + # considered optional, they are not independent. Currently unsupported. # Handle dependencies _cpack_nuget_variable_fallback(_deps DEPENDENCIES) diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index 6009ce0..b448c76 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -1,4 +1,4 @@ -; CPack install script designed for a nmake build +; CPack install script designed for a nmake build ;-------------------------------- ; You must define these values diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake index 160eada..3a279ca 100644 --- a/Modules/Platform/Android-Clang.cmake +++ b/Modules/Platform/Android-Clang.cmake @@ -7,6 +7,23 @@ if(__ANDROID_COMPILER_CLANG) endif() set(__ANDROID_COMPILER_CLANG 1) +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Clang.cmake OPTIONAL) +endif() + +# Load flags from NDK. This file may provides the following variables: +# _ANDROID_NDK_INIT_CFLAGS +# _ANDROID_NDK_INIT_CFLAGS_DEBUG +# _ANDROID_NDK_INIT_CFLAGS_RELEASE +# _ANDROID_NDK_INIT_LDFLAGS +# _ANDROID_NDK_INIT_LDFLAGS_EXE +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/flags.cmake OPTIONAL + RESULT_VARIABLE _INCLUDED_FLAGS) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. Later we may try to integrate this. @@ -34,20 +51,29 @@ endif() include(Platform/Android-Common) -# The NDK toolchain configuration files at: -# -# <ndk>/[build/core/]toolchains/*-clang*/setup.mk -# -# contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target. -# We need to produce the same target here to produce compatible binaries. -include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang) +if(_INCLUDED_FLAGS) + # NDK provides the flags. + set(_ANDROID_ABI_INIT_CFLAGS "${_ANDROID_NDK_INIT_CFLAGS}") + set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "${_ANDROID_NDK_INIT_CFLAGS_DEBUG}") + set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "${_ANDROID_NDK_INIT_CFLAGS_RELEASE}") + set(_ANDROID_ABI_INIT_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS}") + set(_ANDROID_ABI_INIT_EXE_LDFLAGS "${_ANDROID_NDK_INIT_LDFLAGS_EXE}") +else() + # The NDK toolchain configuration files at: + # + # <ndk>/[build/core/]toolchains/*-clang*/setup.mk + # + # contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target. + # We need to produce the same target here to produce compatible binaries. + include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang) +endif() macro(__android_compiler_clang lang) if(NOT "x${lang}" STREQUAL "xASM") __android_compiler_common(${lang}) endif() if(NOT CMAKE_${lang}_COMPILER_TARGET) - set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}") + set(CMAKE_${lang}_COMPILER_TARGET "${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) string(APPEND CMAKE_${lang}_COMPILER_TARGET "${CMAKE_SYSTEM_VERSION}") endif() @@ -57,3 +83,9 @@ macro(__android_compiler_clang lang) set(_ANDROID_STL_NOSTDLIBXX 1) endif() endmacro() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Clang.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 581fde4..39da933 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -53,6 +53,12 @@ if(CMAKE_ANDROID_STL_TYPE) set(_ANDROID_STL_RTTI 0) macro(__android_stl lang) string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++") + if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI) + string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi") + if(CMAKE_SYSTEM_VERSION LESS 21) + list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support") + endif() + endif() endmacro() elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "c++_static") set(_ANDROID_STL_EXCEPTIONS 1) @@ -81,6 +87,12 @@ if(CMAKE_ANDROID_STL_TYPE) "Android: STL '${CMAKE_ANDROID_STL_TYPE}' not supported by this NDK." ) endif() + if(DEFINED CMAKE_ANDROID_RTTI) + set(_ANDROID_STL_RTTI ${CMAKE_ANDROID_RTTI}) + endif() + if(DEFINED CMAKE_ANDROID_EXCEPTIONS) + set(_ANDROID_STL_EXCEPTIONS ${CMAKE_ANDROID_EXCEPTIONS}) + endif() elseif(CMAKE_ANDROID_NDK) macro(__android_stl_inc lang dir req) diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index bc66ba1..c279086 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -5,6 +5,12 @@ # This module detects platform-wide information about the Android target # in order to store it in "CMakeSystem.cmake". +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Determine.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. @@ -209,6 +215,14 @@ if(CMAKE_ANDROID_NDK) # NDK >= 18 has abis.cmake. It provides: # NDK_KNOWN_DEVICE_ABI32S # NDK_KNOWN_DEVICE_ABI64S + # NDK >= 23 also provides: + # NDK_KNOWN_DEVICE_ABIS + # NDK_ABI_<abi>_PROC + # NDK_ABI_<abi>_ARCH + # NDK_ABI_<abi>_TRIPLE + # NDK_ABI_<abi>_LLVM_TRIPLE + # NDK_PROC_<processor>_ABI + # NDK_ARCH_<arch>_ABI include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake" OPTIONAL RESULT_VARIABLE _INCLUDED_ABIS) endif() @@ -247,60 +261,75 @@ else() endif() if(_INCLUDED_ABIS) - set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S}) + if(NDK_KNOWN_DEVICE_ABIS) + set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABIS}) + else() + set(_ANDROID_KNOWN_ABIS ${NDK_KNOWN_DEVICE_ABI32S} ${NDK_KNOWN_DEVICE_ABI64S}) + endif() endif() -# https://developer.android.com/ndk/guides/abis.html - -set(_ANDROID_ABI_arm64-v8a_PROC "aarch64") -set(_ANDROID_ABI_arm64-v8a_ARCH "arm64") -set(_ANDROID_ABI_arm64-v8a_TRIPLE "aarch64-linux-android") -set(_ANDROID_ABI_armeabi-v7a_PROC "armv7-a") -set(_ANDROID_ABI_armeabi-v7a_ARCH "arm") -set(_ANDROID_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi") -set(_ANDROID_ABI_armeabi-v6_PROC "armv6") -set(_ANDROID_ABI_armeabi-v6_ARCH "arm") -set(_ANDROID_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi") -set(_ANDROID_ABI_armeabi_PROC "armv5te") -set(_ANDROID_ABI_armeabi_ARCH "arm") -set(_ANDROID_ABI_armeabi_TRIPLE "arm-linux-androideabi") -set(_ANDROID_ABI_mips_PROC "mips") -set(_ANDROID_ABI_mips_ARCH "mips") -set(_ANDROID_ABI_mips_TRIPLE "mipsel-linux-android") -set(_ANDROID_ABI_mips64_PROC "mips64") -set(_ANDROID_ABI_mips64_ARCH "mips64") -set(_ANDROID_ABI_mips64_TRIPLE "mips64el-linux-android") -set(_ANDROID_ABI_x86_PROC "i686") -set(_ANDROID_ABI_x86_ARCH "x86") -set(_ANDROID_ABI_x86_TRIPLE "i686-linux-android") -set(_ANDROID_ABI_x86_64_PROC "x86_64") -set(_ANDROID_ABI_x86_64_ARCH "x86_64") -set(_ANDROID_ABI_x86_64_TRIPLE "x86_64-linux-android") - -set(_ANDROID_PROC_aarch64_ARCH_ABI "arm64-v8a") -set(_ANDROID_PROC_armv7-a_ARCH_ABI "armeabi-v7a") -set(_ANDROID_PROC_armv6_ARCH_ABI "armeabi-v6") -set(_ANDROID_PROC_armv5te_ARCH_ABI "armeabi") -set(_ANDROID_PROC_i686_ARCH_ABI "x86") -set(_ANDROID_PROC_mips_ARCH_ABI "mips") -set(_ANDROID_PROC_mips64_ARCH_ABI "mips64") -set(_ANDROID_PROC_x86_64_ARCH_ABI "x86_64") - -set(_ANDROID_ARCH_arm64_ABI "arm64-v8a") -set(_ANDROID_ARCH_arm_ABI "armeabi") -set(_ANDROID_ARCH_mips_ABI "mips") -set(_ANDROID_ARCH_mips64_ABI "mips64") -set(_ANDROID_ARCH_x86_ABI "x86") -set(_ANDROID_ARCH_x86_64_ABI "x86_64") +if(NOT DEFINED NDK_KNOWN_DEVICE_ABIS) + # The NDK is not new enough to provide ABI information. + # https://developer.android.com/ndk/guides/abis.html + + set(NDK_ABI_arm64-v8a_PROC "aarch64") + set(NDK_ABI_arm64-v8a_ARCH "arm64") + set(NDK_ABI_arm64-v8a_TRIPLE "aarch64-linux-android") + set(NDK_ABI_arm64-v8a_LLVM_TRIPLE "aarch64-none-linux-android") + set(NDK_ABI_armeabi-v7a_PROC "armv7-a") + set(NDK_ABI_armeabi-v7a_ARCH "arm") + set(NDK_ABI_armeabi-v7a_TRIPLE "arm-linux-androideabi") + set(NDK_ABI_armeabi-v7a_LLVM_TRIPLE "armv7-none-linux-androideabi") + set(NDK_ABI_armeabi-v6_PROC "armv6") + set(NDK_ABI_armeabi-v6_ARCH "arm") + set(NDK_ABI_armeabi-v6_TRIPLE "arm-linux-androideabi") + set(NDK_ABI_armeabi-v6_LLVM_TRIPLE "armv6-none-linux-androideabi") + set(NDK_ABI_armeabi_PROC "armv5te") + set(NDK_ABI_armeabi_ARCH "arm") + set(NDK_ABI_armeabi_TRIPLE "arm-linux-androideabi") + set(NDK_ABI_armeabi_LLVM_TRIPLE "armv5te-none-linux-androideabi") + set(NDK_ABI_mips_PROC "mips") + set(NDK_ABI_mips_ARCH "mips") + set(NDK_ABI_mips_TRIPLE "mipsel-linux-android") + set(NDK_ABI_mips_LLVM_TRIPLE "mipsel-none-linux-android") + set(NDK_ABI_mips64_PROC "mips64") + set(NDK_ABI_mips64_ARCH "mips64") + set(NDK_ABI_mips64_TRIPLE "mips64el-linux-android") + set(NDK_ABI_mips64_LLVM_TRIPLE "mips64el-none-linux-android") + set(NDK_ABI_x86_PROC "i686") + set(NDK_ABI_x86_ARCH "x86") + set(NDK_ABI_x86_TRIPLE "i686-linux-android") + set(NDK_ABI_x86_LLVM_TRIPLE "i686-none-linux-android") + set(NDK_ABI_x86_64_PROC "x86_64") + set(NDK_ABI_x86_64_ARCH "x86_64") + set(NDK_ABI_x86_64_TRIPLE "x86_64-linux-android") + set(NDK_ABI_x86_64_LLVM_TRIPLE "x86_64-none-linux-android") + + set(NDK_PROC_aarch64_ABI "arm64-v8a") + set(NDK_PROC_armv7-a_ABI "armeabi-v7a") + set(NDK_PROC_armv6_ABI "armeabi-v6") + set(NDK_PROC_armv5te_ABI "armeabi") + set(NDK_PROC_i686_ABI "x86") + set(NDK_PROC_mips_ABI "mips") + set(NDK_PROC_mips64_ABI "mips64") + set(NDK_PROC_x86_64_ABI "x86_64") + + set(NDK_ARCH_arm64_ABI "arm64-v8a") + set(NDK_ARCH_arm_ABI "armeabi") + set(NDK_ARCH_mips_ABI "mips") + set(NDK_ARCH_mips64_ABI "mips64") + set(NDK_ARCH_x86_ABI "x86") + set(NDK_ARCH_x86_64_ABI "x86_64") +endif() # Validate inputs. -if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC") +if(CMAKE_ANDROID_ARCH_ABI AND NOT DEFINED "NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC") message(FATAL_ERROR "Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}'.") endif() -if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI") +if(CMAKE_SYSTEM_PROCESSOR AND NOT DEFINED "NDK_PROC_${CMAKE_SYSTEM_PROCESSOR}_ABI") message(FATAL_ERROR "Android: Unknown processor CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}'.") endif() -if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI") +if(_ANDROID_SYSROOT_ARCH AND NOT DEFINED "NDK_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI") message(FATAL_ERROR "Android: Unknown architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n" " ${CMAKE_SYSROOT}" @@ -310,9 +339,9 @@ endif() # Select an ABI. if(NOT CMAKE_ANDROID_ARCH_ABI) if(CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_PROC_${CMAKE_SYSTEM_PROCESSOR}_ARCH_ABI}") + set(CMAKE_ANDROID_ARCH_ABI "${NDK_PROC_${CMAKE_SYSTEM_PROCESSOR}_ABI}") elseif(_ANDROID_SYSROOT_ARCH) - set(CMAKE_ANDROID_ARCH_ABI "${_ANDROID_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}") + set(CMAKE_ANDROID_ARCH_ABI "${NDK_ARCH_${_ANDROID_SYSROOT_ARCH}_ABI}") elseif(_INCLUDED_ABIS) # Default to the oldest ARM ABI. foreach(abi armeabi armeabi-v7a arm64-v8a) @@ -368,7 +397,7 @@ if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST _ANDROID_KNOWN_ABIS) "Supported ABIS: ${_ANDROID_KNOWN_ABIS}." ) endif() -set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}") +set(CMAKE_ANDROID_ARCH "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}") if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ANDROID_ARCH}") message(FATAL_ERROR "Android: Architecture '${_ANDROID_SYSROOT_ARCH}' specified in CMAKE_SYSROOT:\n" @@ -376,15 +405,17 @@ if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ "does not match architecture '${CMAKE_ANDROID_ARCH}' for the ABI '${CMAKE_ANDROID_ARCH_ABI}'." ) endif() -set(CMAKE_ANDROID_ARCH_TRIPLE "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_TRIPLE}") +set(CMAKE_ANDROID_ARCH_TRIPLE "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_TRIPLE}") +set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE + "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_LLVM_TRIPLE}") # Select a processor. if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}") + set(CMAKE_SYSTEM_PROCESSOR "${NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC}") endif() # If the user specified both an ABI and a processor then they might not match. -if(NOT _ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR) +if(NOT NDK_ABI_${CMAKE_ANDROID_ARCH_ABI}_PROC STREQUAL CMAKE_SYSTEM_PROCESSOR) message(FATAL_ERROR "Android: The specified CMAKE_ANDROID_ARCH_ABI='${CMAKE_ANDROID_ARCH_ABI}' and CMAKE_SYSTEM_PROCESSOR='${CMAKE_SYSTEM_PROCESSOR}' is not a valid combination.") endif() @@ -491,6 +522,7 @@ set(CMAKE_ANDROID_ARCH_ABI \"${CMAKE_ANDROID_ARCH_ABI}\") if(CMAKE_ANDROID_NDK) string(APPEND CMAKE_SYSTEM_CUSTOM_CODE "set(CMAKE_ANDROID_ARCH_TRIPLE \"${CMAKE_ANDROID_ARCH_TRIPLE}\")\n" + "set(CMAKE_ANDROID_ARCH_LLVM_TRIPLE \"${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}\")\n" "set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS \"${CMAKE_ANDROID_NDK_DEPRECATED_HEADERS}\")\n" "set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \"${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}\")\n" "set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED \"${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}\")\n" @@ -528,3 +560,9 @@ endif() message(STATUS "Android: Targeting API '${CMAKE_SYSTEM_VERSION}' with architecture '${CMAKE_ANDROID_ARCH}', ABI '${CMAKE_ANDROID_ARCH_ABI}', and processor '${CMAKE_SYSTEM_PROCESSOR}'") cmake_policy(POP) + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Determine.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index 5019c28..6116ae1 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -4,6 +4,12 @@ # When CMAKE_SYSTEM_NAME is "Android", CMakeSystemSpecificInitialize loads this # module. +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android-Initialize.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. @@ -17,7 +23,7 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1) return() endif() -set(CMAKE_BUILD_TYPE_INIT Debug) +set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo") # Skip sysroot selection if the NDK has a unified toolchain. if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) @@ -53,3 +59,9 @@ else() "Android: No CMAKE_SYSROOT was selected." ) endif() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android-Initialize.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index 8ffa1b2..e4b9a09 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -1,3 +1,9 @@ +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL) +endif() + include(Platform/Linux) set(ANDROID 1) @@ -22,3 +28,65 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") set(CMAKE_LINK_LIBRARY_FLAG "") endif() + +# Commonly used Android toolchain files that pre-date CMake upstream support +# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them. +if(CMAKE_SYSTEM_VERSION EQUAL 1) + return() +endif() + +if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) + # Tell CMake not to search host sysroots for headers/libraries. + + # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under + # CMAKE_FIND_ROOT_PATH. This is set because: + # 1. Users may structure their libraries in a way similar to NDK. When they do that, + # they can simply append another path to CMAKE_FIND_ROOT_PATH. + # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY + # to be meaningful. https://github.com/android-ndk/ndk/issues/890 + list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot") + + # Allow users to override these values in case they want more strict behaviors. + # For example, they may want to prevent the NDK's libz from being picked up so + # they can use their own. + # https://github.com/android-ndk/ndk/issues/517 + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + endif() + + # Don't search paths in PATH environment variable. + if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) + endif() + + # Allows CMake to find headers in the architecture-specific include directories. + set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}") + + # Instructs CMake to search the correct API level for libraries. + # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>. + # So we can add the API level specific directory directly. + # https://github.com/android/ndk/issues/929 + list(PREPEND CMAKE_SYSTEM_PREFIX_PATH + "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}" + ) + + list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin") +endif() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake index f9c2d89..f8eae62 100644 --- a/Modules/Platform/Android/Determine-Compiler.cmake +++ b/Modules/Platform/Android/Determine-Compiler.cmake @@ -7,6 +7,12 @@ if(__ANDROID_DETERMINE_COMPILER) endif() set(__ANDROID_DETERMINE_COMPILER 1) +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Determine-Compiler.cmake OPTIONAL) +endif() + # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously # implemented in the CMake VS IDE generators. Avoid interfering with # that functionality for now. Later we may try to integrate this. @@ -83,3 +89,9 @@ set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_S ") endif() endmacro() + +# Include the NDK hook. +# It can be used by NDK to inject necessary fixes for an earlier cmake. +if(CMAKE_ANDROID_NDK) + include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Determine-Compiler.cmake OPTIONAL) +endif() diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake index f4717d5..c18c0a2 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake @@ -1,6 +1,3 @@ -# <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android") - # Suppress -Wl,-z,nocopyreloc flag on arm64-v8a set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake index b857bd3..2b1de03 100644 --- a/Modules/Platform/Android/abi-armeabi-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake @@ -1,6 +1,3 @@ -# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "armv5te-none-linux-androideabi") - string(APPEND _ANDROID_ABI_INIT_CFLAGS " -march=armv5te" ) diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake index a7412f5..bb176ae 100644 --- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake @@ -1,6 +1,3 @@ -# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "armv6-none-linux-androideabi") - string(APPEND _ANDROID_ABI_INIT_CFLAGS " -march=armv6" ) diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake index e2ab58b..6feeef6 100644 --- a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake @@ -1,6 +1,3 @@ -# <ndk>/build/core/toolchains/arm-linux-androideabi-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "armv7-none-linux-androideabi") - string(APPEND _ANDROID_ABI_INIT_CFLAGS " -march=armv7-a" ) diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake index 73addde..7df6a36 100644 --- a/Modules/Platform/Android/abi-mips-Clang.cmake +++ b/Modules/Platform/Android/abi-mips-Clang.cmake @@ -1,4 +1 @@ -# <ndk>/build/core/toolchains/mipsel-linux-android-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android") - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake index 603f1b2..7df6a36 100644 --- a/Modules/Platform/Android/abi-mips64-Clang.cmake +++ b/Modules/Platform/Android/abi-mips64-Clang.cmake @@ -1,4 +1 @@ -# <ndk>/build/core/toolchains/mips64el-linux-android-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android") - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake index fe7eace..7df6a36 100644 --- a/Modules/Platform/Android/abi-x86-Clang.cmake +++ b/Modules/Platform/Android/abi-x86-Clang.cmake @@ -1,4 +1 @@ -# <ndk>/build/core/toolchains/x86-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android") - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake index 3cbcd49..7df6a36 100644 --- a/Modules/Platform/Android/abi-x86_64-Clang.cmake +++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake @@ -1,4 +1 @@ -# <ndk>/build/core/toolchains/x86_64-clang/setup.mk -set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android") - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake index d007105..322e3fb 100644 --- a/Modules/Platform/Windows-Clang-C.cmake +++ b/Modules/Platform/Windows-Clang-C.cmake @@ -1,2 +1,18 @@ include(Platform/Windows-Clang) __windows_compiler_clang(C) + +if("x${MAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) + endif() +elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPFILE_FORMAT gcc) + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) + endif() +endif() diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake index f1d40f2..b4aaf1e 100644 --- a/Modules/Platform/Windows-Clang-CXX.cmake +++ b/Modules/Platform/Windows-Clang-CXX.cmake @@ -1,3 +1,19 @@ include(Platform/Windows-Clang) set(_COMPILE_CXX_MSVC " -TP") __windows_compiler_clang(CXX) + +if("x${MAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + endif() +elseif("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPFILE_FORMAT gcc) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + endif() +endif() diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 389d6ab..51e9e81 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -27,7 +27,7 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_SHARED_MODULE_SUFFIX ".dll") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") if(NOT "${lang}" STREQUAL "ASM") - set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>") + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") endif() set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") @@ -114,8 +114,10 @@ macro(__enable_llvm_rc_preprocessing clang_option_prefix extra_pp_flags) set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) endif() if(DEFINED CMAKE_RC_PREPROCESSOR) - set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEPFILE>") - set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> ${extra_pp_flags} -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> /fo <OBJECT> <OBJECT>.pp") + set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEP_FILE>") + # The <FLAGS> are passed to the preprocess and the resource compiler to pick + # up the eventual -D / -C options passed through the CMAKE_RC_FLAGS. + set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> ${extra_pp_flags} -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> <FLAGS> /fo <OBJECT> <OBJECT>.pp") if(CMAKE_GENERATOR MATCHES "Ninja") set(CMAKE_NINJA_CMCLDEPS_RC 0) set(CMAKE_NINJA_DEP_TYPE_RC gcc) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 59f3ca5..8f1d024 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -35,8 +35,8 @@ else() set(_tR "-tR") # Target uses the dynamic RTL set(_tW "-tW") # Target is a Windows application endif() -set(_COMPILE_C "-c") -set(_COMPILE_CXX "-P -c") +set(_COMPILE_C "") +set(_COMPILE_CXX " -P") set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "") @@ -87,7 +87,7 @@ macro(__embarcadero_language lang) # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT> ${_COMPILE_${lang}} <SOURCE>" + "<CMAKE_${lang}_COMPILER> ${_tR} -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<OBJECT>${_COMPILE_${lang}} -c <SOURCE>" ) set(CMAKE_${lang}_LINK_EXECUTABLE @@ -98,7 +98,7 @@ macro(__embarcadero_language lang) # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>" + "cpp32 -DWIN32 <DEFINES> <INCLUDES> <FLAGS> -o<PREPROCESSED_SOURCE>${_COMPILE_${lang}} -c <SOURCE>" ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake index 06d8f50..152b27c 100644 --- a/Modules/Platform/Windows-Intel-C.cmake +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -1,4 +1,27 @@ include(Platform/Windows-Intel) __windows_compiler_intel(C) -set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake -set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <OBJECT> -QMF <DEPFILE>") + +set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_C_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) + endif() +endif() + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) +endif() diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index 666de6e..ce33ae1 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,5 +1,28 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") __windows_compiler_intel(CXX) -set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake -set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <OBJECT> -QMF <DEPFILE>") + +set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_CXX_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) + endif() +endif() + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) +endif() diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 5d8f7fc..01f8dd0 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -8,6 +8,20 @@ if(__WINDOWS_INTEL) endif() set(__WINDOWS_INTEL 1) + +if (CMAKE_GENERATOR MATCHES "^Ninja") + # retrieve ninja version to enable dependencies configuration + # against Ninja capabilities + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version + RESULT_VARIABLE _CMAKE_NINJA_RESULT + OUTPUT_VARIABLE _CMAKE_NINJA_VERSION + ERROR_VARIABLE _CMAKE_NINJA_VERSION) + if (NOT _CMAKE_NINJA_RESULT AND _CMAKE_NINJA_VERSION MATCHES "[0-9]+(\\.[0-9]+)*") + set (_CMAKE_NINJA_VERSION "${CMAKE_MATCH_0}") + endif() + unset(_CMAKE_NINJA_RESULT) +endif() + include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) __windows_compiler_msvc(${lang}) diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake index cbe1586..67b6827 100644 --- a/Modules/Platform/Windows-MSVC-C.cmake +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -3,3 +3,10 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) set(_FS_C " /FS") endif() __windows_compiler_msvc(C) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_C) + # dependencies are computed by the compiler itself + set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) +endif() diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake index 0e85005..6fea617 100644 --- a/Modules/Platform/Windows-MSVC-CXX.cmake +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -4,3 +4,10 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) set(_FS_CXX " /FS") endif() __windows_compiler_msvc(CXX) + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_CXX) + # dependencies are computed by the compiler itself + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index bd08718..08afd61 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -163,6 +163,14 @@ foreach(lang C CXX) endif() endforeach() +cmake_policy(GET CMP0117 __WINDOWS_MSVC_CMP0117) +if(__WINDOWS_MSVC_CMP0117 STREQUAL "NEW") + set(_GR "") +else() + set(_GR " /GR") +endif() +unset(__WINDOWS_MSVC_CMP0117) + if(WINCE) foreach(lang C CXX) string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER) @@ -182,7 +190,7 @@ if(WINCE) set(_RTC1 "") set(_FLAGS_C "") - set(_FLAGS_CXX " /GR /EHsc") + set(_FLAGS_CXX "${_GR} /EHsc") foreach(lang C CXX) if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM") @@ -204,7 +212,7 @@ if(WINCE) elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(_PLATFORM_DEFINES "/DWIN32") set(_FLAGS_C " /DUNICODE /D_UNICODE") - set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") + set(_FLAGS_CXX " /DUNICODE /D_UNICODE${_GR} /EHsc") if(WINDOWS_STORE AND MSVC_VERSION GREATER 1899) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib") elseif(WINDOWS_PHONE) @@ -226,12 +234,12 @@ else() set(_FLAGS_CXX " -frtti -fexceptions") else() set(_RTC1 "/RTC1") - set(_FLAGS_CXX " /GR /EHsc") + set(_FLAGS_CXX "${_GR} /EHsc") endif() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") else() set(_RTC1 "/GZ") - set(_FLAGS_CXX " /GR /GX") + set(_FLAGS_CXX "${_GR} /GX") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") endif() @@ -241,6 +249,8 @@ else() endif() endif() +unset(_GR) + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags @@ -425,8 +435,14 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -MDd) endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) - set(CMAKE_NINJA_DEPTYPE_${lang} msvc) + __windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") + + # define generic information about compiler dependencies + if (MSVC_VERSION GREATER 1300) + set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes") + set(CMAKE_${lang}_DEPFILE_FORMAT msvc) + endif() endmacro() macro(__windows_compiler_msvc_enable_rc flags) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 43ec889..bda23ab 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -15,6 +15,9 @@ Otherwise it is set to 0. Currently this functionality is implemented for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and Windows. +.. versionchanged:: 3.15 + On Linux, returns the container CPU count instead of the host CPU count. + This function is guaranteed to return a positive integer (>=1) if it succeeds. It returns 0 if there's a problem determining the processor count. diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake index 8a769b7..ea8ca73 100644 --- a/Modules/TestBigEndian.cmake +++ b/Modules/TestBigEndian.cmake @@ -5,19 +5,41 @@ TestBigEndian ------------- -Define macro to determine endian type +.. deprecated:: 3.20 -Check if the system is big endian or little endian + Supserseded by the :variable:`CMAKE_<LANG>_BYTE_ORDER` variable. -:: +Check if the target architecture is big endian or little endian. + +.. command:: test_big_endian + + .. code-block:: cmake + + test_big_endian(<var>) + + Stores in variable ``<var>`` either 1 or 0 indicating whether the + target architecture is big or little endian. - TEST_BIG_ENDIAN(VARIABLE) - VARIABLE - variable to store the result to #]=======================================================================] +include_guard() include(CheckTypeSize) -macro(TEST_BIG_ENDIAN VARIABLE) +function(TEST_BIG_ENDIAN VARIABLE) + if(";${CMAKE_C_BYTE_ORDER};${CMAKE_CXX_BYTE_ORDER};${CMAKE_CUDA_BYTE_ORDER};${CMAKE_OBJC_BYTE_ORDER};${CMAKE_OBJCXX_BYTE_ORDER};" MATCHES ";(BIG_ENDIAN|LITTLE_ENDIAN);") + set(order "${CMAKE_MATCH_1}") + if(order STREQUAL "BIG_ENDIAN") + set("${VARIABLE}" 1 PARENT_SCOPE) + else() + set("${VARIABLE}" 0 PARENT_SCOPE) + endif() + else() + __TEST_BIG_ENDIAN_LEGACY_IMPL(is_big) + set("${VARIABLE}" "${is_big}" PARENT_SCOPE) + endif() +endfunction() + +macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE) if(NOT DEFINED HAVE_${VARIABLE}) message(CHECK_START "Check if the system is big endian") message(CHECK_START "Searching 16 bit integer") @@ -119,5 +141,3 @@ macro(TEST_BIG_ENDIAN VARIABLE) endif() endif() endmacro() - - diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index db3fb95..a5f8a08 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -36,17 +36,21 @@ compiling the java sources and also to the dependencies of the target. For backwards compatibility, jar files listed as sources are ignored (as they have been since the first version of this module). +.. versionadded:: 3.4 + Support fot response files (prefixed by ``@``) in the ``SOURCES`` list. + The default ``OUTPUT_DIR`` can also be changed by setting the variable ``CMAKE_JAVA_TARGET_OUTPUT_DIR``. -Optionally, using option ``GENERATE_NATIVE_HEADERS``, native header files can -be generated for methods declared as native. These files provide the -connective glue that allow your Java and C code to interact. An INTERFACE -target will be created for an easy usage of generated files. Sub-option -``DESTINATION`` can be used to specify the output directory for generated -header files. +.. versionadded:: 3.11 + Optionally, using option ``GENERATE_NATIVE_HEADERS``, native header files can + be generated for methods declared as native. These files provide the + connective glue that allow your Java and C code to interact. An INTERFACE + target will be created for an easy usage of generated files. Sub-option + ``DESTINATION`` can be used to specify the output directory for generated + header files. -``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK. + ``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK. The ``add_jar()`` function sets the following target properties on ``<target_name>``: @@ -77,6 +81,9 @@ described above, and is used by ``install_jar_exports()``. You can get this information with :command:`get_property` and the ``INSTALL_DESTINATION`` property key. +.. versionadded:: 3.4 + The second signature with ``DESTINATION`` and ``COMPONENT`` options. + .. code-block:: cmake install_jni_symlink(<target_name> <destination>) @@ -86,6 +93,14 @@ This command installs the ``<target_name>`` JNI symlinks to the given ``<destination>``. It should be called in the same scope as ``add_jar()`` or it will fail. +.. versionadded:: 3.4 + The second signature with ``DESTINATION`` and ``COMPONENT`` options. + +Exporting JAR Targets +^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.7 + .. code-block:: cmake install_jar_exports(TARGETS <jars>... @@ -97,6 +112,9 @@ This command installs a target export file ``<filename>`` for the named jar targets to the given ``<destination>`` directory. Its function is similar to that of :command:`install(EXPORTS)`. +.. versionadded:: 3.9 + The ``NAMESPACE`` option. + .. code-block:: cmake export_jars(TARGETS <jars>... @@ -106,6 +124,9 @@ that of :command:`install(EXPORTS)`. This command writes a target export file ``<filename>`` for the named ``<jars>`` targets. Its function is similar to that of :command:`export`. +.. versionadded:: 3.9 + The ``NAMESPACE`` option. + Examples """""""" @@ -316,17 +337,16 @@ Header Generation [OUTPUT_NAME <path>|OUTPUT_DIR <path>] ) -Create C header files from java classes. These files provide the connective glue -that allow your Java and C code to interact. +.. versionadded:: 3.4 .. deprecated:: 3.11 - -.. note:: - This command will no longer be supported starting with version 10 of the JDK due to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_. The ``add_jar(GENERATE_NATIVE_HEADERS)`` command should be used instead. +Create C header files from java classes. These files provide the connective glue +that allow your Java and C code to interact. + There are two main signatures for ``create_javah()``. The first signature returns generated files through variable specified by the ``GENERATED_FILES`` option. For example: @@ -406,8 +426,8 @@ function(__java_export_jar VAR TARGET PATH) endfunction() # define helper scripts -set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in) -set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) +set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJava/javaTargets.cmake.in) +set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJava/Symlinks.cmake) if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") set(_UseJava_PATH_SEP "$<SEMICOLON>") @@ -636,7 +656,7 @@ function(add_jar _TARGET_NAME) COMMAND ${CMAKE_COMMAND} -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} -DCMAKE_JAR_CLASSES_PREFIX=${CMAKE_JAR_CLASSES_PREFIX} - -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/UseJavaClassFilelist.cmake + -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/UseJava/ClassFilelist.cmake DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJava/ClassFilelist.cmake index 1c4baa9..aa9e35d 100644 --- a/Modules/UseJavaClassFilelist.cmake +++ b/Modules/UseJava/ClassFilelist.cmake @@ -1,18 +1,9 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#[=======================================================================[.rst: -UseJavaClassFilelist --------------------- - - - - - -This script create a list of compiled Java class files to be added to -a jar file. This avoids including cmake files which get created in -the binary directory. -#]=======================================================================] +# This script creates a list of compiled Java class files to be added to +# a jar file. This avoids including cmake files which get created in +# the binary directory. if (CMAKE_JAVA_CLASS_OUTPUT_PATH) if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJava/Symlinks.cmake index 3969f54..2788195 100644 --- a/Modules/UseJavaSymlinks.cmake +++ b/Modules/UseJava/Symlinks.cmake @@ -1,16 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#[=======================================================================[.rst: -UseJavaSymlinks ---------------- - - - - - -Helper script for UseJava.cmake -#]=======================================================================] +# Helper script for UseJava.cmake if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) if (_JAVA_TARGET_OUTPUT_NAME) diff --git a/Modules/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in index c5f9c78..c5f9c78 100644 --- a/Modules/javaTargets.cmake.in +++ b/Modules/UseJava/javaTargets.cmake.in diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 757e539..9b0025a 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -12,6 +12,8 @@ Defines the following command for use with ``SWIG``: .. command:: swig_add_library + .. versionadded:: 3.8 + Define swig module with given name and specified language:: swig_add_library(<name> @@ -28,13 +30,16 @@ Defines the following command for use with ``SWIG``: those targets can be used with any command expecting a target (e.g. :command:`target_link_libraries`). - .. note:: - + .. versionchanged:: 3.13 This command creates a target with the specified ``<name>`` when policy :policy:`CMP0078` is set to ``NEW``. Otherwise, the legacy behavior will choose a different target name and store it in the ``SWIG_MODULE_<name>_REAL_NAME`` variable. + .. versionchanged:: 3.15 + Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property, + for example) will be passed on to Python and CSharp wrapper libraries. + .. note:: For multi-config generators, this module does not support @@ -59,10 +64,23 @@ Defines the following command for use with ``SWIG``: ``LANGUAGE`` Specify the target language. + .. versionadded:: 3.1 + Go and Lua language support. + + .. versionadded:: 3.2 + R language support. + + .. versionadded:: 3.18 + Fortran language support. + ``NO_PROXY`` + .. versionadded:: 3.12 + Prevent the generation of the wrapper layer (swig ``-noproxy`` option). ``OUTPUT_DIR`` + .. versionadded:: 3.12 + Specify where to write the language specific files (swig ``-outdir`` option). If not given, the ``CMAKE_SWIG_OUTDIR`` variable will be used. If neither is specified, the default depends on the value of the @@ -75,6 +93,8 @@ Defines the following command for use with ``SWIG``: ``SWIG_SUPPORT_FILES_DIRECTORY`` target property. ``OUTFILE_DIR`` + .. versionadded:: 3.12 + Specify an output directory name where the generated source file will be placed (swig ``-o`` option). If not specified, the ``SWIG_OUTFILE_DIR`` variable will be used. If neither is specified, ``OUTPUT_DIR`` or @@ -83,8 +103,11 @@ Defines the following command for use with ``SWIG``: ``SOURCES`` List of sources for the library. Files with extension ``.i`` will be identified as sources for the ``SWIG`` tool. Other files will be handled in - the standard way. This behavior can be overridden by specifying the variable - ``SWIG_SOURCE_FILE_EXTENSIONS``. + the standard way. + + .. versionadded:: 3.14 + This behavior can be overridden by specifying the variable + ``SWIG_SOURCE_FILE_EXTENSIONS``. .. note:: @@ -122,12 +145,22 @@ ensure generated files will receive the required settings. set_property(SOURCE mymod.i PROPERTY CPLUSPLUS ON) swig_add_library(mymod LANGUAGE python SOURCES mymod.i) +``SWIG_FLAGS`` + .. deprecated:: 3.12 + Replaced with the fine-grained properties that follow. + + Pass custom flags to the SWIG executable. + ``INCLUDE_DIRECTORIES``, ``COMPILE_DEFINITIONS`` and ``COMPILE_OPTIONS`` + .. versionadded:: 3.12 + Add custom flags to SWIG compiler and have same semantic as properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and :prop_sf:`COMPILE_OPTIONS`. ``USE_TARGET_INCLUDE_DIRECTORIES`` + .. versionadded:: 3.13 + If set to ``TRUE``, contents of target property :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler. If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be @@ -135,11 +168,15 @@ ensure generated files will receive the required settings. will be considered. ``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS`` + .. versionadded:: 3.12 + Add custom flags to the C/C++ generated source. They will fill, respectively, properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and :prop_sf:`COMPILE_OPTIONS` of generated C/C++ file. ``DEPENDS`` + .. versionadded:: 3.12 + Specify additional dependencies to the source file. ``SWIG_MODULE_NAME`` @@ -151,18 +188,21 @@ ensure generated files will receive the required settings. set_property(SOURCE mymod.i PROPERTY SWIG_MODULE_NAME mymod_realname) - .. note:: - + .. versionchanged:: 3.14 If policy :policy:`CMP0086` is set to ``NEW``, ``-module <module_name>`` is passed to ``SWIG`` compiler. ``OUTPUT_DIR`` + .. versionadded:: 3.19 + Specify where to write the language specific files (swig ``-outdir`` option) for the considered source file. If not specified, the other ways to define the output directory applies (see ``OUTPUT_DIR`` option of ``swig_add_library()`` command). ``OUTFILE_DIR`` + .. versionadded:: 3.19 + Specify an output directory where the generated source file will be placed (swig ``-o`` option) for the considered source file. If not specified, ``OUTPUT_DIR`` source property will be used. If neither are specified, the @@ -173,6 +213,8 @@ Target library properties can be set to apply same configuration to all SWIG input files. ``SWIG_INCLUDE_DIRECTORIES``, ``SWIG_COMPILE_DEFINITIONS`` and ``SWIG_COMPILE_OPTIONS`` + .. versionadded:: 3.12 + These properties will be applied to all SWIG input files and have same semantic as target properties :prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS`. @@ -185,6 +227,8 @@ input files. set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb) ``SWIG_USE_TARGET_INCLUDE_DIRECTORIES`` + .. versionadded:: 3.13 + If set to ``TRUE``, contents of target property :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler. If set to ``FALSE`` or not defined, target property @@ -192,17 +236,23 @@ input files. overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``. ``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS`` + .. versionadded:: 3.12 + These properties will populate, respectively, properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and :prop_sf:`COMPILE_FLAGS` of all generated C/C++ files. ``SWIG_DEPENDS`` + .. versionadded:: 3.12 + Add dependencies to all SWIG input files. The following target properties are output properties and can be used to get information about support files generated by ``SWIG`` interface compilation. ``SWIG_SUPPORT_FILES`` + .. versionadded:: 3.12 + This output property list of wrapper files generated during SWIG compilation. .. code-block:: cmake @@ -219,6 +269,8 @@ information about support files generated by ``SWIG`` interface compilation. ``SWIG_SUPPORT_FILES_DIRECTORY`` property to handle support files. ``SWIG_SUPPORT_FILES_DIRECTORY`` + .. versionadded:: 3.12 + This output property specifies the directory where support files will be generated. @@ -231,6 +283,8 @@ Some variables can be set to customize the behavior of ``swig_add_library`` as well as ``SWIG``: ``UseSWIG_MODULE_VERSION`` + .. versionadded:: 3.12 + Specify different behaviors for ``UseSWIG`` module. * Set to 1 or undefined: Legacy behavior is applied. @@ -244,6 +298,8 @@ as well as ``SWIG``: Specify where to write the language specific files (swig ``-outdir`` option). ``SWIG_OUTFILE_DIR`` + .. versionadded:: 3.8 + Specify an output directory name where the generated source file will be placed. If not specified, ``CMAKE_SWIG_OUTDIR`` is used. @@ -251,6 +307,8 @@ as well as ``SWIG``: Specify extra dependencies for the generated module for ``<name>``. ``SWIG_SOURCE_FILE_EXTENSIONS`` + .. versionadded:: 3.14 + Specify a list of source file extensions to override the default behavior of considering only ``.i`` files as sources for the ``SWIG`` tool. For example: diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 5100035..5e6828f 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -5,6 +5,10 @@ WriteCompilerDetectionHeader ---------------------------- +.. deprecated:: 3.20 + This module is available only if policy :policy:`CMP0120` + is not set to ``NEW``. Do not use it in new code. + .. versionadded:: 3.1 This module provides the function ``write_compiler_detection_header()``. @@ -80,19 +84,28 @@ Possible compiler identifiers are documented with the Available features in this version of CMake are listed in the :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties. -The ``{c,cxx}_std_*`` meta-features are ignored if requested. - See the :manual:`cmake-compile-features(7)` manual for information on compile features. -``BARE_FEATURES`` will define the compatibility macros with the name used in -newer versions of the language standard, so the code can use the new feature -name unconditionally. +.. versionadded:: 3.2 + Added ``MSVC`` and ``AppleClang`` compiler support. + +.. versionadded:: 3.6 + Added ``Intel`` compiler support. + +.. versionchanged:: 3.8 + The ``{c,cxx}_std_*`` meta-features are ignored if requested. -``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause -the module to generate conditions that treat unknown compilers as simply -lacking all features. Without these options the default behavior is to -generate a ``#error`` for unknown compilers and versions. +.. versionadded:: 3.8 + ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause + the module to generate conditions that treat unknown compilers as simply + lacking all features. Without these options the default behavior is to + generate a ``#error`` for unknown compilers and versions. + +.. versionadded:: 3.12 + ``BARE_FEATURES`` will define the compatibility macros with the name used in + newer versions of the language standard, so the code can use the new feature + name unconditionally. Feature Test Macros =================== @@ -234,6 +247,18 @@ library: ) #]=======================================================================] +# Guard against inclusion by absolute path. +cmake_policy(GET CMP0120 _WCDH_policy) +if(_WCDH_policy STREQUAL "NEW") + message(FATAL_ERROR "The WriteCompilerDetectionHeader module has been removed by policy CMP0120.") +elseif(_WCDH_policy STREQUAL "") + message(AUTHOR_WARNING + "The WriteCompilerDetectionHeader module will be removed by policy CMP0120. " + "Projects should be ported away from the module, perhaps by bundling a copy " + "of the generated header or using a third-party alternative." + ) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake) function(_load_compiler_variables CompilerId lang) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ca56d3a..c3b7e50 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -227,6 +227,8 @@ set(SRCS cmDependsJava.h cmDependsJavaParserHelper.cxx cmDependsJavaParserHelper.h + cmDependsCompiler.cxx + cmDependsCompiler.h cmDocumentation.cxx cmDocumentationFormatter.cxx cmDocumentationSection.cxx @@ -444,6 +446,8 @@ set(SRCS cmTest.h cmTestGenerator.cxx cmTestGenerator.h + cmTransformDepfile.cxx + cmTransformDepfile.h cmUuid.cxx cmUVHandlePtr.cxx cmUVHandlePtr.h @@ -508,6 +512,8 @@ set(SRCS cmCMakeLanguageCommand.h cmCMakeMinimumRequired.cxx cmCMakeMinimumRequired.h + cmCMakePathCommand.h + cmCMakePathCommand.cxx cmCMakePolicyCommand.cxx cmCMakePolicyCommand.h cmConditionEvaluator.cxx @@ -833,6 +839,7 @@ endif() # Ninja support set(SRCS ${SRCS} + cmScanDepFormat.cxx cmGlobalNinjaGenerator.cxx cmGlobalNinjaGenerator.h cmNinjaTypes.h @@ -1157,20 +1164,6 @@ add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE}) list(APPEND _tools cmake) target_link_libraries(cmake CMakeLib) -add_library(CMakeServerLib - cmConnection.h cmConnection.cxx - cmFileMonitor.cxx cmFileMonitor.h - cmJsonObjectDictionary.h - cmJsonObjects.h - cmJsonObjects.cxx - cmPipeConnection.cxx cmPipeConnection.h - cmServer.cxx cmServer.h - cmServerConnection.cxx cmServerConnection.h - cmServerProtocol.cxx cmServerProtocol.h - ) -target_link_libraries(CMakeServerLib CMakeLib) -target_link_libraries(cmake CMakeServerLib) - # Build CTest executable add_executable(ctest ctest.cxx ${MANIFEST_FILE}) list(APPEND _tools ctest) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e57e02e..83423f2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 20201211) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 4bad598..8e00ad6 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -174,6 +174,26 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->WizardDefaultHeight = option; } + // WizardShowPageList + if (const char* option = + this->GetOption("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + if (!this->IsVersionLess("4.0")) { + if (this->IsSetToOff("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + this->WizardShowPageList = "false"; + } else if (this->IsOn("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + this->WizardShowPageList = "true"; + } else { + this->WizardShowPageList.clear(); + } + } else { + cmCPackIFWLogger( + WARNING, + "Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to value \"" + << option << "\". But has no any effect for QtIFW less than 4.0 " + << "and will be skipped." << std::endl); + } + } + // TitleColor if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { this->TitleColor = option; @@ -408,6 +428,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("WizardDefaultHeight", this->WizardDefaultHeight); } + // WizardShowPageList + if (!this->IsVersionLess("4.0") && !this->WizardShowPageList.empty()) { + xout.Element("WizardShowPageList", this->WizardShowPageList); + } + // TitleColor if (!this->TitleColor.empty()) { xout.Element("TitleColor", this->TitleColor); diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 6f398e3..a031fc2 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -80,6 +80,10 @@ public: /// Wizard height std::string WizardDefaultHeight; + /// Set to false if the widget listing installer pages on the left side + /// of the wizard should not be shown + std::string WizardShowPageList; + /// Title color std::string TitleColor; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 560e5c1..6f21d87 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -507,7 +507,8 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME")); packageFileNames.push_back(std::move(packageFileName)); - if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE")) { + if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE") && + this->GetOption("GEN_DBGSYMDIR")) { cmsys::Glob gl; std::string findExpr(this->GetOption("GEN_DBGSYMDIR")); findExpr += "/*"; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index a9fe91c..8b544b4 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1329,7 +1329,7 @@ bool cmCPackGenerator::ConfigureFile(const std::string& inName, bool copyOnly /* = false */) { return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true, - false, true) == 1; + false) == 1; } int cmCPackGenerator::CleanTemporaryDirectory() diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 1cc267e..4151fde 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -54,22 +54,21 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() // cmProp ctestBuildConfiguration = this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION"); - const std::string* cmakeBuildConfiguration = !this->Configuration.empty() - ? &this->Configuration - : (cmNonempty(ctestBuildConfiguration) ? ctestBuildConfiguration - : &this->CTest->GetConfigType()); - - const std::string* cmakeBuildAdditionalFlags = !this->Flags.empty() - ? &this->Flags - : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS"); - const std::string* cmakeBuildTarget = !this->Target.empty() - ? &this->Target - : this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); + std::string cmakeBuildConfiguration = cmNonempty(this->Configuration) + ? this->Configuration + : cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration + : this->CTest->GetConfigType(); + + const std::string& cmakeBuildAdditionalFlags = cmNonempty(this->Flags) + ? this->Flags + : this->Makefile->GetSafeDefinition("CTEST_BUILD_FLAGS"); + const std::string& cmakeBuildTarget = cmNonempty(this->Target) + ? this->Target + : this->Makefile->GetSafeDefinition("CTEST_BUILD_TARGET"); if (cmNonempty(cmakeGeneratorName)) { - if (!cmakeBuildConfiguration) { - static const std::string sRelease = "Release"; - cmakeBuildConfiguration = &sRelease; + if (cmakeBuildConfiguration.empty()) { + cmakeBuildConfiguration = "Release"; } if (this->GlobalGenerator) { if (this->GlobalGenerator->GetName() != *cmakeGeneratorName) { @@ -88,24 +87,18 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() return nullptr; } } - if (cmakeBuildConfiguration->empty()) { - const std::string* config = nullptr; + if (cmakeBuildConfiguration.empty()) { #ifdef CMAKE_INTDIR - static const std::string sIntDir = CMAKE_INTDIR; - config = &sIntDir; + cmakeBuildConfiguration = CMAKE_INTDIR; +#else + cmakeBuildConfiguration = "Debug"; #endif - if (!config) { - static const std::string sDebug = "Debug"; - config = &sDebug; - } - cmakeBuildConfiguration = config; } std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); std::string buildCommand = this->GlobalGenerator->GenerateCMakeBuildCommand( - cmakeBuildTarget ? *cmakeBuildTarget : "", *cmakeBuildConfiguration, - cmakeBuildAdditionalFlags ? *cmakeBuildAdditionalFlags : "", + cmakeBuildTarget, cmakeBuildConfiguration, cmakeBuildAdditionalFlags, this->Makefile->IgnoreErrorsCMP0061()); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" << buildCommand << "\n", diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 4d1a589..84bb791 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -122,7 +122,7 @@ bool cmCTestSubdirCommand(std::vector<std::string> const& args, readit = status.GetMakefile().ReadDependentFile(fname); } if (!readit) { - status.SetError(cmStrCat("Could not find include file: ", fname)); + status.SetError(cmStrCat("Could not load include file: ", fname)); return false; } } diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 6fef90a..0ba2c41 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -5,7 +5,6 @@ #include "cmCTest.h" #include "cmCTestUpdateHandler.h" #include "cmMakefile.h" -#include "cmProperty.h" #include "cmSystemTools.h" cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() @@ -18,7 +17,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() this->CTest->SetCTestConfiguration( "SourceDirectory", cmSystemTools::CollapseFullPath( - cmToCStrSafe(this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"))), + this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")), this->Quiet); } std::string source_dir = diff --git a/Source/LexerParser/cmGccDepfileLexer.cxx b/Source/LexerParser/cmGccDepfileLexer.cxx index a98969d..3630f4e 100644 --- a/Source/LexerParser/cmGccDepfileLexer.cxx +++ b/Source/LexerParser/cmGccDepfileLexer.cxx @@ -994,7 +994,7 @@ case 5: YY_RULE_SETUP { // A line continuation ends the current file name. - yyextra->newDependency(); + yyextra->newRuleOrDependency(); } YY_BREAK case 6: diff --git a/Source/LexerParser/cmGccDepfileLexer.in.l b/Source/LexerParser/cmGccDepfileLexer.in.l index 08f8577..c83cb75 100644 --- a/Source/LexerParser/cmGccDepfileLexer.in.l +++ b/Source/LexerParser/cmGccDepfileLexer.in.l @@ -42,7 +42,7 @@ NEWLINE \r?\n } {WSPACE}*\\{NEWLINE} { // A line continuation ends the current file name. - yyextra->newDependency(); + yyextra->newRuleOrDependency(); } {NEWLINE} { // A newline ends the current file name and the current rule. diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 231a2d6..c1f98fa 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -190,15 +190,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, case doing_byproducts: if (!cmSystemTools::FileIsFullPath(copy)) { // This is an output to be generated, so it should be - // under the build tree. CMake 2.4 placed this under the - // source tree. However the only case that this change - // will break is when someone writes - // - // add_custom_command(OUTPUT out.txt ...) - // - // and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt". - // This is fairly obscure so we can wait for someone to - // complain. + // under the build tree. filename = cmStrCat(mf.GetCurrentBinaryDirectory(), '/'); } filename += copy; @@ -215,8 +207,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, } if (cmSystemTools::FileIsFullPath(filename)) { - filename = cmSystemTools::CollapseFullPath( - filename, status.GetMakefile().GetHomeOutputDirectory()); + filename = cmSystemTools::CollapseFullPath(filename); } switch (doing) { case doing_depfile: @@ -314,16 +305,9 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, // Check for an append request. if (append) { - if (mf.AppendCustomCommandToOutput(output[0], depends, implicit_depends, - commandLines)) { - return true; - } - - // No command for this output exists. - status.SetError( - cmStrCat("given APPEND option with output\n ", output[0], - "\nwhich is not already a custom command output.")); - return false; + mf.AppendCustomCommandToOutput(output[0], depends, implicit_depends, + commandLines); + return true; } if (uses_terminal && !job_pool.empty()) { diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx index 720f582..85e7d9e 100644 --- a/Source/cmCMakePathCommand.cxx +++ b/Source/cmCMakePathCommand.cxx @@ -250,9 +250,48 @@ bool HandleGetCommand(std::vector<std::string> const& args, return true; } +bool HandleSetCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + if (args.size() < 3 || args.size() > 4) { + status.SetError("SET must be called with two or three arguments."); + return false; + } + + if (args[1].empty()) { + status.SetError("Invalid name for path variable."); + return false; + } + + static NormalizeParser const parser; + + const auto arguments = parser.Parse(args); + + if (parser.GetInputs().size() != 1) { + status.SetError("SET called with unexpected arguments."); + return false; + } + + auto path = + cmCMakePath(parser.GetInputs().front(), cmCMakePath::native_format); + + if (arguments.Normalize) { + path = path.Normal(); + } + + status.GetMakefile().AddDefinition(args[1], path.GenericString()); + + return true; +} + bool HandleAppendCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { + if (args[1].empty()) { + status.SetError("Invalid name for path variable."); + return false; + } + static OutputVariableParser const parser{}; const auto arguments = parser.Parse(args); @@ -272,8 +311,8 @@ bool HandleAppendCommand(std::vector<std::string> const& args, return true; } -bool HandleConcatCommand(std::vector<std::string> const& args, - cmExecutionStatus& status) +bool HandleAppendStringCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { static OutputVariableParser const parser{}; @@ -546,16 +585,6 @@ bool HandleRelativePathCommand(std::vector<std::string> const& args, }); } -bool HandleProximatePathCommand(std::vector<std::string> const& args, - cmExecutionStatus& status) -{ - return HandleTransformPathCommand( - args, status, - [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { - return path.Proximate(base); - }); -} - bool HandleAbsolutePathCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { @@ -567,40 +596,6 @@ bool HandleAbsolutePathCommand(std::vector<std::string> const& args, true); } -bool HandleCMakePathCommand(std::vector<std::string> const& args, - cmExecutionStatus& status) -{ - if (args.size() < 3 || args.size() > 4) { - status.SetError("CMAKE_PATH must be called with two or three arguments."); - return false; - } - - static NormalizeParser const parser; - - const auto arguments = parser.Parse(args); - - if (parser.GetInputs().size() != 1) { - status.SetError("CMAKE_PATH called with unexpected arguments."); - return false; - } - - if (args[1].empty()) { - status.SetError("Invalid name for output variable."); - return false; - } - - auto path = - cmCMakePath(parser.GetInputs().front(), cmCMakePath::native_format); - - if (arguments.Normalize) { - path = path.Normal(); - } - - status.GetMakefile().AddDefinition(args[1], path.GenericString()); - - return true; -} - bool HandleNativePathCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { @@ -737,12 +732,7 @@ bool HandleCompareCommand(std::vector<std::string> const& args, return false; } - std::string inputPath; - if (!getInputPath(args[1], status, inputPath)) { - return false; - } - - cmCMakePath path1(inputPath); + cmCMakePath path1(args[1]); cmCMakePath path2(args[3]); auto result = op->second(path1, path2); @@ -987,17 +977,16 @@ bool cmCMakePathCommand(std::vector<std::string> const& args, static cmSubcommandTable const subcommand{ { "GET"_s, HandleGetCommand }, + { "SET"_s, HandleSetCommand }, { "APPEND"_s, HandleAppendCommand }, - { "CONCAT"_s, HandleConcatCommand }, + { "APPEND_STRING"_s, HandleAppendStringCommand }, { "REMOVE_FILENAME"_s, HandleRemoveFilenameCommand }, { "REPLACE_FILENAME"_s, HandleReplaceFilenameCommand }, { "REMOVE_EXTENSION"_s, HandleRemoveExtensionCommand }, { "REPLACE_EXTENSION"_s, HandleReplaceExtensionCommand }, { "NORMAL_PATH"_s, HandleNormalPathCommand }, { "RELATIVE_PATH"_s, HandleRelativePathCommand }, - { "PROXIMATE_PATH"_s, HandleProximatePathCommand }, { "ABSOLUTE_PATH"_s, HandleAbsolutePathCommand }, - { "CMAKE_PATH"_s, HandleCMakePathCommand }, { "NATIVE_PATH"_s, HandleNativePathCommand }, { "CONVERT"_s, HandleConvertCommand }, { "COMPARE"_s, HandleCompareCommand }, diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 8ebf6d2..9e3582c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -550,6 +550,11 @@ void* CCONV cmAddSource(void* arg, void* arg2) // Create the real cmSourceFile instance and copy over saved information. cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath); rsf->SetProperties(osf->Properties); + // In case the properties contain the GENERATED property, + // mark the real cmSourceFile as generated. + if (rsf->GetIsGenerated()) { + rsf->MarkAsGenerated(); + } for (std::string const& d : osf->Depends) { rsf->AddDepend(d); } @@ -583,14 +588,12 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop) { cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg); if (cmSourceFile* rsf = sf->RealSourceFile) { - cmProp p = rsf->GetProperty(prop); - return cmToCStr(p); + return cmToCStr(rsf->GetProperty(prop)); } if (!strcmp(prop, "LOCATION")) { return sf->FullPath.c_str(); } - cmProp retVal = sf->Properties.GetPropertyValue(prop); - return cmToCStr(retVal); + return cmToCStr(sf->Properties.GetPropertyValue(prop)); } int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8cf5ae9..8479458 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1017,6 +1017,17 @@ int cmCTest::ProcessSteps() } if (res != 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest" << std::endl); + if (!this->Impl->OutputTestOutputOnTestFailure) { + const std::string lastTestLog = + this->GetBinaryDir() + "/Testing/Temporary/LastTest.log"; + cmCTestLog(this, ERROR_MESSAGE, + "Output from these tests are in: " << lastTestLog + << std::endl); + cmCTestLog(this, ERROR_MESSAGE, + "Use \"--rerun-failed --output-on-failure\" to re-run the " + "failed cases verbosely." + << std::endl); + } } return res; } diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index c94f128..9e5b783 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -17,6 +17,7 @@ #include "cmBreakCommand.h" #include "cmBuildCommand.h" #include "cmCMakeMinimumRequired.h" +#include "cmCMakePathCommand.h" #include "cmCMakePolicyCommand.h" #include "cmCommand.h" #include "cmConfigureFileCommand.h" @@ -118,11 +119,19 @@ void GetScriptingCommands(cmState* state) { - state->AddBuiltinCommand("break", cmBreakCommand); + state->AddFlowControlCommand("break", cmBreakCommand); + state->AddFlowControlCommand("continue", cmContinueCommand); + state->AddFlowControlCommand("foreach", cmForEachCommand); + state->AddFlowControlCommand("function", cmFunctionCommand); + state->AddFlowControlCommand("if", cmIfCommand); + state->AddFlowControlCommand("macro", cmMacroCommand); + state->AddFlowControlCommand("return", cmReturnCommand); + state->AddFlowControlCommand("while", cmWhileCommand); + state->AddBuiltinCommand("cmake_minimum_required", cmCMakeMinimumRequired); + state->AddBuiltinCommand("cmake_path", cmCMakePathCommand); state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand); state->AddBuiltinCommand("configure_file", cmConfigureFileCommand); - state->AddBuiltinCommand("continue", cmContinueCommand); state->AddBuiltinCommand("exec_program", cmExecProgramCommand); state->AddBuiltinCommand("execute_process", cmExecuteProcessCommand); state->AddBuiltinCommand("file", cmFileCommand); @@ -131,26 +140,21 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("find_package", cmFindPackage); state->AddBuiltinCommand("find_path", cmFindPath); state->AddBuiltinCommand("find_program", cmFindProgram); - state->AddBuiltinCommand("foreach", cmForEachCommand); - state->AddBuiltinCommand("function", cmFunctionCommand); state->AddBuiltinCommand("get_cmake_property", cmGetCMakePropertyCommand); state->AddBuiltinCommand("get_directory_property", cmGetDirectoryPropertyCommand); state->AddBuiltinCommand("get_filename_component", cmGetFilenameComponentCommand); state->AddBuiltinCommand("get_property", cmGetPropertyCommand); - state->AddBuiltinCommand("if", cmIfCommand); state->AddBuiltinCommand("include", cmIncludeCommand); state->AddBuiltinCommand("include_guard", cmIncludeGuardCommand); state->AddBuiltinCommand("list", cmListCommand); - state->AddBuiltinCommand("macro", cmMacroCommand); state->AddBuiltinCommand("make_directory", cmMakeDirectoryCommand); state->AddBuiltinCommand("mark_as_advanced", cmMarkAsAdvancedCommand); state->AddBuiltinCommand("math", cmMathCommand); state->AddBuiltinCommand("message", cmMessageCommand); state->AddBuiltinCommand("option", cmOptionCommand); state->AddBuiltinCommand("cmake_parse_arguments", cmParseArgumentsCommand); - state->AddBuiltinCommand("return", cmReturnCommand); state->AddBuiltinCommand("separate_arguments", cmSeparateArgumentsCommand); state->AddBuiltinCommand("set", cmSetCommand); state->AddBuiltinCommand("set_directory_properties", @@ -159,7 +163,6 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("site_name", cmSiteNameCommand); state->AddBuiltinCommand("string", cmStringCommand); state->AddBuiltinCommand("unset", cmUnsetCommand); - state->AddBuiltinCommand("while", cmWhileCommand); state->AddUnexpectedCommand( "else", diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 68322cc..edd261d 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -3,11 +3,15 @@ #include "cmConfigureFileCommand.h" #include <set> +#include <sstream> #include <cm/string_view> #include <cmext/string_view> +#include <sys/types.h> + #include "cmExecutionStatus.h" +#include "cmFSPermissions.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmNewLineStyle.h" @@ -60,7 +64,19 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args, } bool copyOnly = false; bool escapeQuotes = false; - bool use_source_permissions = true; + bool useSourcePermissions = false; + bool noSourcePermissions = false; + bool filePermissions = false; + std::vector<std::string> filePermissionOptions; + + enum class Doing + { + DoingNone, + DoingFilePermissions, + DoneFilePermissions + }; + + Doing doing = Doing::DoingNone; static std::set<cm::string_view> noopOptions = { /* Legacy. */ @@ -78,6 +94,9 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args, bool atOnly = false; for (unsigned int i = 2; i < args.size(); ++i) { if (args[i] == "COPYONLY") { + if (doing == Doing::DoingFilePermissions) { + doing = Doing::DoneFilePermissions; + } copyOnly = true; if (newLineStyle.IsValid()) { status.SetError("COPYONLY could not be used in combination " @@ -85,13 +104,49 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args, return false; } } else if (args[i] == "ESCAPE_QUOTES") { + if (doing == Doing::DoingFilePermissions) { + doing = Doing::DoneFilePermissions; + } escapeQuotes = true; } else if (args[i] == "@ONLY") { + if (doing == Doing::DoingFilePermissions) { + doing = Doing::DoneFilePermissions; + } atOnly = true; } else if (args[i] == "NO_SOURCE_PERMISSIONS") { - use_source_permissions = false; + if (doing == Doing::DoingFilePermissions) { + status.SetError(" given both FILE_PERMISSIONS and " + "NO_SOURCE_PERMISSIONS. Only one option allowed."); + return false; + } + noSourcePermissions = true; + } else if (args[i] == "USE_SOURCE_PERMISSIONS") { + if (doing == Doing::DoingFilePermissions) { + status.SetError(" given both FILE_PERMISSIONS and " + "USE_SOURCE_PERMISSIONS. Only one option allowed."); + return false; + } + useSourcePermissions = true; + } else if (args[i] == "FILE_PERMISSIONS") { + if (useSourcePermissions) { + status.SetError(" given both FILE_PERMISSIONS and " + "USE_SOURCE_PERMISSIONS. Only one option allowed."); + return false; + } + if (noSourcePermissions) { + status.SetError(" given both FILE_PERMISSIONS and " + "NO_SOURCE_PERMISSIONS. Only one option allowed."); + return false; + } + + if (doing == Doing::DoingNone) { + doing = Doing::DoingFilePermissions; + filePermissions = true; + } } else if (noopOptions.find(args[i]) != noopOptions.end()) { /* Ignore no-op options. */ + } else if (doing == Doing::DoingFilePermissions) { + filePermissionOptions.push_back(args[i]); } else { unknown_args += " "; unknown_args += args[i]; @@ -104,9 +159,53 @@ bool cmConfigureFileCommand(std::vector<std::string> const& args, status.GetMakefile().IssueMessage(MessageType::AUTHOR_WARNING, msg); } - if (!status.GetMakefile().ConfigureFile( - inputFile, outputFile, copyOnly, atOnly, escapeQuotes, - use_source_permissions, newLineStyle)) { + if (useSourcePermissions && noSourcePermissions) { + status.SetError(" given both USE_SOURCE_PERMISSIONS and " + "NO_SOURCE_PERMISSIONS. Only one option allowed."); + return false; + } + + mode_t permisiions = 0; + + if (filePermissions) { + if (filePermissionOptions.empty()) { + status.SetError(" given FILE_PERMISSIONS without any options."); + return false; + } + + std::vector<std::string> invalidOptions; + for (auto const& e : filePermissionOptions) { + if (!cmFSPermissions::stringToModeT(e, permisiions)) { + invalidOptions.push_back(e); + } + } + + if (!invalidOptions.empty()) { + std::ostringstream oss; + oss << " given invalid permission "; + for (auto i = 0u; i < invalidOptions.size(); i++) { + if (i == 0u) { + oss << "\"" << invalidOptions[i] << "\""; + } else { + oss << ",\"" << invalidOptions[i] << "\""; + } + } + oss << "."; + status.SetError(oss.str()); + return false; + } + } + + if (noSourcePermissions) { + permisiions |= cmFSPermissions::mode_owner_read; + permisiions |= cmFSPermissions::mode_owner_write; + permisiions |= cmFSPermissions::mode_group_read; + permisiions |= cmFSPermissions::mode_world_read; + } + + if (!status.GetMakefile().ConfigureFile(inputFile, outputFile, copyOnly, + atOnly, escapeQuotes, permisiions, + newLineStyle)) { status.SetError("Problem configuring file"); return false; } diff --git a/Source/cmConnection.cxx b/Source/cmConnection.cxx deleted file mode 100644 index e4d0cf1..0000000 --- a/Source/cmConnection.cxx +++ /dev/null @@ -1,173 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmConnection.h" - -#include <cassert> -#include <cstring> - -#include <cm3p/uv.h> - -#include "cmServer.h" - -struct write_req_t -{ - uv_write_t req; - uv_buf_t buf; -}; - -void cmEventBasedConnection::on_alloc_buffer(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf) -{ - (void)(handle); -#ifndef __clang_analyzer__ - char* rawBuffer = new char[suggested_size]; - *buf = uv_buf_init(rawBuffer, static_cast<unsigned int>(suggested_size)); -#else - (void)(suggested_size); - (void)(buf); -#endif /* __clang_analyzer__ */ -} - -void cmEventBasedConnection::on_read(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) -{ - auto conn = static_cast<cmEventBasedConnection*>(stream->data); - if (conn) { - if (nread >= 0) { - conn->ReadData(std::string(buf->base, buf->base + nread)); - } else { - conn->OnDisconnect(static_cast<int>(nread)); - } - } - - delete[](buf->base); -} - -void cmEventBasedConnection::on_close(uv_handle_t* /*handle*/) -{ -} - -void cmEventBasedConnection::on_write(uv_write_t* req, int status) -{ - (void)(status); - - // Free req and buffer - write_req_t* wr = reinterpret_cast<write_req_t*>(req); - delete[](wr->buf.base); - delete wr; -} - -void cmEventBasedConnection::on_new_connection(uv_stream_t* stream, int status) -{ - (void)(status); - auto conn = static_cast<cmEventBasedConnection*>(stream->data); - - if (conn) { - conn->Connect(stream); - } -} - -bool cmEventBasedConnection::IsOpen() const -{ - return this->WriteStream != nullptr; -} - -void cmEventBasedConnection::WriteData(const std::string& _data) -{ -#ifndef NDEBUG - auto curr_thread_id = uv_thread_self(); - assert(this->Server); - assert(uv_thread_equal(&curr_thread_id, &this->Server->ServeThreadId)); -#endif - -#ifndef __clang_analyzer__ - auto data = _data; - assert(this->WriteStream.get()); - if (BufferStrategy) { - data = BufferStrategy->BufferOutMessage(data); - } - - auto ds = data.size(); - - write_req_t* req = new write_req_t; - req->req.data = this; - req->buf = uv_buf_init(new char[ds], static_cast<unsigned int>(ds)); - memcpy(req->buf.base, data.c_str(), ds); - uv_write(reinterpret_cast<uv_write_t*>(req), this->WriteStream, &req->buf, 1, - on_write); -#else - (void)(_data); -#endif /* __clang_analyzer__ */ -} - -void cmEventBasedConnection::ReadData(const std::string& data) -{ - this->RawReadBuffer += data; - if (BufferStrategy) { - std::string packet = BufferStrategy->BufferMessage(this->RawReadBuffer); - while (!packet.empty()) { - ProcessRequest(packet); - packet = BufferStrategy->BufferMessage(this->RawReadBuffer); - } - } else { - ProcessRequest(this->RawReadBuffer); - this->RawReadBuffer.clear(); - } -} - -cmEventBasedConnection::cmEventBasedConnection( - cmConnectionBufferStrategy* bufferStrategy) - : BufferStrategy(bufferStrategy) -{ -} - -void cmEventBasedConnection::Connect(uv_stream_t* server) -{ - (void)server; - Server->OnConnected(nullptr); -} - -void cmEventBasedConnection::OnDisconnect(int onerror) -{ - (void)onerror; - this->OnConnectionShuttingDown(); - if (this->Server) { - this->Server->OnDisconnect(this); - } -} - -cmConnection::~cmConnection() = default; - -bool cmConnection::OnConnectionShuttingDown() -{ - this->Server = nullptr; - return true; -} - -void cmConnection::SetServer(cmServerBase* s) -{ - Server = s; -} - -void cmConnection::ProcessRequest(const std::string& request) -{ - Server->ProcessRequest(this, request); -} - -bool cmConnection::OnServeStart(std::string* errString) -{ - (void)errString; - return true; -} - -bool cmEventBasedConnection::OnConnectionShuttingDown() -{ - if (this->WriteStream.get()) { - this->WriteStream->data = nullptr; - } - - WriteStream.reset(); - - return true; -} diff --git a/Source/cmConnection.h b/Source/cmConnection.h deleted file mode 100644 index 5335a7f..0000000 --- a/Source/cmConnection.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ - -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <cstddef> -#include <memory> -#include <string> - -#include <cm3p/uv.h> - -#include "cmUVHandlePtr.h" - -class cmServerBase; - -/*** - * Given a sequence of bytes with any kind of buffering, instances of this - * class arrange logical chunks according to whatever the use case is for - * the connection. - */ -class cmConnectionBufferStrategy -{ -public: - virtual ~cmConnectionBufferStrategy(); - - /*** - * Called whenever with an active raw buffer. If a logical chunk - * becomes available, that chunk is returned and that portion is - * removed from the rawBuffer - * - * @param rawBuffer in/out parameter. Receive buffer; the buffer strategy is - * free to manipulate this buffer anyway it needs to. - * - * @return Next chunk from the stream. Returns the empty string if a chunk - * isn't ready yet. Users of this interface should repeatedly call this - * function until an empty string is returned since its entirely possible - * multiple chunks come in a single raw buffer. - */ - virtual std::string BufferMessage(std::string& rawBuffer) = 0; - - /*** - * Called to properly buffer an outgoing message. - * - * @param rawBuffer Message to format in the correct way - * - * @return Formatted message - */ - virtual std::string BufferOutMessage(const std::string& rawBuffer) const - { - return rawBuffer; - }; - /*** - * Resets the internal state of the buffering - */ - virtual void clear(); - - // TODO: There should be a callback / flag set for errors -}; - -class cmConnection -{ -public: - cmConnection() = default; - - cmConnection(cmConnection const&) = delete; - cmConnection& operator=(cmConnection const&) = delete; - - virtual void WriteData(const std::string& data) = 0; - - virtual ~cmConnection(); - - virtual bool OnConnectionShuttingDown(); - - virtual bool IsOpen() const = 0; - - virtual void SetServer(cmServerBase* s); - - virtual void ProcessRequest(const std::string& request); - - virtual bool OnServeStart(std::string* pString); - -protected: - cmServerBase* Server = nullptr; -}; - -/*** - * Abstraction of a connection; ties in event callbacks from libuv and notifies - * the server when appropriate - */ -class cmEventBasedConnection : public cmConnection -{ - -public: - /*** - * @param bufferStrategy If no strategy is given, it will process the raw - * chunks as they come in. The connection - * owns the pointer given. - */ - cmEventBasedConnection(cmConnectionBufferStrategy* bufferStrategy = nullptr); - - virtual void Connect(uv_stream_t* server); - - virtual void ReadData(const std::string& data); - - bool IsOpen() const override; - - void WriteData(const std::string& data) override; - bool OnConnectionShuttingDown() override; - - virtual void OnDisconnect(int errorCode); - - static void on_close(uv_handle_t* handle); - - template <typename T> - static void on_close_delete(uv_handle_t* handle) - { - delete reinterpret_cast<T*>(handle); - } - -protected: - cm::uv_stream_ptr WriteStream; - - std::string RawReadBuffer; - - std::unique_ptr<cmConnectionBufferStrategy> BufferStrategy; - - static void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); - - static void on_write(uv_write_t* req, int status); - - static void on_new_connection(uv_stream_t* stream, int status); - - static void on_alloc_buffer(uv_handle_t* handle, size_t suggested_size, - uv_buf_t* buf); -}; diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 9c4deea..9d492ba 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -127,7 +127,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args, mf.AddDefinition("CMAKE_FORWARD_DECLARE_TESTS", forwardDeclareCode); mf.AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", functionMapCode); bool res = true; - if (!mf.ConfigureFile(configFile, driver, false, true, false, true)) { + if (!mf.ConfigureFile(configFile, driver, false, true, false)) { res = false; } diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 60504ba..08a0574 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -6,18 +6,22 @@ #include <memory> #include <utility> +#include <cm/optional> #include <cmext/algorithm> +#include "cmCryptoHash.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmTransformDepfile.h" namespace { void AppendPaths(const std::vector<std::string>& inputs, @@ -31,8 +35,7 @@ void AppendPaths(const std::vector<std::string>& inputs, for (std::string& it : result) { cmSystemTools::ConvertToUnixSlashes(it); if (cmSystemTools::FileIsFullPath(it)) { - it = cmSystemTools::CollapseFullPath( - it, lg->GetMakefile()->GetHomeOutputDirectory()); + it = cmSystemTools::CollapseFullPath(it); } } cm::append(output, result); @@ -42,8 +45,9 @@ void AppendPaths(const std::vector<std::string>& inputs, cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, - cmLocalGenerator* lg) - : CC(cc) + cmLocalGenerator* lg, + bool transformDepfile) + : CC(&cc) , Config(std::move(config)) , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) @@ -52,34 +56,76 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, { cmGeneratorExpression ge(cc.GetBacktrace()); - const cmCustomCommandLines& cmdlines = this->CC.GetCommandLines(); + const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines(); for (cmCustomCommandLine const& cmdline : cmdlines) { cmCustomCommandLine argv; for (std::string const& clarg : cmdline) { std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(clarg); std::string parsed_arg = cge->Evaluate(this->LG, this->Config); - if (this->CC.GetCommandExpandLists()) { + for (cmGeneratorTarget* gt : cge->GetTargets()) { + this->Utilities.emplace(BT<std::pair<std::string, bool>>( + { gt->GetName(), true }, cge->GetBacktrace())); + } + if (this->CC->GetCommandExpandLists()) { cm::append(argv, cmExpandedList(parsed_arg)); } else { argv.push_back(std::move(parsed_arg)); } } - // Later code assumes at least one entry exists, but expanding - // lists on an empty command may have left this empty. - // FIXME: Should we define behavior for removing empty commands? - if (argv.empty()) { + if (!argv.empty()) { + // If the command references an executable target by name, + // collect the target to add a target-level dependency on it. + cmGeneratorTarget* gt = this->LG->FindGeneratorTargetToUse(argv.front()); + if (gt && gt->GetType() == cmStateEnums::EXECUTABLE) { + this->Utilities.emplace(BT<std::pair<std::string, bool>>( + { gt->GetName(), true }, cc.GetBacktrace())); + } + } else { + // Later code assumes at least one entry exists, but expanding + // lists on an empty command may have left this empty. + // FIXME: Should we define behavior for removing empty commands? argv.emplace_back(); } this->CommandLines.push_back(std::move(argv)); } + if (transformDepfile && !this->CommandLines.empty() && + !cc.GetDepfile().empty() && + this->LG->GetGlobalGenerator()->DepfileFormat()) { + cmCustomCommandLine argv; + argv.push_back(cmSystemTools::GetCMakeCommand()); + argv.emplace_back("-E"); + argv.emplace_back("cmake_transform_depfile"); + switch (*this->LG->GetGlobalGenerator()->DepfileFormat()) { + case cmDepfileFormat::GccDepfile: + argv.emplace_back("gccdepfile"); + break; + case cmDepfileFormat::VsTlog: + argv.emplace_back("vstlog"); + break; + } + if (this->LG->GetCurrentBinaryDirectory() == + this->LG->GetBinaryDirectory()) { + argv.emplace_back("./"); + } else { + argv.push_back(cmStrCat(this->LG->MaybeConvertToRelativePath( + this->LG->GetBinaryDirectory(), + this->LG->GetCurrentBinaryDirectory()), + '/')); + } + argv.push_back(this->GetFullDepfile()); + argv.push_back(this->GetInternalDepfile()); + + this->CommandLines.push_back(std::move(argv)); + } + AppendPaths(cc.GetByproducts(), ge, this->LG, this->Config, this->Byproducts); AppendPaths(cc.GetDepends(), ge, this->LG, this->Config, this->Depends); - const std::string& workingdirectory = this->CC.GetWorkingDirectory(); + const std::string& workingdirectory = this->CC->GetWorkingDirectory(); if (!workingdirectory.empty()) { std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(workingdirectory); @@ -97,7 +143,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const { - return static_cast<unsigned int>(this->CC.GetCommandLines().size()); + return static_cast<unsigned int>(this->CommandLines.size()); } void cmCustomCommandGenerator::FillEmulatorsWithArguments() @@ -234,9 +280,43 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c, } } +std::string cmCustomCommandGenerator::GetFullDepfile() const +{ + std::string depfile = this->CC->GetDepfile(); + if (depfile.empty()) { + return ""; + } + + if (!cmSystemTools::FileIsFullPath(depfile)) { + depfile = cmStrCat(this->LG->GetCurrentBinaryDirectory(), '/', depfile); + } + return cmSystemTools::CollapseFullPath(depfile); +} + +std::string cmCustomCommandGenerator::GetInternalDepfile() const +{ + std::string depfile = this->GetFullDepfile(); + if (depfile.empty()) { + return ""; + } + + cmCryptoHash hash(cmCryptoHash::AlgoSHA256); + std::string extension; + switch (*this->LG->GetGlobalGenerator()->DepfileFormat()) { + case cmDepfileFormat::GccDepfile: + extension = ".d"; + break; + case cmDepfileFormat::VsTlog: + extension = ".tlog"; + break; + } + return cmStrCat(this->LG->GetBinaryDirectory(), "/CMakeFiles/d/", + hash.HashString(depfile), extension); +} + const char* cmCustomCommandGenerator::GetComment() const { - return this->CC.GetComment(); + return this->CC->GetComment(); } std::string cmCustomCommandGenerator::GetWorkingDirectory() const @@ -246,7 +326,7 @@ std::string cmCustomCommandGenerator::GetWorkingDirectory() const std::vector<std::string> const& cmCustomCommandGenerator::GetOutputs() const { - return this->CC.GetOutputs(); + return this->CC->GetOutputs(); } std::vector<std::string> const& cmCustomCommandGenerator::GetByproducts() const @@ -258,3 +338,9 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const { return this->Depends; } + +std::set<BT<std::pair<std::string, bool>>> const& +cmCustomCommandGenerator::GetUtilities() const +{ + return this->Utilities; +} diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 412eba8..cb0d7df 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -4,17 +4,20 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include <set> #include <string> +#include <utility> #include <vector> #include "cmCustomCommandLines.h" +#include "cmListFileCache.h" class cmCustomCommand; class cmLocalGenerator; class cmCustomCommandGenerator { - cmCustomCommand const& CC; + cmCustomCommand const* CC; std::string Config; cmLocalGenerator* LG; bool OldStyle; @@ -24,6 +27,7 @@ class cmCustomCommandGenerator std::vector<std::string> Byproducts; std::vector<std::string> Depends; std::string WorkingDirectory; + std::set<BT<std::pair<std::string, bool>>> Utilities; void FillEmulatorsWithArguments(); std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const; @@ -31,11 +35,13 @@ class cmCustomCommandGenerator public: cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, - cmLocalGenerator* lg); + cmLocalGenerator* lg, bool transformDepfile = true); cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete; + cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default; cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) = delete; - cmCustomCommand const& GetCC() const { return this->CC; } + cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default; + cmCustomCommand const& GetCC() const { return *(this->CC); } unsigned int GetNumberOfCommands() const; std::string GetCommand(unsigned int c) const; void AppendArguments(unsigned int c, std::string& cmd) const; @@ -44,5 +50,8 @@ public: std::vector<std::string> const& GetOutputs() const; std::vector<std::string> const& GetByproducts() const; std::vector<std::string> const& GetDepends() const; + std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const; bool HasOnlyEmptyCommandLines() const; + std::string GetFullDepfile() const; + std::string GetInternalDepfile() const; }; diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx new file mode 100644 index 0000000..0f695c8 --- /dev/null +++ b/Source/cmDependsCompiler.cxx @@ -0,0 +1,278 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmDependsCompiler.h" + +#include <algorithm> +#include <map> +#include <string> +#include <unordered_set> +#include <utility> + +#include <cm/string_view> +#include <cm/vector> +#include <cmext/string_view> + +#include "cmsys/FStream.hxx" + +#include "cmFileTime.h" +#include "cmGlobalUnixMakefileGenerator3.h" +#include "cmLocalUnixMakefileGenerator3.h" +#include "cmStringAlgorithms.h" +#include "cmSystemTools.h" + +namespace { +std::string& ReplaceAll(std::string& data, const std::string& toSearch, + const std::string& replaceStr) +{ + // Get the first occurrence + auto pos = data.find(toSearch); + // Repeat until the end is reached + while (pos != std::string::npos) { + // Replace this occurrence of Sub String + data.replace(pos, toSearch.size(), replaceStr); + // Get the next occurrence from the current position + pos = data.find(toSearch, pos + replaceStr.size()); + } + + return data; +} + +std::string& NormalizePath(std::string& item) +{ + ReplaceAll(item, "$$", "$"); + ReplaceAll(item, "\\ ", " "); + ReplaceAll(item, "\\#", "#"); + ReplaceAll(item, "\\", "/"); + + return item; +} + +void ParseLine(const std::string& line, std::vector<std::string>& depends) +{ + auto start = line.find_first_not_of(' '); + if (start == std::string::npos || line[start] == '#') { + return; + } + + auto index = start; + while ((index = line.find(' ', index)) != std::string::npos) { + if (line[index - 1] == '\\') { + index += 1; + continue; + } + + auto item = line.substr(start, index - start); + if (item.back() != ':') { + // check that ':' is not present after some spaces + auto index2 = line.find_first_not_of(' ', index + 1); + if (index2 == std::string::npos || line[index2] != ':') { + // this is a dependency, add it + depends.emplace_back(std::move(NormalizePath(item))); + } else { + index = index2; + } + } + + start = line.find_first_not_of(' ', index + 1); + index = start; + } + if (start != std::string::npos) { + auto item = line.substr(start); + if (line.back() != ':') { + // this is a dependency, add it + depends.emplace_back(std::move(NormalizePath(item))); + } + } +} +} + +bool cmDependsCompiler::CheckDependencies( + const std::string& internalDepFile, const std::vector<std::string>& depFiles, + cmDepends::DependencyMap& dependencies, + const std::function<bool(const std::string&)>& isValidPath) +{ + bool status = true; + bool forceReadDeps = true; + + cmFileTime internalDepFileTime; + // read cached dependencies stored in internal file + if (cmSystemTools::FileExists(internalDepFile)) { + internalDepFileTime.Load(internalDepFile); + forceReadDeps = false; + + // read current dependencies + cmsys::ifstream fin(internalDepFile.c_str()); + if (fin) { + std::string line; + std::string depender; + std::vector<std::string>* currentDependencies = nullptr; + while (std::getline(fin, line)) { + if (line.empty() || line.front() == '#') { + continue; + } + // Drop carriage return character at the end + if (line.back() == '\r') { + line.pop_back(); + if (line.empty()) { + continue; + } + } + // Check if this a depender line + if (line.front() != ' ') { + depender = std::move(line); + currentDependencies = &dependencies[depender]; + continue; + } + // This is a dependee line + if (currentDependencies != nullptr) { + currentDependencies->emplace_back(line.substr(1)); + } + } + fin.close(); + } + } + + // Now, update dependencies map with all new compiler generated + // dependencies files + cmFileTime depFileTime; + for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) { + const auto& source = *dep++; + const auto& target = *dep++; + const auto& format = *dep++; + const auto& depFile = *dep; + + if (!cmSystemTools::FileExists(depFile)) { + continue; + } + + if (!forceReadDeps) { + depFileTime.Load(depFile); + } + if (forceReadDeps || depFileTime.Newer(internalDepFileTime)) { + status = false; + if (this->Verbose) { + cmSystemTools::Stdout(cmStrCat("Dependencies file \"", depFile, + "\" is newer than depends file \"", + internalDepFile, "\".\n")); + } + cmsys::ifstream fin(depFile.c_str()); + if (!fin) { + continue; + } + + std::vector<std::string> depends; + std::string line; + if (format == "msvc"_s) { + if (!isValidPath) { + // insert source as first dependency + depends.push_back(source); + } + while (cmSystemTools::GetLineFromStream(fin, line)) { + depends.emplace_back(std::move(line)); + } + } else { + while (cmSystemTools::GetLineFromStream(fin, line)) { + if (line.empty()) { + continue; + } + if (line.back() == '\\') { + line.pop_back(); + } + ParseLine(line, depends); + } + + if (depends.empty()) { + // unexpectedly empty, ignore it and continue + continue; + } + + // depending of the effective format of the dependencies file generated + // by the compiler, the target can be wrongly identified as a + // dependency so remove it from the list + if (depends.front() == target) { + depends.erase(depends.begin()); + } + + // ensure source file is the first dependency + if (depends.front() != source) { + cm::erase(depends, source); + if (!isValidPath) { + depends.insert(depends.begin(), source); + } + } else if (isValidPath) { + // remove first dependency because it must not be filtered out + depends.erase(depends.begin()); + } + } + + if (isValidPath) { + cm::erase_if(depends, isValidPath); + // insert source as first dependency + depends.insert(depends.begin(), source); + } + + dependencies[target] = std::move(depends); + } + } + + return status; +} + +void cmDependsCompiler::WriteDependencies( + const cmDepends::DependencyMap& dependencies, std::ostream& makeDepends, + std::ostream& internalDepends) +{ + // dependencies file consumed by make tool + const auto& lineContinue = static_cast<cmGlobalUnixMakefileGenerator3*>( + this->LocalGenerator->GetGlobalGenerator()) + ->LineContinueDirective; + const auto& binDir = this->LocalGenerator->GetBinaryDirectory(); + cmDepends::DependencyMap makeDependencies(dependencies); + std::unordered_set<cm::string_view> phonyTargets; + + // external dependencies file + for (auto& node : makeDependencies) { + auto& deps = node.second; + std::transform( + deps.cbegin(), deps.cend(), deps.begin(), + [this, &binDir](const std::string& dep) { + return LocalGenerator->ConvertToMakefilePath( + this->LocalGenerator->MaybeConvertToRelativePath(binDir, dep)); + }); + + makeDepends << this->LocalGenerator->ConvertToMakefilePath(node.first) + << ": " << deps.front(); + // first dependency is the source, remove it because should not be declared + // as phony target + deps.erase(deps.begin()); + for (const auto& dep : deps) { + makeDepends << ' ' << lineContinue << " " << dep; + phonyTargets.emplace(dep.data(), dep.length()); + } + makeDepends << std::endl << std::endl; + } + + // add phony targets + for (const auto& target : phonyTargets) { + makeDepends << std::endl << target << ':' << std::endl; + } + + // internal dependencies file + for (const auto& node : dependencies) { + internalDepends << node.first << std::endl; + for (const auto& dep : node.second) { + internalDepends << ' ' << dep << std::endl; + } + internalDepends << std::endl; + } +} + +void cmDependsCompiler::ClearDependencies( + const std::vector<std::string>& depFiles) +{ + for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) { + dep += 3; + cmSystemTools::RemoveFile(*dep); + } +} diff --git a/Source/cmDependsCompiler.h b/Source/cmDependsCompiler.h new file mode 100644 index 0000000..838156d --- /dev/null +++ b/Source/cmDependsCompiler.h @@ -0,0 +1,60 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <functional> +#include <iosfwd> +#include <string> +#include <vector> + +#include "cmDepends.h" + +class cmLocalUnixMakefileGenerator3; + +/** \class cmDepends + * \brief Dependencies files manager. + * + * This class is responsible for maintaining a compiler_depends.make file in + * the build tree corresponding to an object file. + */ +class cmDependsCompiler +{ +public: + cmDependsCompiler() = default; + ~cmDependsCompiler() = default; + + /** should this be verbose in its output */ + void SetVerbose(bool verb) { this->Verbose = verb; } + + /** Set the local generator for the directory in which we are + scanning dependencies. This is not a full local generator; it + has been setup to do relative path conversions for the current + directory. */ + void SetLocalGenerator(cmLocalUnixMakefileGenerator3* lg) + { + this->LocalGenerator = lg; + } + + /** Read dependencies for the target file. Return true if + dependencies didn't changed and false if not. + Up-to-date Dependencies will be stored in deps. */ + bool CheckDependencies( + const std::string& internalDepFile, + const std::vector<std::string>& depFiles, + cmDepends::DependencyMap& dependencies, + const std::function<bool(const std::string&)>& isValidPath); + + /** Write dependencies for the target file. */ + void WriteDependencies(const cmDepends::DependencyMap& dependencies, + std::ostream& makeDepends, + std::ostream& internalDepends); + + /** Clear dependencies for the target so they will be regenerated. */ + void ClearDependencies(const std::vector<std::string>& depFiles); + +private: + bool Verbose = false; + cmLocalUnixMakefileGenerator3* LocalGenerator = nullptr; +}; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index cbae4e5..a853bb1 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -924,13 +924,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) // Isolate the file policy level. // Support CMake versions as far back as 2.6 but also support using NEW - // policy settings for up to CMake 3.17 (this upper limit may be reviewed + // policy settings for up to CMake 3.18 (this upper limit may be reviewed // and increased from time to time). This reduces the opportunity for CMake // warnings when an older export file is later used with newer CMake // versions. /* clang-format off */ os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.6...3.17)\n"; + << "cmake_policy(VERSION 2.6...3.18)\n"; /* clang-format on */ } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 7c36144..249dfaf 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -349,6 +349,11 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( if (language.empty()) { language = "C"; } + + // Explicitly add the explicit language flag before any other flag + // so user flags can override it. + gtgt->AddExplicitLanguageFlags(flags, *source); + std::string const& config = lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8a3aad2..cd440ad 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -15,6 +15,7 @@ #include <vector> #include <cm/memory> +#include <cm/string_view> #include <cmext/algorithm> #include <cmext/string_view> @@ -2314,49 +2315,92 @@ bool HandleGenerateCommand(std::vector<std::string> const& args, status.SetError("Incorrect arguments to GENERATE subcommand."); return false; } - if (args[1] != "OUTPUT") { + + struct Arguments + { + std::string Output; + std::string Input; + std::string Content; + std::string Condition; + std::string Target; + }; + + static auto const parser = cmArgumentParser<Arguments>{} + .Bind("OUTPUT"_s, &Arguments::Output) + .Bind("INPUT"_s, &Arguments::Input) + .Bind("CONTENT"_s, &Arguments::Content) + .Bind("CONDITION"_s, &Arguments::Condition) + .Bind("TARGET"_s, &Arguments::Target); + + std::vector<std::string> unparsedArguments; + std::vector<std::string> keywordsMissingValues; + std::vector<std::string> parsedKeywords; + Arguments const arguments = + parser.Parse(cmMakeRange(args).advance(1), &unparsedArguments, + &keywordsMissingValues, &parsedKeywords); + + if (!keywordsMissingValues.empty()) { status.SetError("Incorrect arguments to GENERATE subcommand."); return false; } - std::string condition; - std::string target; - - for (std::size_t i = 5; i < args.size();) { - const std::string& arg = args[i++]; + if (!unparsedArguments.empty()) { + status.SetError("Unknown argument to GENERATE subcommand."); + return false; + } - if (args.size() - i == 0) { - status.SetError("Incorrect arguments to GENERATE subcommand."); - return false; + bool mandatoryOptionsSpecified = false; + if (parsedKeywords.size() > 1) { + const bool outputOprionSpecified = parsedKeywords[0] == "OUTPUT"_s; + const bool inputOrContentSpecified = + parsedKeywords[1] == "INPUT"_s || parsedKeywords[1] == "CONTENT"_s; + if (outputOprionSpecified && inputOrContentSpecified) { + mandatoryOptionsSpecified = true; } + } + if (!mandatoryOptionsSpecified) { + status.SetError("Incorrect arguments to GENERATE subcommand."); + return false; + } - const std::string& value = args[i++]; - - if (value.empty()) { - status.SetError( - arg + " of sub-command GENERATE must not be empty if specified."); - return false; - } + const bool conditionOptionSpecified = + std::find(parsedKeywords.begin(), parsedKeywords.end(), "CONDITION"_s) != + parsedKeywords.end(); + if (conditionOptionSpecified && arguments.Condition.empty()) { + status.SetError("CONDITION of sub-command GENERATE must not be empty " + "if specified."); + return false; + } - if (arg == "CONDITION") { - condition = value; - } else if (arg == "TARGET") { - target = value; - } else { - status.SetError("Unknown argument to GENERATE subcommand."); - return false; - } + const bool targetOptionSpecified = + std::find(parsedKeywords.begin(), parsedKeywords.end(), "TARGET"_s) != + parsedKeywords.end(); + if (targetOptionSpecified && arguments.Target.empty()) { + status.SetError("TARGET of sub-command GENERATE must not be empty " + "if specified."); + return false; } - std::string output = args[2]; - const bool inputIsContent = args[3] != "INPUT"; - if (inputIsContent && args[3] != "CONTENT") { + const bool outputOptionSpecified = + std::find(parsedKeywords.begin(), parsedKeywords.end(), "OUTPUT"_s) != + parsedKeywords.end(); + if (outputOptionSpecified && parsedKeywords[0] != "OUTPUT"_s) { status.SetError("Incorrect arguments to GENERATE subcommand."); return false; } - std::string input = args[4]; - AddEvaluationFile(input, target, output, condition, inputIsContent, status); + const bool inputIsContent = parsedKeywords[1] != "INPUT"_s; + if (inputIsContent && parsedKeywords[1] != "CONTENT") { + status.SetError("Unknown argument to GENERATE subcommand."); + } + + std::string input = arguments.Input; + if (inputIsContent) { + input = arguments.Content; + } + + AddEvaluationFile(input, arguments.Target, arguments.Output, + arguments.Condition, inputIsContent, status); return true; } diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx deleted file mode 100644 index 8cfdb2d..0000000 --- a/Source/cmFileMonitor.cxx +++ /dev/null @@ -1,383 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmFileMonitor.h" - -#include <cassert> -#include <cstddef> -#include <unordered_map> -#include <utility> - -#include <cm/memory> - -#include "cmsys/SystemTools.hxx" - -namespace { -void on_directory_change(uv_fs_event_t* handle, const char* filename, - int events, int status); -void on_fs_close(uv_handle_t* handle); -} // namespace - -class cmIBaseWatcher -{ -public: - virtual ~cmIBaseWatcher() = default; - - virtual void Trigger(const std::string& pathSegment, int events, - int status) const = 0; - virtual std::string Path() const = 0; - virtual uv_loop_t* Loop() const = 0; - - virtual void StartWatching() = 0; - virtual void StopWatching() = 0; - - virtual std::vector<std::string> WatchedFiles() const = 0; - virtual std::vector<std::string> WatchedDirectories() const = 0; -}; - -class cmVirtualDirectoryWatcher : public cmIBaseWatcher -{ -public: - ~cmVirtualDirectoryWatcher() override = default; - - cmIBaseWatcher* Find(const std::string& ps) - { - const auto i = this->Children.find(ps); - return (i == this->Children.end()) ? nullptr : i->second.get(); - } - - void Trigger(const std::string& pathSegment, int events, - int status) const final - { - if (pathSegment.empty()) { - for (auto const& child : this->Children) { - child.second->Trigger(std::string(), events, status); - } - } else { - const auto i = this->Children.find(pathSegment); - if (i != this->Children.end()) { - i->second->Trigger(std::string(), events, status); - } - } - } - - void StartWatching() override - { - for (auto const& child : this->Children) { - child.second->StartWatching(); - } - } - - void StopWatching() override - { - for (auto const& child : this->Children) { - child.second->StopWatching(); - } - } - - std::vector<std::string> WatchedFiles() const final - { - std::vector<std::string> result; - for (auto const& child : this->Children) { - for (std::string const& f : child.second->WatchedFiles()) { - result.push_back(f); - } - } - return result; - } - - std::vector<std::string> WatchedDirectories() const override - { - std::vector<std::string> result; - for (auto const& child : this->Children) { - for (std::string const& dir : child.second->WatchedDirectories()) { - result.push_back(dir); - } - } - return result; - } - - void Reset() { this->Children.clear(); } - - void AddChildWatcher(const std::string& ps, cmIBaseWatcher* watcher) - { - assert(!ps.empty()); - assert(this->Children.find(ps) == this->Children.end()); - assert(watcher); - - this->Children.emplace(ps, std::unique_ptr<cmIBaseWatcher>(watcher)); - } - -private: - std::unordered_map<std::string, std::unique_ptr<cmIBaseWatcher>> - Children; // owned! -}; - -// Root of all the different (on windows!) root directories: -class cmRootWatcher : public cmVirtualDirectoryWatcher -{ -public: - cmRootWatcher(uv_loop_t* loop) - : mLoop(loop) - { - assert(loop); - } - - std::string Path() const final - { - assert(false); - return std::string(); - } - uv_loop_t* Loop() const final { return this->mLoop; } - -private: - uv_loop_t* const mLoop; // no ownership! -}; - -// Real directories: -class cmRealDirectoryWatcher : public cmVirtualDirectoryWatcher -{ -public: - cmRealDirectoryWatcher(cmVirtualDirectoryWatcher* p, const std::string& ps) - : Parent(p) - , PathSegment(ps) - { - assert(p); - assert(!ps.empty()); - - p->AddChildWatcher(ps, this); - } - - void StartWatching() final - { - if (!this->Handle) { - this->Handle = new uv_fs_event_t; - - uv_fs_event_init(this->Loop(), this->Handle); - this->Handle->data = this; - uv_fs_event_start(this->Handle, &on_directory_change, Path().c_str(), 0); - } - cmVirtualDirectoryWatcher::StartWatching(); - } - - void StopWatching() final - { - if (this->Handle) { - uv_fs_event_stop(this->Handle); - if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(this->Handle))) { - uv_close(reinterpret_cast<uv_handle_t*>(this->Handle), &on_fs_close); - } - this->Handle = nullptr; - } - cmVirtualDirectoryWatcher::StopWatching(); - } - - uv_loop_t* Loop() const final { return this->Parent->Loop(); } - - std::vector<std::string> WatchedDirectories() const override - { - std::vector<std::string> result = { Path() }; - for (std::string const& dir : - cmVirtualDirectoryWatcher::WatchedDirectories()) { - result.push_back(dir); - } - return result; - } - -protected: - cmVirtualDirectoryWatcher* const Parent; - const std::string PathSegment; - -private: - uv_fs_event_t* Handle = nullptr; // owner! -}; - -// Root directories: -class cmRootDirectoryWatcher : public cmRealDirectoryWatcher -{ -public: - cmRootDirectoryWatcher(cmRootWatcher* p, const std::string& ps) - : cmRealDirectoryWatcher(p, ps) - { - } - - std::string Path() const final { return this->PathSegment; } -}; - -// Normal directories below root: -class cmDirectoryWatcher : public cmRealDirectoryWatcher -{ -public: - cmDirectoryWatcher(cmRealDirectoryWatcher* p, const std::string& ps) - : cmRealDirectoryWatcher(p, ps) - { - } - - std::string Path() const final - { - return this->Parent->Path() + this->PathSegment + "/"; - } -}; - -class cmFileWatcher : public cmIBaseWatcher -{ -public: - cmFileWatcher(cmRealDirectoryWatcher* p, const std::string& ps, - cmFileMonitor::Callback cb) - : Parent(p) - , PathSegment(ps) - , CbList({ std::move(cb) }) - { - assert(p); - assert(!ps.empty()); - p->AddChildWatcher(ps, this); - } - - void StartWatching() final {} - - void StopWatching() final {} - - void AppendCallback(cmFileMonitor::Callback const& cb) - { - this->CbList.push_back(cb); - } - - std::string Path() const final - { - return this->Parent->Path() + this->PathSegment; - } - - std::vector<std::string> WatchedDirectories() const final { return {}; } - - std::vector<std::string> WatchedFiles() const final - { - return { this->Path() }; - } - - void Trigger(const std::string& ps, int events, int status) const final - { - assert(ps.empty()); - assert(status == 0); - static_cast<void>(ps); - - const std::string path = this->Path(); - for (cmFileMonitor::Callback const& cb : this->CbList) { - cb(path, events, status); - } - } - - uv_loop_t* Loop() const final { return this->Parent->Loop(); } - -private: - cmRealDirectoryWatcher* Parent; - const std::string PathSegment; - std::vector<cmFileMonitor::Callback> CbList; -}; - -namespace { - -void on_directory_change(uv_fs_event_t* handle, const char* filename, - int events, int status) -{ - const cmIBaseWatcher* const watcher = - static_cast<const cmIBaseWatcher*>(handle->data); - const std::string pathSegment(filename ? filename : ""); - watcher->Trigger(pathSegment, events, status); -} - -void on_fs_close(uv_handle_t* handle) -{ - delete reinterpret_cast<uv_fs_event_t*>(handle); -} - -} // namespace - -cmFileMonitor::cmFileMonitor(uv_loop_t* l) - : Root(cm::make_unique<cmRootWatcher>(l)) -{ -} - -cmFileMonitor::~cmFileMonitor() = default; - -void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, - Callback const& cb) -{ - for (std::string const& p : paths) { - std::vector<std::string> pathSegments; - cmsys::SystemTools::SplitPath(p, pathSegments, true); - const bool pathIsFile = !cmsys::SystemTools::FileIsDirectory(p); - - const size_t segmentCount = pathSegments.size(); - if (segmentCount < 2) { // Expect at least rootdir and filename - continue; - } - cmVirtualDirectoryWatcher* currentWatcher = this->Root.get(); - for (size_t i = 0; i < segmentCount; ++i) { - assert(currentWatcher); - - const bool fileSegment = (i == segmentCount - 1 && pathIsFile); - const bool rootSegment = (i == 0); - assert( - !(fileSegment && - rootSegment)); // Can not be both filename and root part of the path! - - const std::string& currentSegment = pathSegments[i]; - if (currentSegment.empty()) { - continue; - } - - cmIBaseWatcher* nextWatcher = currentWatcher->Find(currentSegment); - if (!nextWatcher) { - if (rootSegment) { // Root part - assert(currentWatcher == this->Root.get()); - nextWatcher = - new cmRootDirectoryWatcher(this->Root.get(), currentSegment); - assert(currentWatcher->Find(currentSegment) == nextWatcher); - } else if (fileSegment) { // File part - assert(currentWatcher != this->Root.get()); - nextWatcher = new cmFileWatcher( - dynamic_cast<cmRealDirectoryWatcher*>(currentWatcher), - currentSegment, cb); - assert(currentWatcher->Find(currentSegment) == nextWatcher); - } else { // Any normal directory in between - nextWatcher = new cmDirectoryWatcher( - dynamic_cast<cmRealDirectoryWatcher*>(currentWatcher), - currentSegment); - assert(currentWatcher->Find(currentSegment) == nextWatcher); - } - } else { - if (fileSegment) { - auto filePtr = dynamic_cast<cmFileWatcher*>(nextWatcher); - assert(filePtr); - filePtr->AppendCallback(cb); - continue; - } - } - currentWatcher = dynamic_cast<cmVirtualDirectoryWatcher*>(nextWatcher); - } - } - this->Root->StartWatching(); -} - -void cmFileMonitor::StopMonitoring() -{ - this->Root->StopWatching(); - this->Root->Reset(); -} - -std::vector<std::string> cmFileMonitor::WatchedFiles() const -{ - std::vector<std::string> result; - if (this->Root) { - result = this->Root->WatchedFiles(); - } - return result; -} - -std::vector<std::string> cmFileMonitor::WatchedDirectories() const -{ - std::vector<std::string> result; - if (this->Root) { - result = this->Root->WatchedDirectories(); - } - return result; -} diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h deleted file mode 100644 index fc75b0c..0000000 --- a/Source/cmFileMonitor.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <functional> -#include <memory> -#include <string> -#include <vector> - -#include <cm3p/uv.h> - -class cmRootWatcher; - -class cmFileMonitor -{ - -public: - cmFileMonitor(uv_loop_t* l); - ~cmFileMonitor(); - - cmFileMonitor(cmFileMonitor const&) = delete; - cmFileMonitor& operator=(cmFileMonitor const&) = delete; - - using Callback = std::function<void(const std::string&, int, int)>; - void MonitorPaths(const std::vector<std::string>& paths, Callback const& cb); - void StopMonitoring(); - - std::vector<std::string> WatchedFiles() const; - std::vector<std::string> WatchedDirectories() const; - -private: - std::unique_ptr<cmRootWatcher> Root; -}; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index dee91d7..7952336 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -182,7 +182,7 @@ void cmFindCommon::SelectDefaultSearchModes() { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" } } }; - for (auto& path : search_paths) { + for (auto const& path : search_paths) { cmProp def = this->Makefile->GetDefinition(path.second); if (def) { path.first = !cmIsOn(*def); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 71c82d6..1359009 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -163,8 +163,11 @@ bool cmFunctionFunctionBlocker::Replay( f.FilePath = this->GetStartingContext().FilePath; f.Line = this->GetStartingContext().Line; mf.RecordPolicies(f.Policies); - mf.GetState()->AddScriptedCommand(this->Args.front(), std::move(f)); - return true; + return mf.GetState()->AddScriptedCommand( + this->Args.front(), + BT<cmState::Command>(std::move(f), + mf.GetBacktrace().Push(this->GetStartingContext())), + mf); } } // anonymous namespace diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx index 957896f..c782bcd 100644 --- a/Source/cmGccDepfileLexerHelper.cxx +++ b/Source/cmGccDepfileLexerHelper.cxx @@ -27,23 +27,30 @@ bool cmGccDepfileLexerHelper::readFile(const char* filePath) if (!file) { return false; } - newEntry(); + this->newEntry(); yyscan_t scanner; cmGccDepfile_yylex_init(&scanner); cmGccDepfile_yyset_extra(this, scanner); cmGccDepfile_yyrestart(file, scanner); cmGccDepfile_yylex(scanner); cmGccDepfile_yylex_destroy(scanner); - sanitizeContent(); + this->sanitizeContent(); fclose(file); - return true; + return this->HelperState != State::Failed; } void cmGccDepfileLexerHelper::newEntry() { + if (this->HelperState == State::Rule && !this->Content.empty()) { + if (!this->Content.back().rules.empty() && + !this->Content.back().rules.back().empty()) { + this->HelperState = State::Failed; + } + return; + } this->HelperState = State::Rule; this->Content.emplace_back(); - newRule(); + this->newRule(); } void cmGccDepfileLexerHelper::newRule() @@ -56,20 +63,22 @@ void cmGccDepfileLexerHelper::newRule() void cmGccDepfileLexerHelper::newDependency() { - // printf("NEW DEP\n"); + if (this->HelperState == State::Failed) { + return; + } this->HelperState = State::Dependency; - if (this->Content.back().paths.empty() || - !this->Content.back().paths.back().empty()) { - this->Content.back().paths.emplace_back(); + auto& entry = this->Content.back(); + if (entry.paths.empty() || !entry.paths.back().empty()) { + entry.paths.emplace_back(); } } void cmGccDepfileLexerHelper::newRuleOrDependency() { if (this->HelperState == State::Rule) { - newRule(); - } else { - newDependency(); + this->newRule(); + } else if (this->HelperState == State::Dependency) { + this->newDependency(); } } @@ -93,6 +102,8 @@ void cmGccDepfileLexerHelper::addToCurrentPath(const char* s) } dst = &dep->paths.back(); } break; + case State::Failed: + return; } dst->append(s); } diff --git a/Source/cmGccDepfileLexerHelper.h b/Source/cmGccDepfileLexerHelper.h index 07ca61d..91132f5 100644 --- a/Source/cmGccDepfileLexerHelper.h +++ b/Source/cmGccDepfileLexerHelper.h @@ -29,7 +29,8 @@ private: enum class State { Rule, - Dependency + Dependency, + Failed, }; State HelperState = State::Rule; }; diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx index 9d70ede..eb3511a 100644 --- a/Source/cmGccDepfileReader.cxx +++ b/Source/cmGccDepfileReader.cxx @@ -5,14 +5,15 @@ #include <type_traits> #include <utility> +#include <cm/optional> + #include "cmGccDepfileLexerHelper.h" -cmGccDepfileContent cmReadGccDepfile(const char* filePath) +cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath) { - cmGccDepfileContent result; cmGccDepfileLexerHelper helper; if (helper.readFile(filePath)) { - result = std::move(helper).extractContent(); + return cm::make_optional(std::move(helper).extractContent()); } - return result; + return cm::nullopt; } diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h index 395dd77..59ed7fd 100644 --- a/Source/cmGccDepfileReader.h +++ b/Source/cmGccDepfileReader.h @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once +#include <cm/optional> + #include "cmGccDepfileReaderTypes.h" -cmGccDepfileContent cmReadGccDepfile(const char* filePath); +cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath); diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 9e5023d..3c17b54 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -15,7 +15,6 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmSourceFile.h" -#include "cmSourceFileLocationKind.h" #include "cmSystemTools.h" cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( @@ -99,11 +98,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( for (std::string const& le : enabledLanguages) { std::string const name = this->GetOutputFileName(lg, target, config, le); - cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource( - name, false, cmSourceFileLocationKind::Known); - // Tell TraceDependencies that the file is not expected to exist - // on disk yet. We generate it after that runs. - sf->SetProperty("GENERATED", "1"); + cmSourceFile* sf = lg->GetMakefile()->GetOrCreateGeneratedSource(name); // Tell the build system generators that there is no build rule // to generate the file. diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 3e7737e..af2afd6 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -60,7 +60,7 @@ struct TextContent : public cmGeneratorExpressionEvaluator void Extend(size_t length) { this->Length += length; } - size_t GetLength() { return this->Length; } + size_t GetLength() const { return this->Length; } private: const char* Content; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 4ca7405..e40316e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -677,7 +677,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode } static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - for (auto& param : parameters) { + for (auto const& param : parameters) { if (!compilerIdValidator.find(param)) { reportError(context, content->GetOriginalExpression(), @@ -805,7 +805,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - for (auto& param : parameters) { + for (auto const& param : parameters) { if (param == platformId) { return "1"; } @@ -901,7 +901,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return std::string(); } context->HadContextSensitiveCondition = true; - for (auto& param : parameters) { + for (auto const& param : parameters) { if (context->Config.empty()) { if (param.empty()) { return "1"; @@ -927,7 +927,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode if (cmProp mapValue = context->CurrentTarget->GetProperty(mapProp)) { cmExpandList(cmSystemTools::UpperCase(*mapValue), mappedConfigs); - for (auto& param : parameters) { + for (auto const& param : parameters) { if (cm::contains(mappedConfigs, cmSystemTools::UpperCase(param))) { return "1"; } @@ -995,7 +995,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode return context->Language; } - for (auto& param : parameters) { + for (auto const& param : parameters) { if (context->Language == param) { return "1"; } @@ -1101,7 +1101,7 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode return context->Language; } - for (auto& param : parameters) { + for (auto const& param : parameters) { if (context->Language == param) { return "1"; } @@ -1129,7 +1129,7 @@ struct LinkerId } static cmsys::RegularExpression linkerIdValidator("^[A-Za-z0-9_]*$"); - for (auto& param : parameters) { + for (auto const& param : parameters) { if (!linkerIdValidator.find(param)) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c299dad..b444edd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -24,9 +24,7 @@ #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" -#include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" -#include "cmCustomCommandLines.h" #include "cmFileTimes.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" @@ -254,7 +252,7 @@ EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries( { EvaluatedTargetPropertyEntries out; out.Entries.reserve(in.size()); - for (auto& entry : in) { + for (auto const& entry : in) { out.Entries.emplace_back(EvaluateTargetPropertyEntry( thisTarget, config, lang, dagChecker, *entry)); } @@ -332,7 +330,7 @@ cmGeneratorTarget::~cmGeneratorTarget() = default; const std::string& cmGeneratorTarget::GetSourcesProperty() const { std::vector<std::string> values; - for (auto& se : this->SourceEntries) { + for (auto const& se : this->SourceEntries) { values.push_back(se->GetInput()); } static std::string value; @@ -992,9 +990,8 @@ cmProp cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const bool cmGeneratorTarget::GetLanguageStandardRequired( std::string const& lang) const { - cmProp p = - this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED"); - return cmIsOn(p); + return cmIsOn( + this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED")); } void cmGeneratorTarget::GetModuleDefinitionSources( @@ -1539,10 +1536,14 @@ bool processSources(cmGeneratorTarget const* tgt, for (std::string& src : entry.Values) { cmSourceFile* sf = mf->GetOrCreateSource(src); std::string e; - std::string fullPath = sf->ResolveFullPath(&e); + std::string w; + std::string fullPath = sf->ResolveFullPath(&e, &w); + cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance(); + if (!w.empty()) { + cm->IssueMessage(MessageType::AUTHOR_WARNING, w, tgt->GetBacktrace()); + } if (fullPath.empty()) { if (!e.empty()) { - cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance(); cm->IssueMessage(MessageType::FATAL_ERROR, e, tgt->GetBacktrace()); } return contextDependent; @@ -2500,7 +2501,7 @@ public: } } - bool GetHadLinkLanguageSensitiveCondition() + bool GetHadLinkLanguageSensitiveCondition() const { return HadLinkLanguageSensitiveCondition; } @@ -2888,9 +2889,6 @@ private: bool IsUtility(std::string const& dep); void CheckCustomCommand(cmCustomCommand const& cc); void CheckCustomCommands(const std::vector<cmCustomCommand>& commands); - void FollowCommandDepends(cmCustomCommand const& cc, - const std::string& config, - std::set<std::string>& emitted); }; cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) @@ -2986,7 +2984,8 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) auto i = this->NameMap.lower_bound(name); if (i == this->NameMap.end() || i->first != name) { // Check if we know how to generate this file. - cmSourcesWithOutput sources = this->Makefile->GetSourcesWithOutput(name); + cmSourcesWithOutput sources = + this->LocalGenerator->GetSourcesWithOutput(name); // If we failed to find a target or source and we have a relative path, it // might be a valid source if made relative to the current binary // directory. @@ -2996,7 +2995,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', name); fullname = cmSystemTools::CollapseFullPath( fullname, this->Makefile->GetHomeOutputDirectory()); - sources = this->Makefile->GetSourcesWithOutput(fullname); + sources = this->LocalGenerator->GetSourcesWithOutput(fullname); } i = this->NameMap.emplace_hint(i, name, sources); } @@ -3076,71 +3075,27 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) { - // Transform command names that reference targets built in this - // project to corresponding target-level dependencies. - cmGeneratorExpression ge(cc.GetBacktrace()); - - // Add target-level dependencies referenced by generator expressions. - std::set<cmGeneratorTarget*> targets; - - for (cmCustomCommandLine const& cCmdLine : cc.GetCommandLines()) { - std::string const& command = cCmdLine.front(); - // Check for a target with this name. - if (cmGeneratorTarget* t = - this->LocalGenerator->FindGeneratorTargetToUse(command)) { - if (t->GetType() == cmStateEnums::EXECUTABLE) { - // The command refers to an executable target built in - // this project. Add the target-level dependency to make - // sure the executable is up to date before this custom - // command possibly runs. - this->GeneratorTarget->Target->AddUtility(command, true); - } - } + // Collect dependencies referenced by all configurations. + std::set<std::string> depends; + for (std::string const& config : + this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig)) { + cmCustomCommandGenerator ccg(cc, config, this->LocalGenerator); - // Check for target references in generator expressions. - std::vector<std::string> const& configs = - this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); - for (std::string const& c : configs) { - for (std::string const& cl : cCmdLine) { - const std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(cl); - cge->SetQuiet(true); - cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), c); - std::set<cmGeneratorTarget*> geTargets = cge->GetTargets(); - targets.insert(geTargets.begin(), geTargets.end()); - } + // Collect target-level dependencies referenced in command lines. + for (auto const& util : ccg.GetUtilities()) { + this->GeneratorTarget->Target->AddUtility(util); } - } - - for (cmGeneratorTarget* target : targets) { - this->GeneratorTarget->Target->AddUtility(target->GetName(), true); - } - // Queue the custom command dependencies. - std::set<std::string> emitted; - std::vector<std::string> const& configs = - this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); - for (std::string const& conf : configs) { - this->FollowCommandDepends(cc, conf, emitted); + // Collect file-level dependencies referenced in DEPENDS. + depends.insert(ccg.GetDepends().begin(), ccg.GetDepends().end()); } -} - -void cmTargetTraceDependencies::FollowCommandDepends( - cmCustomCommand const& cc, const std::string& config, - std::set<std::string>& emitted) -{ - cmCustomCommandGenerator ccg(cc, config, - this->GeneratorTarget->LocalGenerator); - - const std::vector<std::string>& depends = ccg.GetDepends(); + // Queue file-level dependencies. for (std::string const& dep : depends) { - if (emitted.insert(dep).second) { - if (!this->IsUtility(dep)) { - // The dependency does not name a target and may be a file we - // know how to generate. Queue it. - this->FollowName(dep); - } + if (!this->IsUtility(dep)) { + // The dependency does not name a target and may be a file we + // know how to generate. Queue it. + this->FollowName(dep); } } } @@ -3200,6 +3155,30 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, } } +void cmGeneratorTarget::AddExplicitLanguageFlags(std::string& flags, + cmSourceFile const& sf) const +{ + cmProp lang = sf.GetProperty("LANGUAGE"); + if (!lang) { + return; + } + + switch (this->GetPolicyStatusCMP0119()) { + case cmPolicies::WARN: + case cmPolicies::OLD: + // The OLD behavior is to not add explicit language flags. + return; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + // The NEW behavior is to add explicit language flags. + break; + } + + this->LocalGenerator->AppendFeatureOptions(flags, *lang, + "EXPLICIT_LANGUAGE"); +} + void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const { const std::string& property = this->GetSafeProperty("CUDA_ARCHITECTURES"); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2517b72..cb312ad 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -447,6 +447,9 @@ public: void GetAppleArchs(const std::string& config, std::vector<std::string>& archVec) const; + void AddExplicitLanguageFlags(std::string& flags, + cmSourceFile const& sf) const; + void AddCUDAArchitectureFlags(std::string& flags) const; void AddCUDAToolkitFlags(std::string& flags) const; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index c2098c0..7fbd479 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -50,6 +50,10 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args, return false; } ++i; + if (i == args.end()) { + status.SetError("called with incorrect number of arguments"); + return false; + } } // OK, now we have the directory to process, we just get the requested @@ -67,27 +71,30 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args, return true; } + if (i->empty()) { + status.SetError("given empty string for the property name to get"); + return false; + } + const char* prop = nullptr; - if (!i->empty()) { - if (*i == "DEFINITIONS") { - switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0059)) { - case cmPolicies::WARN: - status.GetMakefile().IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); - CM_FALLTHROUGH; - case cmPolicies::OLD: - StoreResult(status.GetMakefile(), variable, - status.GetMakefile().GetDefineFlagsCMP0059()); - return true; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } + if (*i == "DEFINITIONS") { + switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0059)) { + case cmPolicies::WARN: + status.GetMakefile().IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0059)); + CM_FALLTHROUGH; + case cmPolicies::OLD: + StoreResult(status.GetMakefile(), variable, + status.GetMakefile().GetDefineFlagsCMP0059()); + return true; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; } - prop = cmToCStr(dir->GetProperty(*i)); } + prop = cmToCStr(dir->GetProperty(*i)); StoreResult(status.GetMakefile(), variable, prop); return true; } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 3a5b39d..cb657f9 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -172,7 +172,7 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args, std::vector<cmMakefile*> source_file_directory_makefiles; bool file_scopes_handled = - SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes( + SetPropertyCommand::HandleAndValidateSourceFileDirectoryScopes( status, source_file_directory_option_enabled, source_file_target_option_enabled, source_file_directories, source_file_target_directories, source_file_directory_makefiles); @@ -280,8 +280,9 @@ bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name, // Get the property. cmake* cm = status.GetMakefile().GetCMakeInstance(); - cmProp p = cm->GetState()->GetGlobalProperty(propertyName); - return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p)); + return StoreResult( + infoType, status.GetMakefile(), variable, + cmToCStr(cm->GetState()->GetGlobalProperty(propertyName))); } bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name, @@ -327,8 +328,8 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name, } // Get the property. - cmProp p = mf->GetProperty(propertyName); - return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p)); + return StoreResult(infoType, status.GetMakefile(), variable, + cmToCStr(mf->GetProperty(propertyName))); } bool HandleTargetMode(cmExecutionStatus& status, const std::string& name, @@ -358,15 +359,14 @@ bool HandleTargetMode(cmExecutionStatus& status, const std::string& name, } return StoreResult(infoType, status.GetMakefile(), variable, nullptr); } - cmProp prop_cstr = nullptr; cmListFileBacktrace bt = status.GetMakefile().GetBacktrace(); cmMessenger* messenger = status.GetMakefile().GetMessenger(); - prop_cstr = target->GetComputedProperty(propertyName, messenger, bt); - if (!prop_cstr) { - prop_cstr = target->GetProperty(propertyName); + cmProp prop = target->GetComputedProperty(propertyName, messenger, bt); + if (!prop) { + prop = target->GetProperty(propertyName); } return StoreResult(infoType, status.GetMakefile(), variable, - prop_cstr ? prop_cstr->c_str() : nullptr); + cmToCStr(prop)); } status.SetError(cmStrCat("could not find TARGET ", name, ". Perhaps it has not yet been created.")); @@ -391,7 +391,7 @@ bool HandleSourceMode(cmExecutionStatus& status, const std::string& name, if (cmSourceFile* sf = directory_makefile.GetOrCreateSource(source_file_absolute_path)) { return StoreResult(infoType, status.GetMakefile(), variable, - sf->GetPropertyForUser(propertyName)); + cmToCStr(sf->GetPropertyForUser(propertyName))); } status.SetError( cmStrCat("given SOURCE name that could not be found or created: ", diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 5395bc8..5301b66 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -4,6 +4,7 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmSetPropertyCommand.h" #include "cmSourceFile.h" @@ -34,7 +35,7 @@ bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args, std::vector<cmMakefile*> source_file_directory_makefiles; bool file_scopes_handled = - SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes( + SetPropertyCommand::HandleAndValidateSourceFileDirectoryScopes( status, source_file_directory_option_enabled, source_file_target_option_enabled, source_file_directories, source_file_target_directories, source_file_directory_makefiles); @@ -57,14 +58,14 @@ bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args, } if (sf) { - const char* prop = nullptr; + cmProp prop = nullptr; if (!args[property_arg_index].empty()) { prop = sf->GetPropertyForUser(args[property_arg_index]); } if (prop) { // Set the value on the original Makefile scope, not the scope of the // requested directory. - status.GetMakefile().AddDefinition(var, prop); + status.GetMakefile().AddDefinition(var, *prop); return true; } } diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a8f8f57..aabe43c 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -721,8 +721,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() { - cmProp p = this->GeneratorTarget->GetProperty("ghs_integrity_app"); - if (p) { + if (cmProp p = this->GeneratorTarget->GetProperty("ghs_integrity_app")) { return cmIsOn(*p); } std::vector<cmSourceFile*> sources; @@ -763,9 +762,9 @@ bool cmGhsMultiTargetGenerator::VisitCustomCommand( /* set temporary mark; check if revisit*/ if (temp.insert(si).second) { for (auto& di : si->GetCustomCommand()->GetDepends()) { - cmSourceFile const* sf = this->GeneratorTarget->GetLocalGenerator() - ->GetMakefile() - ->GetSourceFileWithOutput(di); + cmSourceFile const* sf = + this->GeneratorTarget->GetLocalGenerator()->GetSourceFileWithOutput( + di); /* if sf exists then visit */ if (sf && this->VisitCustomCommand(temp, perm, order, sf)) { return true; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fc40d63..63aaf27 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1821,6 +1821,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->RuleHashes.clear(); this->DirectoryContentMap.clear(); this->BinaryDirectories.clear(); + this->GeneratedFiles.clear(); } void cmGlobalGenerator::ComputeTargetObjectDirectory( @@ -2146,6 +2147,16 @@ void cmGlobalGenerator::AddInstallComponent(const std::string& component) } } +void cmGlobalGenerator::MarkAsGeneratedFile(const std::string& filepath) +{ + this->GeneratedFiles.insert(filepath); +} + +bool cmGlobalGenerator::IsGeneratedFile(const std::string& filepath) +{ + return this->GeneratedFiles.find(filepath) != this->GeneratedFiles.end(); +} + void cmGlobalGenerator::EnableInstallTarget() { this->InstallTargetEnabled = true; @@ -2608,7 +2619,7 @@ void cmGlobalGenerator::AddGlobalTarget_Test( } void cmGlobalGenerator::AddGlobalTarget_EditCache( - std::vector<GlobalTargetInfo>& targets) + std::vector<GlobalTargetInfo>& targets) const { const char* editCacheTargetName = this->GetEditCacheTargetName(); if (!editCacheTargetName) { @@ -2642,7 +2653,7 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache( } void cmGlobalGenerator::AddGlobalTarget_RebuildCache( - std::vector<GlobalTargetInfo>& targets) + std::vector<GlobalTargetInfo>& targets) const { const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName(); if (!rebuildCacheTargetName) { @@ -2765,7 +2776,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( } } -std::string cmGlobalGenerator::GetPredefinedTargetsFolder() +std::string cmGlobalGenerator::GetPredefinedTargetsFolder() const { cmProp prop = this->GetCMakeInstance()->GetState()->GetGlobalProperty( "PREDEFINED_TARGETS_FOLDER"); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c106258..69373bd 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -11,9 +11,11 @@ #include <set> #include <string> #include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> +#include <cm/optional> #include <cmext/algorithm> #include "cm_codecvt.hxx" @@ -26,6 +28,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" +#include "cmTransformDepfile.h" #if !defined(CMAKE_BOOTSTRAP) # include <cm3p/json/value.h> @@ -288,6 +291,11 @@ public: void AddInstallComponent(const std::string& component); + /** Mark the (absolute path to a) file as generated. */ + void MarkAsGeneratedFile(const std::string& filepath); + /** Determine if the absolute filepath belongs to a generated file. */ + bool IsGeneratedFile(const std::string& filepath); + const std::set<std::string>* GetInstallComponents() const { return &this->InstallComponents; @@ -452,6 +460,10 @@ public: virtual bool ShouldStripResourcePath(cmMakefile*) const; virtual bool SupportsCustomCommandDepfile() const { return false; } + virtual cm::optional<cmDepfileFormat> DepfileFormat() const + { + return cm::nullopt; + } std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; @@ -568,8 +580,9 @@ protected: void AddGlobalTarget_Package(std::vector<GlobalTargetInfo>& targets); void AddGlobalTarget_PackageSource(std::vector<GlobalTargetInfo>& targets); void AddGlobalTarget_Test(std::vector<GlobalTargetInfo>& targets); - void AddGlobalTarget_EditCache(std::vector<GlobalTargetInfo>& targets); - void AddGlobalTarget_RebuildCache(std::vector<GlobalTargetInfo>& targets); + void AddGlobalTarget_EditCache(std::vector<GlobalTargetInfo>& targets) const; + void AddGlobalTarget_RebuildCache( + std::vector<GlobalTargetInfo>& targets) const; void AddGlobalTarget_Install(std::vector<GlobalTargetInfo>& targets); cmTarget CreateGlobalTarget(GlobalTargetInfo const& gti, cmMakefile* mf); @@ -595,7 +608,7 @@ protected: cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const; - std::string GetPredefinedTargetsFolder(); + std::string GetPredefinedTargetsFolder() const; enum class FindMakeProgramStage { @@ -726,6 +739,8 @@ private: std::map<std::string, std::string> RealPaths; + std::unordered_set<std::string> GeneratedFiles; + #if !defined(CMAKE_BOOTSTRAP) // Pool of file locks cmFileLockPool FileLockPool; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index c08c9cf..33bf830 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -704,7 +704,7 @@ bool cmGlobalGhsMultiGenerator::ComputeTargetBuildOrder( std::set<cmGeneratorTarget const*> temp; std::set<cmGeneratorTarget const*> perm; - for (auto ti : tgt) { + for (auto const ti : tgt) { bool r = VisitTarget(temp, perm, build, ti); if (r) { return r; @@ -726,7 +726,7 @@ bool cmGlobalGhsMultiGenerator::VisitTarget( * in the same order */ OrderedTargetDependSet sortedTargets(this->GetTargetDirectDepends(ti), ""); - for (auto& di : sortedTargets) { + for (auto const& di : sortedTargets) { if (this->VisitTarget(temp, perm, order, di)) { return true; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index d477c7d..4147ba8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -34,6 +34,7 @@ #include "cmOutputConverter.h" #include "cmProperty.h" #include "cmRange.h" +#include "cmScanDepFormat.h" #include "cmState.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" @@ -1068,7 +1069,7 @@ void cmGlobalNinjaGenerator::CloseCompileCommandsStream() } } -void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os) +void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os) const { os << "# CMAKE generated file: DO NOT EDIT!\n" << "# Generated by \"" << this->GetName() << "\"" @@ -1099,7 +1100,7 @@ std::string cmGlobalNinjaGenerator::OrderDependsTargetForTarget( void cmGlobalNinjaGenerator::AppendTargetOutputs( cmGeneratorTarget const* target, cmNinjaDeps& outputs, - const std::string& config, cmNinjaTargetDepends depends) + const std::string& config, cmNinjaTargetDepends depends) const { // for frameworks, we want the real name, not smple name // frameworks always appear versioned, and the build.ninja @@ -2028,6 +2029,8 @@ void cmGlobalNinjaGenerator::StripNinjaOutputPathPrefixAsSuffix( cmStripSuffixIfExists(path, this->OutputPathPrefix); } +#if !defined(CMAKE_BOOTSTRAP) + /* We use the following approach to support Fortran. Each target already @@ -2107,16 +2110,6 @@ Compilation of source files within a target is split into the following steps: (because the latter consumes the module). */ -struct cmSourceInfo -{ - // Set of provided and required modules. - std::set<std::string> Provides; - std::set<std::string> Requires; - - // Set of files included in the translation unit. - std::set<std::string> Includes; -}; - static std::unique_ptr<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( std::string const& arg_tdi, std::string const& arg_pp); @@ -2124,6 +2117,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, std::vector<std::string>::const_iterator argEnd) { std::string arg_tdi; + std::string arg_src; std::string arg_pp; std::string arg_dep; std::string arg_obj; @@ -2132,6 +2126,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, for (std::string const& arg : cmMakeRange(argBeg, argEnd)) { if (cmHasLiteralPrefix(arg, "--tdi=")) { arg_tdi = arg.substr(6); + } else if (cmHasLiteralPrefix(arg, "--src=")) { + arg_src = arg.substr(6); } else if (cmHasLiteralPrefix(arg, "--pp=")) { arg_pp = arg.substr(5); } else if (cmHasLiteralPrefix(arg, "--dep=")) { @@ -2172,6 +2168,9 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, cmSystemTools::Error("-E cmake_ninja_depends requires value for --lang="); return 1; } + if (arg_src.empty()) { + arg_src = cmStrCat("<", arg_obj, " input file>"); + } std::unique_ptr<cmSourceInfo> info; if (arg_lang == "Fortran") { @@ -2188,6 +2187,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, return 1; } + info->PrimaryOutput = arg_obj; + { cmGeneratedFileStream depfile(arg_dep); depfile << cmSystemTools::ConvertToUnixOutputPath(arg_pp) << ":"; @@ -2197,24 +2198,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, depfile << "\n"; } - Json::Value ddi(Json::objectValue); - ddi["object"] = arg_obj; - - Json::Value& ddi_provides = ddi["provides"] = Json::arrayValue; - for (std::string const& provide : info->Provides) { - ddi_provides.append(provide); - } - Json::Value& ddi_requires = ddi["requires"] = Json::arrayValue; - for (std::string const& r : info->Requires) { - // Require modules not provided in the same source. - if (!info->Provides.count(r)) { - ddi_requires.append(r); - } - } - - cmGeneratedFileStream ddif(arg_ddi); - ddif << ddi; - if (!ddif) { + if (!cmScanDepFormat_P1689_Write(arg_ddi, arg_src, *info)) { cmSystemTools::Error( cmStrCat("-E cmake_ninja_depends failed to write ", arg_ddi)); return 1; @@ -2272,19 +2256,28 @@ std::unique_ptr<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( } auto info = cm::make_unique<cmSourceInfo>(); - info->Provides = finfo.Provides; - info->Requires = finfo.Requires; - info->Includes = finfo.Includes; + for (std::string const& provide : finfo.Provides) { + cmSourceReqInfo src_info; + src_info.LogicalName = provide; + src_info.CompiledModulePath = provide; + info->Provides.emplace_back(src_info); + } + for (std::string const& require : finfo.Requires) { + // Require modules not provided in the same source. + if (finfo.Provides.count(require)) { + continue; + } + cmSourceReqInfo src_info; + src_info.LogicalName = require; + src_info.CompiledModulePath = require; + info->Requires.emplace_back(src_info); + } + for (std::string const& include : finfo.Includes) { + info->Includes.push_back(include); + } return info; } -struct cmDyndepObjectInfo -{ - std::string Object; - std::vector<std::string> Provides; - std::vector<std::string> Requires; -}; - bool cmGlobalNinjaGenerator::WriteDyndepFile( std::string const& dir_top_src, std::string const& dir_top_bld, std::string const& dir_cur_src, std::string const& dir_cur_bld, @@ -2306,34 +2299,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( this->LocalGenerators.push_back(std::move(lgd)); } - std::vector<cmDyndepObjectInfo> objects; + std::vector<cmSourceInfo> objects; for (std::string const& arg_ddi : arg_ddis) { - // Load the ddi file and compute the module file paths it provides. - Json::Value ddio; - Json::Value const& ddi = ddio; - cmsys::ifstream ddif(arg_ddi.c_str(), std::ios::in | std::ios::binary); - Json::Reader reader; - if (!reader.parse(ddif, ddio, false)) { - cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep failed to parse ", - arg_ddi, - reader.getFormattedErrorMessages())); + cmSourceInfo info; + if (!cmScanDepFormat_P1689_Parse(arg_ddi, &info)) { + cmSystemTools::Error( + cmStrCat("-E cmake_ninja_dyndep failed to parse ddi file ", arg_ddi)); return false; } - - cmDyndepObjectInfo info; - info.Object = ddi["object"].asString(); - Json::Value const& ddi_provides = ddi["provides"]; - if (ddi_provides.isArray()) { - for (auto const& ddi_provide : ddi_provides) { - info.Provides.push_back(ddi_provide.asString()); - } - } - Json::Value const& ddi_requires = ddi["requires"]; - if (ddi_requires.isArray()) { - for (auto const& ddi_require : ddi_requires) { - info.Requires.push_back(ddi_require.asString()); - } - } objects.push_back(std::move(info)); } @@ -2364,11 +2337,12 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( // We do this after loading the modules provided by linked targets // in case we have one of the same name that must be preferred. Json::Value tm = Json::objectValue; - for (cmDyndepObjectInfo const& object : objects) { - for (std::string const& p : object.Provides) { - std::string const mod = cmStrCat(module_dir, p); - mod_files[p] = mod; - tm[p] = mod; + for (cmSourceInfo const& object : objects) { + for (auto const& p : object.Provides) { + std::string const mod = cmStrCat( + module_dir, cmSystemTools::GetFilenameName(p.CompiledModulePath)); + mod_files[p.LogicalName] = mod; + tm[p.LogicalName] = mod; } } @@ -2378,15 +2352,16 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( { cmNinjaBuild build("dyndep"); build.Outputs.emplace_back(""); - for (cmDyndepObjectInfo const& object : objects) { - build.Outputs[0] = object.Object; + for (cmSourceInfo const& object : objects) { + build.Outputs[0] = this->ConvertToNinjaPath(object.PrimaryOutput); build.ImplicitOuts.clear(); - for (std::string const& p : object.Provides) { - build.ImplicitOuts.push_back(this->ConvertToNinjaPath(mod_files[p])); + for (auto const& p : object.Provides) { + build.ImplicitOuts.push_back( + this->ConvertToNinjaPath(mod_files[p.LogicalName])); } build.ImplicitDeps.clear(); - for (std::string const& r : object.Requires) { - auto mit = mod_files.find(r); + for (auto const& r : object.Requires) { + auto mit = mod_files.find(r.LogicalName); if (mit != mod_files.end()) { build.ImplicitDeps.push_back(this->ConvertToNinjaPath(mit->second)); } @@ -2410,11 +2385,6 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( return true; } -bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const -{ - return !this->CrossConfigs.empty(); -} - int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, std::vector<std::string>::const_iterator argEnd) { @@ -2496,6 +2466,13 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, return 0; } +#endif + +bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const +{ + return !this->CrossConfigs.empty(); +} + void cmGlobalNinjaGenerator::AppendDirectoryForConfig( const std::string& prefix, const std::string& config, const std::string& suffix, std::string& dir) @@ -2663,30 +2640,17 @@ void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs( bool cmGlobalNinjaMultiGenerator::InspectConfigTypeVariables() { - this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_BUILD_TYPE"); - this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_CROSS_CONFIGS"); - this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_CONFIGS"); - return this->ReadCacheEntriesForBuild(*this->Makefiles.front()->GetState()); -} - -std::string cmGlobalNinjaMultiGenerator::GetDefaultBuildConfig() const -{ - return ""; -} - -bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( - const cmState& state) -{ std::vector<std::string> configsVec; - cmExpandList(state.GetSafeCacheEntryValue("CMAKE_CONFIGURATION_TYPES"), - configsVec); + cmExpandList( + this->Makefiles.front()->GetSafeDefinition("CMAKE_CONFIGURATION_TYPES"), + configsVec); if (configsVec.empty()) { configsVec.emplace_back(); } std::set<std::string> configs(configsVec.cbegin(), configsVec.cend()); this->DefaultFileConfig = - state.GetSafeCacheEntryValue("CMAKE_DEFAULT_BUILD_TYPE"); + this->Makefiles.front()->GetSafeDefinition("CMAKE_DEFAULT_BUILD_TYPE"); if (this->DefaultFileConfig.empty()) { this->DefaultFileConfig = configsVec.front(); } @@ -2701,8 +2665,9 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( } std::vector<std::string> crossConfigsVec; - cmExpandList(state.GetSafeCacheEntryValue("CMAKE_CROSS_CONFIGS"), - crossConfigsVec); + cmExpandList( + this->Makefiles.front()->GetSafeDefinition("CMAKE_CROSS_CONFIGS"), + crossConfigsVec); auto crossConfigs = ListSubsetWithAll(configs, configs, crossConfigsVec); if (!crossConfigs) { std::ostringstream msg; @@ -2715,7 +2680,7 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( this->CrossConfigs = *crossConfigs; auto defaultConfigsString = - state.GetSafeCacheEntryValue("CMAKE_DEFAULT_CONFIGS"); + this->Makefiles.front()->GetSafeDefinition("CMAKE_DEFAULT_CONFIGS"); if (defaultConfigsString.empty()) { defaultConfigsString = this->DefaultFileConfig; } @@ -2749,6 +2714,11 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( return true; } +std::string cmGlobalNinjaMultiGenerator::GetDefaultBuildConfig() const +{ + return ""; +} + std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget( cmGeneratorTarget const* target, const std::string& config) const { diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3d92ec9..8df0372 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -24,6 +24,7 @@ #include "cmNinjaTypes.h" #include "cmPolicies.h" #include "cmStringAlgorithms.h" +#include "cmTransformDepfile.h" class cmCustomCommand; class cmGeneratorTarget; @@ -31,7 +32,6 @@ class cmLinkLineComputer; class cmLocalGenerator; class cmMakefile; class cmOutputConverter; -class cmState; class cmStateDirectory; class cmake; struct cmDocumentationEntry; @@ -211,6 +211,10 @@ public: const char* GetCleanTargetName() const override { return "clean"; } bool SupportsCustomCommandDepfile() const override { return true; } + cm::optional<cmDepfileFormat> DepfileFormat() const override + { + return cmDepfileFormat::GccDepfile; + } virtual cmGeneratedFileStream* GetImplFileStream( const std::string& /*config*/) const @@ -248,7 +252,7 @@ public: : GG(gg) { } - std::string operator()(std::string const& path) + std::string operator()(std::string const& path) const { return this->GG->ConvertToNinjaPath(path); } @@ -319,7 +323,7 @@ public: void AppendTargetOutputs(cmGeneratorTarget const* target, cmNinjaDeps& outputs, const std::string& config, - cmNinjaTargetDepends depends); + cmNinjaTargetDepends depends) const; void AppendTargetDepends(cmGeneratorTarget const* target, cmNinjaDeps& outputs, const std::string& config, const std::string& fileConfig, @@ -463,7 +467,7 @@ private: void CleanMetaData(); /// Write the common disclaimer text at the top of each build file. - void WriteDisclaimer(std::ostream& os); + void WriteDisclaimer(std::ostream& os) const; void WriteAssumedSourceDependencies(); @@ -653,8 +657,6 @@ public: std::string GetDefaultBuildConfig() const override; - bool ReadCacheEntriesForBuild(const cmState& state) override; - bool SupportsDefaultBuildType() const override { return true; } bool SupportsCrossConfigs() const override { return true; } bool SupportsDefaultConfigs() const override { return true; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 2c934e1..11e2cd6 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -44,6 +44,7 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm) #endif this->IncludeDirective = "include"; + this->LineContinueDirective = "\\\n"; this->DefineWindowsNULL = false; this->PassMakeflags = false; this->UnixCD = true; @@ -589,10 +590,16 @@ cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( } makeCommand.Add(this->SelectMakeProgram(makeProgram)); + // Explicitly tell the make tool to use the Makefile written by + // cmLocalUnixMakefileGenerator3::WriteLocalMakefile + makeCommand.Add("-f"); + makeCommand.Add("Makefile"); + if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.Add("-j"); - if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.Add(std::to_string(jobs)); + if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { + makeCommand.Add("-j"); + } else { + makeCommand.Add("-j" + std::to_string(jobs)); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 77d0827..6459771 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -127,6 +127,12 @@ public: void WriteConvenienceRules(std::ostream& ruleFileStream, std::set<std::string>& emitted); + // Make tool supports dependency files generated by compiler + bool SupportsCompilerDependencies() + { + return this->ToolSupportsCompilerDependencies; + } + /** Get the command to use for a target that has no rule. This is used for multiple output dependencies and for cmake_force. */ std::string GetEmptyRuleHackCommand() { return this->EmptyRuleHackCommand; } @@ -170,6 +176,7 @@ public: void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override; std::string IncludeDirective; + std::string LineContinueDirective; bool DefineWindowsNULL; bool PassMakeflags; bool UnixCD; @@ -218,6 +225,10 @@ protected: bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const override { return true; } + // Specify if the make tool is able to consume dependency files + // generated by the compiler + bool ToolSupportsCompilerDependencies = true; + // Some make programs (Borland) do not keep a rule if there are no // dependencies or commands. This is a problem for creating rules // that might not do anything but might have other dependencies diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 6267205..75cd714 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -380,9 +380,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string project = target->GetName(); std::string location = *expath; - cmProp p = target->GetProperty("VS_PROJECT_TYPE"); - this->WriteExternalProject(fout, project, location, cmToCStr(p), - target->GetUtilities()); + this->WriteExternalProject( + fout, project, location, + cmToCStr(target->GetProperty("VS_PROJECT_TYPE")), + target->GetUtilities()); written = true; } else { cmProp vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index d6a7afa..3e2d92d 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -25,6 +25,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm) #endif cm->GetState()->SetWatcomWMake(true); this->IncludeDirective = "!include"; + this->LineContinueDirective = "&\n"; this->DefineWindowsNULL = true; this->UnixCD = false; this->MakeSilentFlag = "-h"; @@ -37,7 +38,6 @@ void cmGlobalWatcomWMakeGenerator::EnableLanguage( mf->AddDefinition("WATCOM", "1"); mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1"); mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1"); - mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&"); mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC"); mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386"); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7ee94b2..70aa052 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -503,16 +503,15 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( } } - if (this->XcodeBuildSystem >= BuildSystem::Twelve) { + if ((this->XcodeBuildSystem >= BuildSystem::Twelve) || + (jobs != cmake::NO_BUILD_PARALLEL_LEVEL)) { makeCommand.Add("-parallelizeTargets"); } makeCommand.Add("-configuration", (config.empty() ? "Debug" : config)); - if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { - makeCommand.Add("-jobs"); - if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) { - makeCommand.Add(std::to_string(jobs)); - } + if ((jobs != cmake::NO_BUILD_PARALLEL_LEVEL) && + (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL)) { + makeCommand.Add("-jobs", std::to_string(jobs)); } if (this->XcodeVersion >= 70) { @@ -774,7 +773,9 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects() this->TargetGroup.clear(); this->FileRefs.clear(); this->ExternalLibRefs.clear(); + this->EmbeddedLibRefs.clear(); this->FileRefToBuildFileMap.clear(); + this->FileRefToEmbedBuildFileMap.clear(); this->CommandsVisited.clear(); } @@ -937,6 +938,11 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( default: break; } + + // Explicitly add the explicit language flag before any other flag + // so user flags can override it. + gtgt->AddExplicitLanguageFlags(flags, *sf); + const std::string COMPILE_FLAGS("COMPILE_FLAGS"); if (cmProp cflags = sf->GetProperty(COMPILE_FLAGS)) { lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); @@ -1198,7 +1204,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( } } // Make a copy so that we can override it later - std::string path = fullpath; + std::string path = cmSystemTools::CollapseFullPath(fullpath); // Compute the extension without leading '.'. std::string ext = cmSystemTools::GetFilenameLastExtension(path); if (!ext.empty()) { @@ -1643,6 +1649,14 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) } } + // Allow empty source file list for iOS Sticker packs + if (const char* productType = GetTargetProductType(gtgt)) { + if (strcmp(productType, + "com.apple.product-type.app-extension.messages-sticker-pack") == + 0) + return; + } + // Add an empty source file to the target that compiles with the // linker language. This should convince Xcode to choose the proper // language. @@ -1794,6 +1808,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (frameworkBuildPhase) { buildPhases->AddObject(frameworkBuildPhase); } + + // When this build phase is present, it must be last. More build phases may + // be added later for embedding things and they will insert themselves just + // before this last build phase. if (postBuildPhase) { buildPhases->AddObject(postBuildPhase); } @@ -3633,6 +3651,130 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) } } +void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) +{ + cmGeneratorTarget* gt = target->GetTarget(); + if (!gt) { + cmSystemTools::Error("Error no target on xobject\n"); + return; + } + if (!gt->IsInBuildSystem()) { + return; + } + bool isFrameworkTarget = gt->IsFrameworkOnApple(); + bool isBundleTarget = gt->GetPropertyAsBool("MACOSX_BUNDLE"); + bool isCFBundleTarget = gt->IsCFBundleOnApple(); + if (!(isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { + return; + } + cmProp files = gt->GetProperty("XCODE_EMBED_FRAMEWORKS"); + if (!files) { + return; + } + + // Create an "Embedded Frameworks" build phase + auto* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + std::string copyFilesBuildPhaseName = "Embed Frameworks"; + std::string destinationFrameworks = "10"; + copyFilesBuildPhase->SetComment(copyFilesBuildPhaseName); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString(destinationFrameworks)); + copyFilesBuildPhase->AddAttribute( + "name", this->CreateString(copyFilesBuildPhaseName)); + if (cmProp fwEmbedPath = gt->GetProperty("XCODE_EMBED_FRAMEWORKS_PATH")) { + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(*fwEmbedPath)); + } else { + copyFilesBuildPhase->AddAttribute("dstPath", this->CreateString("")); + } + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + // Collect all embedded frameworks and add them to build phase + std::vector<std::string> relFiles = cmExpandedList(*files); + for (std::string const& relFile : relFiles) { + cmXCodeObject* buildFile{ nullptr }; + std::string filePath = relFile; + auto* genTarget = FindGeneratorTarget(relFile); + if (genTarget) { + // This is a target - get it's product path reference + auto* xcTarget = FindXCodeTarget(genTarget); + if (!xcTarget) { + cmSystemTools::Error("Can not find a target for " + + genTarget->GetName()); + continue; + } + // Add the target output file as a build reference for other targets + // to link against + auto* fileRefObject = xcTarget->GetAttribute("productReference"); + if (!fileRefObject) { + cmSystemTools::Error("Target " + genTarget->GetName() + + " is missing product reference"); + continue; + } + auto it = FileRefToEmbedBuildFileMap.find(fileRefObject); + if (it == FileRefToEmbedBuildFileMap.end()) { + buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile); + buildFile->AddAttribute("fileRef", fileRefObject); + FileRefToEmbedBuildFileMap[fileRefObject] = buildFile; + } else { + buildFile = it->second; + } + } else if (cmSystemTools::IsPathToFramework(relFile)) { + // This is a regular string path - create file reference + auto it = EmbeddedLibRefs.find(relFile); + if (it == EmbeddedLibRefs.end()) { + cmXCodeObject* fileRef = + this->CreateXCodeFileReferenceFromPath(relFile, gt, "", nullptr); + if (fileRef) { + buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile); + buildFile->SetComment(fileRef->GetComment()); + buildFile->AddAttribute("fileRef", + this->CreateObjectReference(fileRef)); + } + if (!buildFile) { + cmSystemTools::Error("Can't create build file for " + relFile); + continue; + } + this->EmbeddedLibRefs.emplace(filePath, buildFile); + } else { + buildFile = it->second; + } + } + if (!buildFile) { + cmSystemTools::Error("Can't find a build file for " + relFile); + continue; + } + // Set build file configuration + cmXCodeObject* settings = + this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); + cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); + const auto& rmHeadersProp = + gt->GetSafeProperty("XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY"); + if (cmIsOn(rmHeadersProp)) { + attrs->AddObject(this->CreateString("RemoveHeadersOnCopy")); + } + const auto& codeSignProp = + gt->GetSafeProperty("XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY"); + if (cmIsOn(codeSignProp)) { + attrs->AddObject(this->CreateString("CodeSignOnCopy")); + } + settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs); + buildFile->AddAttributeIfNotEmpty("settings", settings); + if (!buildFiles->HasObject(buildFile)) { + buildFiles->AddObject(buildFile); + } + } + copyFilesBuildPhase->AddAttribute("files", buildFiles); + auto* buildPhases = target->GetAttribute("buildPhases"); + // Insert embed build phase right before the post-build command + buildPhases->InsertObject(buildPhases->GetObjectCount() - 1, + copyFilesBuildPhase); +} + bool cmGlobalXCodeGenerator::CreateGroups( std::vector<cmLocalGenerator*>& generators) { @@ -4011,7 +4153,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( // loop over all targets and add link and depend info for (auto t : targets) { this->AddDependAndLinkInformation(t); + this->AddEmbeddedFrameworks(t); } + if (this->XcodeBuildSystem == BuildSystem::One) { this->CreateXCodeDependHackMakefile(targets); } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ab5eeb2..3cc4efe 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -187,6 +187,7 @@ private: const std::string& configName); cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget* gtgt); void AddDependAndLinkInformation(cmXCodeObject* target); + void AddEmbeddedFrameworks(cmXCodeObject* target); void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target, cmXCodeObject* buildSettings, const std::string& configName); @@ -324,8 +325,10 @@ private: std::map<std::string, cmXCodeObject*> TargetGroup; std::map<std::string, cmXCodeObject*> FileRefs; std::map<std::string, cmXCodeObject*> ExternalLibRefs; + std::map<std::string, cmXCodeObject*> EmbeddedLibRefs; std::map<cmGeneratorTarget const*, cmXCodeObject*> XCodeObjectMap; std::map<cmXCodeObject*, cmXCodeObject*> FileRefToBuildFileMap; + std::map<cmXCodeObject*, cmXCodeObject*> FileRefToEmbedBuildFileMap; std::vector<std::string> Architectures; std::string ObjectDirArchDefault; std::string ObjectDirArch; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index ae801bb..ce1f030 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -21,6 +21,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args, static std::map<std::string, cmPolicies::PolicyID> DeprecatedModules; if (DeprecatedModules.empty()) { DeprecatedModules["Documentation"] = cmPolicies::CMP0106; + DeprecatedModules["WriteCompilerDetectionHeader"] = cmPolicies::CMP0120; } if (args.empty() || args.size() > 4) { @@ -146,11 +147,24 @@ bool cmIncludeCommand(std::vector<std::string> const& args, std::string listFile = cmSystemTools::CollapseFullPath( fname, status.GetMakefile().GetCurrentSourceDirectory()); - if (optional && !cmSystemTools::FileExists(listFile)) { + + const bool fileDoesnotExist = !cmSystemTools::FileExists(listFile); + const bool fileIsDirectory = cmSystemTools::FileIsDirectory(listFile); + if (fileDoesnotExist || fileIsDirectory) { if (!resultVarName.empty()) { status.GetMakefile().AddDefinition(resultVarName, "NOTFOUND"); } - return true; + if (optional) { + return true; + } + if (fileDoesnotExist) { + status.SetError(cmStrCat("could not find requested file:\n ", fname)); + return false; + } + if (fileIsDirectory) { + status.SetError(cmStrCat("requested file is a directory:\n ", fname)); + return false; + } } bool readit = @@ -163,9 +177,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args, } if (!optional && !readit && !cmSystemTools::GetFatalErrorOccured()) { - std::string m = cmStrCat("could not find load file:\n" - " ", - fname); + std::string m = cmStrCat("could not load requested file:\n ", fname); status.SetError(m); return false; } diff --git a/Source/cmJsonObjectDictionary.h b/Source/cmJsonObjectDictionary.h deleted file mode 100644 index 8a2b529..0000000 --- a/Source/cmJsonObjectDictionary.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include <string> - -// Vocabulary: - -static const std::string kARTIFACTS_KEY = "artifacts"; -static const std::string kBUILD_DIRECTORY_KEY = "buildDirectory"; -static const std::string kCOMPILE_FLAGS_KEY = "compileFlags"; -static const std::string kCONFIGURATIONS_KEY = "configurations"; -static const std::string kDEFINES_KEY = "defines"; -static const std::string kFILE_GROUPS_KEY = "fileGroups"; -static const std::string kFRAMEWORK_PATH_KEY = "frameworkPath"; -static const std::string kFULL_NAME_KEY = "fullName"; -static const std::string kINCLUDE_PATH_KEY = "includePath"; -static const std::string kIS_CMAKE_KEY = "isCMake"; -static const std::string kIS_GENERATED_KEY = "isGenerated"; -static const std::string kIS_SYSTEM_KEY = "isSystem"; -static const std::string kIS_TEMPORARY_KEY = "isTemporary"; -static const std::string kKEY_KEY = "key"; -static const std::string kLANGUAGE_KEY = "language"; -static const std::string kLINKER_LANGUAGE_KEY = "linkerLanguage"; -static const std::string kLINK_FLAGS_KEY = "linkFlags"; -static const std::string kLINK_LANGUAGE_FLAGS_KEY = "linkLanguageFlags"; -static const std::string kLINK_LIBRARIES_KEY = "linkLibraries"; -static const std::string kLINK_PATH_KEY = "linkPath"; -static const std::string kNAME_KEY = "name"; -static const std::string kPATH_KEY = "path"; -static const std::string kPROJECTS_KEY = "projects"; -static const std::string kPROPERTIES_KEY = "properties"; -static const std::string kSOURCE_DIRECTORY_KEY = "sourceDirectory"; -static const std::string kSOURCES_KEY = "sources"; -static const std::string kSYSROOT_KEY = "sysroot"; -static const std::string kTARGETS_KEY = "targets"; -static const std::string kTYPE_KEY = "type"; -static const std::string kVALUE_KEY = "value"; -static const std::string kHAS_INSTALL_RULE = "hasInstallRule"; -static const std::string kINSTALL_PATHS = "installPaths"; -static const std::string kCTEST_NAME = "ctestName"; -static const std::string kCTEST_COMMAND = "ctestCommand"; -static const std::string kCTEST_INFO = "ctestInfo"; -static const std::string kMINIMUM_CMAKE_VERSION = "minimumCMakeVersion"; -static const std::string kIS_GENERATOR_PROVIDED_KEY = "isGeneratorProvided"; diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx deleted file mode 100644 index 3a7ae0c..0000000 --- a/Source/cmJsonObjects.cxx +++ /dev/null @@ -1,692 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmJsonObjects.h" // IWYU pragma: keep - -#include <algorithm> -#include <cassert> -#include <cstddef> -#include <functional> -#include <limits> -#include <map> -#include <memory> -#include <set> -#include <string> -#include <unordered_map> -#include <utility> -#include <vector> - -#include <cmext/algorithm> - -#include "cmGeneratorExpression.h" -#include "cmGeneratorTarget.h" -#include "cmGlobalGenerator.h" -#include "cmInstallGenerator.h" -#include "cmInstallSubdirectoryGenerator.h" -#include "cmInstallTargetGenerator.h" -#include "cmJsonObjectDictionary.h" -#include "cmJsonObjects.h" -#include "cmLinkLineComputer.h" -#include "cmLocalGenerator.h" -#include "cmMakefile.h" -#include "cmProperty.h" -#include "cmPropertyMap.h" -#include "cmSourceFile.h" -#include "cmState.h" -#include "cmStateDirectory.h" -#include "cmStateSnapshot.h" -#include "cmStateTypes.h" -#include "cmStringAlgorithms.h" -#include "cmSystemTools.h" -#include "cmTarget.h" -#include "cmTest.h" -#include "cmake.h" - -namespace { - -std::vector<std::string> getConfigurations(const cmake* cm) -{ - std::vector<std::string> configurations; - const auto& makefiles = cm->GetGlobalGenerator()->GetMakefiles(); - if (makefiles.empty()) { - return configurations; - } - - return makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); -} - -bool hasString(const Json::Value& v, const std::string& s) -{ - return !v.isNull() && - std::any_of(v.begin(), v.end(), - [s](const Json::Value& i) { return i.asString() == s; }); -} - -template <class T> -Json::Value fromStringList(const T& in) -{ - Json::Value result = Json::arrayValue; - for (std::string const& i : in) { - result.append(i); - } - return result; -} - -} // namespace - -void cmGetCMakeInputs(const cmGlobalGenerator* gg, - const std::string& sourceDir, - const std::string& buildDir, - std::vector<std::string>* internalFiles, - std::vector<std::string>* explicitFiles, - std::vector<std::string>* tmpFiles) -{ - const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/'; - auto const& makefiles = gg->GetMakefiles(); - for (const auto& mf : makefiles) { - for (std::string const& lf : mf->GetListFiles()) { - - const std::string startOfFile = lf.substr(0, cmakeRootDir.size()); - const bool isInternal = (startOfFile == cmakeRootDir); - const bool isTemporary = - !isInternal && (cmHasPrefix(lf, buildDir + '/')); - - std::string toAdd = lf; - if (!sourceDir.empty()) { - const std::string& relative = - cmSystemTools::RelativePath(sourceDir, lf); - if (toAdd.size() > relative.size()) { - toAdd = relative; - } - } - - if (isInternal) { - if (internalFiles) { - internalFiles->push_back(std::move(toAdd)); - } - } else { - if (isTemporary) { - if (tmpFiles) { - tmpFiles->push_back(std::move(toAdd)); - } - } else { - if (explicitFiles) { - explicitFiles->push_back(std::move(toAdd)); - } - } - } - } - } -} - -Json::Value cmDumpCMakeInputs(const cmake* cm) -{ - const cmGlobalGenerator* gg = cm->GetGlobalGenerator(); - const std::string& buildDir = cm->GetHomeOutputDirectory(); - const std::string& sourceDir = cm->GetHomeDirectory(); - - std::vector<std::string> internalFiles; - std::vector<std::string> explicitFiles; - std::vector<std::string> tmpFiles; - cmGetCMakeInputs(gg, sourceDir, buildDir, &internalFiles, &explicitFiles, - &tmpFiles); - - Json::Value array = Json::arrayValue; - - Json::Value tmp = Json::objectValue; - tmp[kIS_CMAKE_KEY] = true; - tmp[kIS_TEMPORARY_KEY] = false; - tmp[kSOURCES_KEY] = fromStringList(internalFiles); - array.append(tmp); - - tmp = Json::objectValue; - tmp[kIS_CMAKE_KEY] = false; - tmp[kIS_TEMPORARY_KEY] = false; - tmp[kSOURCES_KEY] = fromStringList(explicitFiles); - array.append(tmp); - - tmp = Json::objectValue; - tmp[kIS_CMAKE_KEY] = false; - tmp[kIS_TEMPORARY_KEY] = true; - tmp[kSOURCES_KEY] = fromStringList(tmpFiles); - array.append(tmp); - - return array; -} - -class LanguageData -{ -public: - bool operator==(const LanguageData& other) const; - - void SetDefines(const std::set<std::string>& defines); - - bool IsGenerated = false; - std::string Language; - std::string Flags; - std::vector<std::string> Defines; - std::vector<std::pair<std::string, bool>> IncludePathList; -}; - -bool LanguageData::operator==(const LanguageData& other) const -{ - return Language == other.Language && Defines == other.Defines && - Flags == other.Flags && IncludePathList == other.IncludePathList && - IsGenerated == other.IsGenerated; -} - -void LanguageData::SetDefines(const std::set<std::string>& defines) -{ - std::vector<std::string> result; - result.reserve(defines.size()); - for (std::string const& i : defines) { - result.push_back(i); - } - std::sort(result.begin(), result.end()); - Defines = std::move(result); -} - -namespace std { - -template <> -struct hash<LanguageData> -{ - std::size_t operator()(const LanguageData& in) const - { - using std::hash; - size_t result = - hash<std::string>()(in.Language) ^ hash<std::string>()(in.Flags); - for (auto const& i : in.IncludePathList) { - result = result ^ - (hash<std::string>()(i.first) ^ - (i.second ? std::numeric_limits<size_t>::max() : 0)); - } - for (auto const& i : in.Defines) { - result = result ^ hash<std::string>()(i); - } - result = - result ^ (in.IsGenerated ? std::numeric_limits<size_t>::max() : 0); - return result; - } -}; - -} // namespace std - -static Json::Value DumpSourceFileGroup(const LanguageData& data, - const std::vector<std::string>& files, - const std::string& baseDir) -{ - Json::Value result = Json::objectValue; - - if (!data.Language.empty()) { - result[kLANGUAGE_KEY] = data.Language; - if (!data.Flags.empty()) { - result[kCOMPILE_FLAGS_KEY] = data.Flags; - } - if (!data.IncludePathList.empty()) { - Json::Value includes = Json::arrayValue; - for (auto const& i : data.IncludePathList) { - Json::Value tmp = Json::objectValue; - tmp[kPATH_KEY] = i.first; - if (i.second) { - tmp[kIS_SYSTEM_KEY] = i.second; - } - includes.append(tmp); - } - result[kINCLUDE_PATH_KEY] = includes; - } - if (!data.Defines.empty()) { - result[kDEFINES_KEY] = fromStringList(data.Defines); - } - } - - result[kIS_GENERATED_KEY] = data.IsGenerated; - - Json::Value sourcesValue = Json::arrayValue; - for (auto const& i : files) { - const std::string relPath = cmSystemTools::RelativePath(baseDir, i); - sourcesValue.append(relPath.size() < i.size() ? relPath : i); - } - - result[kSOURCES_KEY] = sourcesValue; - return result; -} - -static Json::Value DumpSourceFilesList( - cmGeneratorTarget* target, const std::string& config, - const std::map<std::string, LanguageData>& languageDataMap) -{ - // Collect sourcefile groups: - - std::vector<cmSourceFile*> files; - target->GetSourceFiles(files, config); - - std::unordered_map<LanguageData, std::vector<std::string>> fileGroups; - for (cmSourceFile* file : files) { - LanguageData fileData; - fileData.Language = file->GetOrDetermineLanguage(); - if (!fileData.Language.empty()) { - const LanguageData& ld = languageDataMap.at(fileData.Language); - cmLocalGenerator* lg = target->GetLocalGenerator(); - cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target, - fileData.Language); - - std::string compileFlags = ld.Flags; - const std::string COMPILE_FLAGS("COMPILE_FLAGS"); - if (cmProp cflags = file->GetProperty(COMPILE_FLAGS)) { - lg->AppendFlags(compileFlags, - genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); - } - const std::string COMPILE_OPTIONS("COMPILE_OPTIONS"); - if (cmProp coptions = file->GetProperty(COMPILE_OPTIONS)) { - lg->AppendCompileOptions( - compileFlags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS)); - } - fileData.Flags = compileFlags; - - // Add include directories from source file properties. - std::vector<std::string> includes; - - const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); - if (cmProp cincludes = file->GetProperty(INCLUDE_DIRECTORIES)) { - const std::string& evaluatedIncludes = - genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES); - lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file); - - for (const auto& include : includes) { - fileData.IncludePathList.emplace_back( - include, - target->IsSystemIncludeDirectory(include, config, - fileData.Language)); - } - } - - fileData.IncludePathList.insert(fileData.IncludePathList.end(), - ld.IncludePathList.begin(), - ld.IncludePathList.end()); - - const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); - std::set<std::string> defines; - if (cmProp defs = file->GetProperty(COMPILE_DEFINITIONS)) { - lg->AppendDefines( - defines, genexInterpreter.Evaluate(*defs, COMPILE_DEFINITIONS)); - } - - const std::string defPropName = - "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); - if (cmProp config_defs = file->GetProperty(defPropName)) { - lg->AppendDefines( - defines, - genexInterpreter.Evaluate(*config_defs, COMPILE_DEFINITIONS)); - } - - defines.insert(ld.Defines.begin(), ld.Defines.end()); - - fileData.SetDefines(defines); - } - - fileData.IsGenerated = file->GetIsGenerated(); - std::vector<std::string>& groupFileList = fileGroups[fileData]; - groupFileList.push_back(file->ResolveFullPath()); - } - - const std::string& baseDir = target->Makefile->GetCurrentSourceDirectory(); - Json::Value result = Json::arrayValue; - for (auto const& it : fileGroups) { - Json::Value group = DumpSourceFileGroup(it.first, it.second, baseDir); - if (!group.isNull()) { - result.append(group); - } - } - - return result; -} - -static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo, - const std::string& config) -{ - Json::Value result = Json::objectValue; - result[kCTEST_NAME] = testInfo->GetName(); - - // Concat command entries together. After the first should be the arguments - // for the command - std::string command; - for (auto const& cmd : testInfo->GetCommand()) { - command.append(cmd); - command.append(" "); - } - - // Remove any config specific variables from the output. - result[kCTEST_COMMAND] = - cmGeneratorExpression::Evaluate(command, lg, config); - - // Build up the list of properties that may have been specified - Json::Value properties = Json::arrayValue; - for (auto& prop : testInfo->GetProperties().GetList()) { - Json::Value entry = Json::objectValue; - entry[kKEY_KEY] = prop.first; - - // Remove config variables from the value too. - entry[kVALUE_KEY] = - cmGeneratorExpression::Evaluate(prop.second, lg, config); - properties.append(entry); - } - result[kPROPERTIES_KEY] = properties; - - return result; -} - -static void DumpMakefileTests(cmLocalGenerator* lg, const std::string& config, - Json::Value* result) -{ - auto mf = lg->GetMakefile(); - std::vector<cmTest*> tests; - mf->GetTests(config, tests); - for (auto test : tests) { - Json::Value tmp = DumpCTestInfo(lg, test, config); - if (!tmp.isNull()) { - result->append(tmp); - } - } -} - -static Json::Value DumpCTestProjectList(const cmake* cm, - std::string const& config) -{ - Json::Value result = Json::arrayValue; - - auto globalGen = cm->GetGlobalGenerator(); - - for (const auto& projectIt : globalGen->GetProjectMap()) { - Json::Value pObj = Json::objectValue; - pObj[kNAME_KEY] = projectIt.first; - - Json::Value tests = Json::arrayValue; - - // Gather tests for every generator - for (const auto& lg : projectIt.second) { - // Make sure they're generated. - lg->GenerateTestFiles(); - DumpMakefileTests(lg, config, &tests); - } - - pObj[kCTEST_INFO] = tests; - - result.append(pObj); - } - - return result; -} - -static Json::Value DumpCTestConfiguration(const cmake* cm, - const std::string& config) -{ - Json::Value result = Json::objectValue; - result[kNAME_KEY] = config; - - result[kPROJECTS_KEY] = DumpCTestProjectList(cm, config); - - return result; -} - -static Json::Value DumpCTestConfigurationsList(const cmake* cm) -{ - Json::Value result = Json::arrayValue; - - for (const std::string& c : getConfigurations(cm)) { - result.append(DumpCTestConfiguration(cm, c)); - } - - return result; -} - -Json::Value cmDumpCTestInfo(const cmake* cm) -{ - Json::Value result = Json::objectValue; - result[kCONFIGURATIONS_KEY] = DumpCTestConfigurationsList(cm); - return result; -} - -static Json::Value DumpTarget(cmGeneratorTarget* target, - const std::string& config) -{ - cmLocalGenerator* lg = target->GetLocalGenerator(); - - const cmStateEnums::TargetType type = target->GetType(); - const std::string typeName = cmState::GetTargetTypeName(type); - - Json::Value ttl = Json::arrayValue; - ttl.append("EXECUTABLE"); - ttl.append("STATIC_LIBRARY"); - ttl.append("SHARED_LIBRARY"); - ttl.append("MODULE_LIBRARY"); - ttl.append("OBJECT_LIBRARY"); - ttl.append("UTILITY"); - ttl.append("INTERFACE_LIBRARY"); - - if (!hasString(ttl, typeName) || target->IsImported()) { - return Json::Value(); - } - - Json::Value result = Json::objectValue; - result[kNAME_KEY] = target->GetName(); - result[kIS_GENERATOR_PROVIDED_KEY] = - target->Target->GetIsGeneratorProvided(); - result[kTYPE_KEY] = typeName; - result[kSOURCE_DIRECTORY_KEY] = lg->GetCurrentSourceDirectory(); - result[kBUILD_DIRECTORY_KEY] = lg->GetCurrentBinaryDirectory(); - - if (type == cmStateEnums::INTERFACE_LIBRARY) { - return result; - } - - result[kFULL_NAME_KEY] = target->GetFullName(config); - - if (target->Target->GetHaveInstallRule()) { - result[kHAS_INSTALL_RULE] = true; - - Json::Value installPaths = Json::arrayValue; - for (const auto& installGenerator : - target->Makefile->GetInstallGenerators()) { - auto installTargetGenerator = - dynamic_cast<cmInstallTargetGenerator*>(installGenerator.get()); - if (installTargetGenerator != nullptr && - installTargetGenerator->GetTarget()->Target == target->Target) { - auto dest = installTargetGenerator->GetDestination(config); - - std::string installPath; - if (!dest.empty() && cmSystemTools::FileIsFullPath(dest)) { - installPath = dest; - } else { - installPath = cmStrCat( - target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX"), '/', - dest); - } - - installPaths.append(installPath); - } - } - - result[kINSTALL_PATHS] = installPaths; - } - - if (target->HaveWellDefinedOutputFiles()) { - Json::Value artifacts = Json::arrayValue; - artifacts.append( - target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact)); - if (target->HasImportLibrary(config)) { - artifacts.append( - target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact)); - } - if (target->IsDLLPlatform()) { - const cmGeneratorTarget::OutputInfo* output = - target->GetOutputInfo(config); - if (output && !output->PdbDir.empty()) { - artifacts.append(output->PdbDir + '/' + target->GetPDBName(config)); - } - } - result[kARTIFACTS_KEY] = artifacts; - - result[kLINKER_LANGUAGE_KEY] = target->GetLinkerLanguage(config); - - std::string linkLibs; - std::string linkFlags; - std::string linkLanguageFlags; - std::string frameworkPath; - std::string linkPath; - cmLinkLineComputer linkLineComputer(lg, - lg->GetStateSnapshot().GetDirectory()); - lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags, - linkFlags, frameworkPath, linkPath, target); - - linkLibs = cmTrimWhitespace(linkLibs); - linkFlags = cmTrimWhitespace(linkFlags); - linkLanguageFlags = cmTrimWhitespace(linkLanguageFlags); - frameworkPath = cmTrimWhitespace(frameworkPath); - linkPath = cmTrimWhitespace(linkPath); - - if (!cmTrimWhitespace(linkLibs).empty()) { - result[kLINK_LIBRARIES_KEY] = linkLibs; - } - if (!cmTrimWhitespace(linkFlags).empty()) { - result[kLINK_FLAGS_KEY] = linkFlags; - } - if (!cmTrimWhitespace(linkLanguageFlags).empty()) { - result[kLINK_LANGUAGE_FLAGS_KEY] = linkLanguageFlags; - } - if (!frameworkPath.empty()) { - result[kFRAMEWORK_PATH_KEY] = frameworkPath; - } - if (!linkPath.empty()) { - result[kLINK_PATH_KEY] = linkPath; - } - const std::string sysroot = - lg->GetMakefile()->GetSafeDefinition("CMAKE_SYSROOT"); - if (!sysroot.empty()) { - result[kSYSROOT_KEY] = sysroot; - } - } - - std::set<std::string> languages; - target->GetLanguages(languages, config); - std::map<std::string, LanguageData> languageDataMap; - - for (std::string const& lang : languages) { - LanguageData& ld = languageDataMap[lang]; - ld.Language = lang; - lg->GetTargetCompileFlags(target, config, lang, ld.Flags); - std::set<std::string> defines; - lg->GetTargetDefines(target, config, lang, defines); - ld.SetDefines(defines); - std::vector<std::string> includePathList; - lg->GetIncludeDirectories(includePathList, target, lang, config); - for (std::string const& i : includePathList) { - ld.IncludePathList.emplace_back( - i, target->IsSystemIncludeDirectory(i, config, lang)); - } - } - - Json::Value sourceGroupsValue = - DumpSourceFilesList(target, config, languageDataMap); - if (!sourceGroupsValue.empty()) { - result[kFILE_GROUPS_KEY] = sourceGroupsValue; - } - - return result; -} - -static Json::Value DumpTargetsList( - const std::vector<cmLocalGenerator*>& generators, const std::string& config) -{ - Json::Value result = Json::arrayValue; - - std::vector<cmGeneratorTarget*> targetList; - for (auto const& lgIt : generators) { - cm::append(targetList, lgIt->GetGeneratorTargets()); - } - std::sort(targetList.begin(), targetList.end()); - - for (cmGeneratorTarget* target : targetList) { - Json::Value tmp = DumpTarget(target, config); - if (!tmp.isNull()) { - result.append(tmp); - } - } - - return result; -} - -static Json::Value DumpProjectList(const cmake* cm, std::string const& config) -{ - Json::Value result = Json::arrayValue; - - auto globalGen = cm->GetGlobalGenerator(); - - for (auto const& projectIt : globalGen->GetProjectMap()) { - Json::Value pObj = Json::objectValue; - pObj[kNAME_KEY] = projectIt.first; - - // All Projects must have at least one local generator - assert(!projectIt.second.empty()); - const cmLocalGenerator* lg = projectIt.second.at(0); - - // Project structure information: - const cmMakefile* mf = lg->GetMakefile(); - auto minVersion = mf->GetSafeDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); - pObj[kMINIMUM_CMAKE_VERSION] = minVersion; - pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory(); - pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory(); - pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config); - - // For a project-level install rule it might be defined in any of its - // associated generators. - bool hasInstallRule = false; - for (const auto generator : projectIt.second) { - for (const auto& installGen : - generator->GetMakefile()->GetInstallGenerators()) { - if (!dynamic_cast<cmInstallSubdirectoryGenerator*>(installGen.get())) { - hasInstallRule = true; - break; - } - } - - if (hasInstallRule) { - break; - } - } - - pObj[kHAS_INSTALL_RULE] = hasInstallRule; - - result.append(pObj); - } - - return result; -} - -static Json::Value DumpConfiguration(const cmake* cm, - const std::string& config) -{ - Json::Value result = Json::objectValue; - result[kNAME_KEY] = config; - - result[kPROJECTS_KEY] = DumpProjectList(cm, config); - - return result; -} - -static Json::Value DumpConfigurationsList(const cmake* cm) -{ - Json::Value result = Json::arrayValue; - - for (std::string const& c : getConfigurations(cm)) { - result.append(DumpConfiguration(cm, c)); - } - - return result; -} - -Json::Value cmDumpCodeModel(const cmake* cm) -{ - Json::Value result = Json::objectValue; - result[kCONFIGURATIONS_KEY] = DumpConfigurationsList(cm); - return result; -} diff --git a/Source/cmJsonObjects.h b/Source/cmJsonObjects.h deleted file mode 100644 index 80a4834..0000000 --- a/Source/cmJsonObjects.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <string> -#include <vector> - -#include <cm3p/json/value.h> - -class cmake; -class cmGlobalGenerator; - -extern void cmGetCMakeInputs(const cmGlobalGenerator* gg, - const std::string& sourceDir, - const std::string& buildDir, - std::vector<std::string>* internalFiles, - std::vector<std::string>* explicitFiles, - std::vector<std::string>* tmpFiles); - -extern Json::Value cmDumpCodeModel(const cmake* cm); -extern Json::Value cmDumpCTestInfo(const cmake* cm); -extern Json::Value cmDumpCMakeInputs(const cmake* cm); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 70ef5af..3658d11 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -30,6 +30,7 @@ struct cmListFileParser bool ParseFunction(const char* name, long line); bool AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim); + cm::optional<cmListFileContext> CheckNesting(); cmListFile* ListFile; cmListFileBacktrace Backtrace; cmMessenger* Messenger; @@ -158,6 +159,17 @@ bool cmListFileParser::Parse() return false; } } + + // Check if all functions are nested properly. + if (auto badNesting = this->CheckNesting()) { + this->Messenger->IssueMessage( + MessageType::FATAL_ERROR, + "Flow control statements are not properly nested.", + this->Backtrace.Push(*badNesting)); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + return true; } @@ -317,6 +329,112 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, return true; } +namespace { +enum class NestingStateEnum +{ + If, + Else, + While, + Foreach, + Function, + Macro, +}; + +struct NestingState +{ + NestingStateEnum State; + cmListFileContext Context; +}; + +bool TopIs(std::vector<NestingState>& stack, NestingStateEnum state) +{ + return !stack.empty() && stack.back().State == state; +} +} + +cm::optional<cmListFileContext> cmListFileParser::CheckNesting() +{ + std::vector<NestingState> stack; + + for (auto const& func : this->ListFile->Functions) { + auto const& name = func.LowerCaseName(); + if (name == "if") { + stack.push_back({ + NestingStateEnum::If, + cmListFileContext::FromCommandContext(func, this->FileName), + }); + } else if (name == "elseif") { + if (!TopIs(stack, NestingStateEnum::If)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.back() = { + NestingStateEnum::If, + cmListFileContext::FromCommandContext(func, this->FileName), + }; + } else if (name == "else") { + if (!TopIs(stack, NestingStateEnum::If)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.back() = { + NestingStateEnum::Else, + cmListFileContext::FromCommandContext(func, this->FileName), + }; + } else if (name == "endif") { + if (!TopIs(stack, NestingStateEnum::If) && + !TopIs(stack, NestingStateEnum::Else)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.pop_back(); + } else if (name == "while") { + stack.push_back({ + NestingStateEnum::While, + cmListFileContext::FromCommandContext(func, this->FileName), + }); + } else if (name == "endwhile") { + if (!TopIs(stack, NestingStateEnum::While)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.pop_back(); + } else if (name == "foreach") { + stack.push_back({ + NestingStateEnum::Foreach, + cmListFileContext::FromCommandContext(func, this->FileName), + }); + } else if (name == "endforeach") { + if (!TopIs(stack, NestingStateEnum::Foreach)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.pop_back(); + } else if (name == "function") { + stack.push_back({ + NestingStateEnum::Function, + cmListFileContext::FromCommandContext(func, this->FileName), + }); + } else if (name == "endfunction") { + if (!TopIs(stack, NestingStateEnum::Function)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.pop_back(); + } else if (name == "macro") { + stack.push_back({ + NestingStateEnum::Macro, + cmListFileContext::FromCommandContext(func, this->FileName), + }); + } else if (name == "endmacro") { + if (!TopIs(stack, NestingStateEnum::Macro)) { + return cmListFileContext::FromCommandContext(func, this->FileName); + } + stack.pop_back(); + } + } + + if (!stack.empty()) { + return stack.back().Context; + } + + return cm::nullopt; +} + // We hold either the bottom scope of a directory or a call/file context. // Discriminate these cases via the parent pointer. struct cmListFileBacktrace::Entry diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 727fc60..ed45c07 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -89,6 +89,14 @@ public: { } +#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) + cmListFileContext(const cmListFileContext& /*other*/) = default; + cmListFileContext(cmListFileContext&& /*other*/) = default; + + cmListFileContext& operator=(const cmListFileContext& /*other*/) = default; + cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete; +#endif + static cmListFileContext FromCommandContext( cmCommandContext const& lfcc, std::string const& fileName, cm::optional<std::string> deferId = {}) diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 5790e16..adebe02 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -24,6 +24,7 @@ #include "cmCommand.h" #include "cmDynamicLoader.h" #include "cmExecutionStatus.h" +#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmState.h" @@ -36,8 +37,6 @@ # include <malloc.h> /* for malloc/free on QNX */ #endif -class cmListFileBacktrace; - namespace { const char* LastName = nullptr; @@ -256,10 +255,12 @@ bool cmLoadCommandCommand(std::vector<std::string> const& args, // if the symbol is found call it to set the name on the // function blocker if (initFunction) { - status.GetMakefile().GetState()->AddScriptedCommand( + return status.GetMakefile().GetState()->AddScriptedCommand( args[0], - cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction))); - return true; + BT<cmState::Command>( + cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction)), + status.GetMakefile().GetBacktrace()), + status.GetMakefile()); } status.SetError("Attempt to load command failed. " "No init function found."); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 368f278..c9dfdea 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3,6 +3,7 @@ #include "cmLocalGenerator.h" #include <algorithm> +#include <array> #include <cassert> #include <cstdio> #include <cstdlib> @@ -279,7 +280,7 @@ static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs, }); } -void cmLocalGenerator::TraceDependencies() +void cmLocalGenerator::TraceDependencies() const { // Generate the rule files for each target. const auto& targets = this->GetGeneratorTargets(); @@ -823,16 +824,13 @@ cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const return this->Makefile->GetStateSnapshot(); } -const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, - const std::string& prop) +cmProp cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, + const std::string& prop) { - cmProp p; if (target) { - p = target->GetProperty(prop); - } else { - p = this->Makefile->GetProperty(prop); + return target->GetProperty(prop); } - return p ? p->c_str() : nullptr; + return this->Makefile->GetProperty(prop); } std::string cmLocalGenerator::ConvertToIncludeReference( @@ -2478,8 +2476,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) target->GetSourceFiles(sources, config); const std::string configUpper = cmSystemTools::UpperCase(config); + static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC", + "OBJCXX" } }; - for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) { + for (const std::string& lang : langs) { auto langSources = std::count_if( sources.begin(), sources.end(), [lang](cmSourceFile* sf) { return lang == sf->GetLanguage() && @@ -2613,14 +2613,16 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) // Add pchHeader to source files, which will // be grouped as "Precompile Header File" auto pchHeader_sf = this->Makefile->GetOrCreateSource( - pchHeader, true, cmSourceFileLocationKind::Known); + pchHeader, false, cmSourceFileLocationKind::Known); std::string err; pchHeader_sf->ResolveFullPath(&err); - - // The pch file is generated, but mark it as not generated - // so that a clean operation will not remove it from disk - pchHeader_sf->SetProperty("GENERATED", "0"); - + if (!err.empty()) { + std::ostringstream msg; + msg << "Unable to resolve full path of PCH-header '" << pchHeader + << "' assigned to target " << target->GetName() + << ", although its path is supposed to be known!"; + this->IssueMessage(MessageType::FATAL_ERROR, msg.str()); + } target->AddSource(pchHeader); } } @@ -3213,7 +3215,7 @@ std::string cmLocalGenerator::GetProjectName() const } std::string cmLocalGenerator::ConstructComment( - cmCustomCommandGenerator const& ccg, const char* default_comment) + cmCustomCommandGenerator const& ccg, const char* default_comment) const { // Check for a comment provided with the command. if (ccg.GetComment()) { @@ -3529,11 +3531,11 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( // we don't end up having: // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/generated_source_file.obj cmProp unitySourceFile = source.GetProperty("UNITY_SOURCE_FILE"); - cmProp psExtension = source.GetProperty("PCH_EXTENSION"); + cmProp pchExtension = source.GetProperty("PCH_EXTENSION"); const bool isPchObject = objectName.find("cmake_pch") != std::string::npos; - if (unitySourceFile || psExtension || isPchObject) { - if (psExtension) { - customOutputExtension = psExtension->c_str(); + if (unitySourceFile || pchExtension || isPchObject) { + if (pchExtension) { + customOutputExtension = pchExtension->c_str(); } cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)"); @@ -3771,7 +3773,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, cmLGInfoProp(mf, target, "MACOSX_BUNDLE_SHORT_VERSION_STRING"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT"); - mf->ConfigureFile(inFile, fname, false, false, false, true); + mf->ConfigureFile(inFile, fname, false, false, false); } void cmLocalGenerator::GenerateFrameworkInfoPList( @@ -3806,7 +3808,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION"); - mf->ConfigureFile(inFile, fname, false, false, false, true); + mf->ConfigureFile(inFile, fname, false, false, false); } namespace { @@ -3921,10 +3923,35 @@ cmSourceFile* AddCustomCommand( cc->SetJobPool(job_pool); file->SetCustomCommand(std::move(cc)); - mf->AddSourceOutputs(file, outputs, byproducts); + lg.AddSourceOutputs(file, outputs, byproducts); } return file; } + +bool AnyOutputMatches(const std::string& name, + const std::vector<std::string>& outputs) +{ + for (std::string const& output : outputs) { + std::string::size_type pos = output.rfind(name); + // If the output matches exactly + if (pos != std::string::npos && pos == output.size() - name.size() && + (pos == 0 || output[pos - 1] == '/')) { + return true; + } + } + return false; +} + +bool AnyTargetCommandOutputMatches( + const std::string& name, const std::vector<cmCustomCommand>& commands) +{ + for (cmCustomCommand const& command : commands) { + if (AnyOutputMatches(name, command.GetByproducts())) { + return true; + } + } + return false; +} } namespace detail { @@ -3940,8 +3967,6 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg, const std::string& job_pool, bool command_expand_lists, bool stdPipesUTF8) { - cmMakefile* mf = lg.GetMakefile(); - // Always create the byproduct sources and mark them generated. CreateGeneratedSources(lg, byproducts, origin, lfbt); @@ -3967,7 +3992,7 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg, break; } - mf->AddTargetByproducts(target, byproducts); + lg.AddTargetByproducts(target, byproducts); } cmSourceFile* AddCustomCommandToOutput( @@ -3999,7 +4024,7 @@ void AppendCustomCommandToOutput(cmLocalGenerator& lg, const cmCustomCommandLines& commandLines) { // Lookup an existing command. - if (cmSourceFile* sf = lg.GetMakefile()->GetSourceFileWithOutput(output)) { + if (cmSourceFile* sf = lg.GetSourceFileWithOutput(output)) { if (cmCustomCommand* cc = sf->GetCustomCommand()) { cc->AppendCommands(commandLines); cc->AppendDepends(depends); @@ -4011,7 +4036,7 @@ void AppendCustomCommandToOutput(cmLocalGenerator& lg, // No existing command found. lg.GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, - cmStrCat("Attempt to append to output\n ", output, + cmStrCat("Attempt to APPEND to custom command with output\n ", output, "\nwhich is not already a custom command output."), lfbt); } @@ -4043,7 +4068,7 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, /*replace=*/false, escapeOldStyle, uses_terminal, command_expand_lists, /*depfile=*/"", job_pool, stdPipesUTF8); if (rule) { - lg.GetMakefile()->AddTargetByproducts(target, byproducts); + lg.AddTargetByproducts(target, byproducts); } if (!force.NameCMP0049.empty()) { @@ -4099,3 +4124,166 @@ std::vector<std::string> ComputeISPCExtraObjects( return computedObjects; } } + +cmSourcesWithOutput cmLocalGenerator::GetSourcesWithOutput( + const std::string& name) const +{ + // Linear search? Also see GetSourceFileWithOutput for detail. + if (!cmSystemTools::FileIsFullPath(name)) { + cmSourcesWithOutput sources; + sources.Target = this->LinearGetTargetWithOutput(name); + sources.Source = this->LinearGetSourceFileWithOutput( + name, cmSourceOutputKind::OutputOrByproduct, sources.SourceIsByproduct); + return sources; + } + // Otherwise we use an efficient lookup map. + auto o = this->OutputToSource.find(name); + if (o != this->OutputToSource.end()) { + return o->second.Sources; + } + return {}; +} + +cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput( + const std::string& name, cmSourceOutputKind kind) const +{ + // If the queried path is not absolute we use the backward compatible + // linear-time search for an output with a matching suffix. + if (!cmSystemTools::FileIsFullPath(name)) { + bool byproduct = false; + return this->LinearGetSourceFileWithOutput(name, kind, byproduct); + } + // Otherwise we use an efficient lookup map. + auto o = this->OutputToSource.find(name); + if (o != this->OutputToSource.end() && + (!o->second.Sources.SourceIsByproduct || + kind == cmSourceOutputKind::OutputOrByproduct)) { + // Source file could also be null pointer for example if we found the + // byproduct of a utility target, a PRE_BUILD, PRE_LINK, or POST_BUILD + // command of a target, or a not yet created custom command. + return o->second.Sources.Source; + } + return nullptr; +} + +void cmLocalGenerator::AddTargetByproducts( + cmTarget* target, const std::vector<std::string>& byproducts) +{ + for (std::string const& o : byproducts) { + this->UpdateOutputToSourceMap(o, target); + } +} + +void cmLocalGenerator::AddSourceOutputs( + cmSourceFile* source, const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts) +{ + for (std::string const& o : outputs) { + this->UpdateOutputToSourceMap(o, source, false); + } + for (std::string const& o : byproducts) { + this->UpdateOutputToSourceMap(o, source, true); + } +} + +void cmLocalGenerator::UpdateOutputToSourceMap(std::string const& byproduct, + cmTarget* target) +{ + SourceEntry entry; + entry.Sources.Target = target; + + auto pr = this->OutputToSource.emplace(byproduct, entry); + if (!pr.second) { + SourceEntry& current = pr.first->second; + // Has the target already been set? + if (!current.Sources.Target) { + current.Sources.Target = target; + } else { + // Multiple custom commands/targets produce the same output (source file + // or target). See also comment in other UpdateOutputToSourceMap + // overload. + // + // TODO: Warn the user about this case. + } + } +} + +void cmLocalGenerator::UpdateOutputToSourceMap(std::string const& output, + cmSourceFile* source, + bool byproduct) +{ + SourceEntry entry; + entry.Sources.Source = source; + entry.Sources.SourceIsByproduct = byproduct; + + auto pr = this->OutputToSource.emplace(output, entry); + if (!pr.second) { + SourceEntry& current = pr.first->second; + // Outputs take precedence over byproducts + if (!current.Sources.Source || + (current.Sources.SourceIsByproduct && !byproduct)) { + current.Sources.Source = source; + current.Sources.SourceIsByproduct = false; + } else { + // Multiple custom commands produce the same output but may + // be attached to a different source file (MAIN_DEPENDENCY). + // LinearGetSourceFileWithOutput would return the first one, + // so keep the mapping for the first one. + // + // TODO: Warn the user about this case. However, the VS 8 generator + // triggers it for separate generate.stamp rules in ZERO_CHECK and + // individual targets. + } + } +} + +cmTarget* cmLocalGenerator::LinearGetTargetWithOutput( + const std::string& name) const +{ + // We go through the ordered vector of targets to get reproducible results + // should multiple names match. + for (cmTarget* t : this->Makefile->GetOrderedTargets()) { + // Does the output of any command match the source file name? + if (AnyTargetCommandOutputMatches(name, t->GetPreBuildCommands())) { + return t; + } + if (AnyTargetCommandOutputMatches(name, t->GetPreLinkCommands())) { + return t; + } + if (AnyTargetCommandOutputMatches(name, t->GetPostBuildCommands())) { + return t; + } + } + return nullptr; +} + +cmSourceFile* cmLocalGenerator::LinearGetSourceFileWithOutput( + const std::string& name, cmSourceOutputKind kind, bool& byproduct) const +{ + // Outputs take precedence over byproducts. + byproduct = false; + cmSourceFile* fallback = nullptr; + + // Look through all the source files that have custom commands and see if the + // custom command has the passed source file as an output. + for (const auto& src : this->Makefile->GetSourceFiles()) { + // Does this source file have a custom command? + if (src->GetCustomCommand()) { + // Does the output of the custom command match the source file name? + if (AnyOutputMatches(name, src->GetCustomCommand()->GetOutputs())) { + // Return the first matching output. + return src.get(); + } + if (kind == cmSourceOutputKind::OutputOrByproduct) { + if (AnyOutputMatches(name, src->GetCustomCommand()->GetByproducts())) { + // Do not return the source yet as there might be a matching output. + fallback = src.get(); + } + } + } + } + + // Did we find a byproduct? + byproduct = fallback != nullptr; + return fallback; +} diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 22d3599..09e820a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -36,6 +36,31 @@ class cmState; class cmTarget; class cmake; +/** Flag if byproducts shall also be considered. */ +enum class cmSourceOutputKind +{ + OutputOnly, + OutputOrByproduct +}; + +/** What scanner to use for dependencies lookup. */ +enum class cmDependencyScannerKind +{ + CMake, + Compiler +}; + +/** Target and source file which have a specific output. */ +struct cmSourcesWithOutput +{ + /** Target with byproduct. */ + cmTarget* Target = nullptr; + + /** Source file with output or byproduct. */ + cmSourceFile* Source = nullptr; + bool SourceIsByproduct = false; +}; + /** \class cmLocalGenerator * \brief Create required build files for a directory. * @@ -59,7 +84,7 @@ public: /** * Calls TraceVSDependencies() on all targets of this generator. */ - void TraceDependencies(); + void TraceDependencies() const; virtual void AddHelperCommands() {} @@ -337,6 +362,34 @@ public: bool command_expand_lists = false, const std::string& job_pool = "", bool stdPipesUTF8 = false); + /** + * Add target byproducts. + */ + void AddTargetByproducts(cmTarget* target, + const std::vector<std::string>& byproducts); + + /** + * Add source file outputs. + */ + void AddSourceOutputs(cmSourceFile* source, + const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts); + + /** + * Return the target if the provided source name is a byproduct of a utility + * target or a PRE_BUILD, PRE_LINK, or POST_BUILD command. + * Return the source file which has the provided source name as output. + */ + cmSourcesWithOutput GetSourcesWithOutput(const std::string& name) const; + + /** + * Is there a source file that has the provided source name as an output? + * If so then return it. + */ + cmSourceFile* GetSourceFileWithOutput( + const std::string& name, + cmSourceOutputKind kind = cmSourceOutputKind::OutputOnly) const; + std::string GetProjectName() const; /** Compute the language used to compile the given source file. */ @@ -405,7 +458,7 @@ public: const std::string& fname); /** Construct a comment for a custom command. */ std::string ConstructComment(cmCustomCommandGenerator const& ccg, - const char* default_comment = ""); + const char* default_comment = "") const; // Compute object file names. std::string GetObjectFileNameWithoutTarget( const cmSourceFile& source, std::string const& dir_max, @@ -473,8 +526,7 @@ public: void CreateEvaluationFileOutputs(const std::string& config); void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles); - const char* GetRuleLauncher(cmGeneratorTarget* target, - const std::string& prop); + cmProp GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop); protected: //! put all the libraries for a target on into the given stream @@ -532,6 +584,33 @@ protected: bool BackwardsCompatibilityFinal; private: + /** + * See LinearGetSourceFileWithOutput for background information + */ + cmTarget* LinearGetTargetWithOutput(const std::string& name) const; + + /** + * Generalized old version of GetSourceFileWithOutput kept for + * backward-compatibility. It implements a linear search and supports + * relative file paths. It is used as a fall back by GetSourceFileWithOutput + * and GetSourcesWithOutput. + */ + cmSourceFile* LinearGetSourceFileWithOutput(const std::string& name, + cmSourceOutputKind kind, + bool& byproduct) const; + struct SourceEntry + { + cmSourcesWithOutput Sources; + }; + + // A map for fast output to input look up. + using OutputToSourceMap = std::unordered_map<std::string, SourceEntry>; + OutputToSourceMap OutputToSource; + + void UpdateOutputToSourceMap(std::string const& byproduct, cmTarget* target); + void UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source, + bool byproduct); + void AddSharedFlags(std::string& flags, const std::string& lang, bool shared); bool GetShouldUseOldFlags(bool shared, const std::string& lang) const; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ad782ee..d90a37b 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -22,7 +22,9 @@ #include "cmGlobalNinjaGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmNinjaTargetGenerator.h" +#include "cmPolicies.h" #include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -573,7 +575,20 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( return; } - cmCustomCommandGenerator ccg(*cc, config, this); + bool transformDepfile = false; + auto cmp0116 = this->GetPolicyStatus(cmPolicies::CMP0116); + switch (cmp0116) { + case cmPolicies::OLD: + case cmPolicies::WARN: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + transformDepfile = true; + break; + } + + cmCustomCommandGenerator ccg(*cc, config, this, transformDepfile); const std::vector<std::string>& outputs = ccg.GetOutputs(); const std::vector<std::string>& byproducts = ccg.GetByproducts(); @@ -588,11 +603,6 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( } } -#if 0 -# error TODO: Once CC in an ExternalProject target must provide the \ - file of each imported target that has an add_dependencies pointing \ - at us. How to know which ExternalProject step actually provides it? -#endif cmNinjaDeps ninjaOutputs(outputs.size() + byproducts.size()); std::transform(outputs.begin(), outputs.end(), ninjaOutputs.begin(), gg->MapToNinjaPath()); @@ -623,10 +633,36 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCryptoHash hash(cmCryptoHash::AlgoSHA256); customStep += hash.HashString(ninjaOutputs[0]).substr(0, 7); + std::string depfile = cc->GetDepfile(); + if (!depfile.empty()) { + switch (cmp0116) { + case cmPolicies::WARN: + if (this->GetCurrentBinaryDirectory() != + this->GetBinaryDirectory() || + this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0116")) { + this->GetCMakeInstance()->IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0116), + cc->GetBacktrace()); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + cmSystemTools::MakeDirectory( + cmStrCat(this->GetBinaryDirectory(), "/CMakeFiles/d")); + depfile = ccg.GetInternalDepfile(); + break; + } + } + gg->WriteCustomCommandBuild( this->BuildCommandLine(cmdLines, customStep), this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], - cc->GetDepfile(), cc->GetJobPool(), cc->GetUsesTerminal(), + depfile, cc->GetJobPool(), cc->GetUsesTerminal(), /*restat*/ !symbolic || !byproducts.empty(), ninjaOutputs, config, ninjaDeps, orderOnlyDeps); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c877cf8..08cefb7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -5,18 +5,22 @@ #include <algorithm> #include <cassert> #include <cstdio> +#include <functional> #include <sstream> #include <utility> #include <cm/memory> +#include <cm/string_view> #include <cm/vector> #include <cmext/algorithm> #include "cmsys/FStream.hxx" #include "cmsys/Terminal.h" +#include "cmCMakePath.h" #include "cmCustomCommand.h" // IWYU pragma: keep #include "cmCustomCommandGenerator.h" +#include "cmDependsCompiler.h" #include "cmFileTimeCache.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" @@ -50,8 +54,9 @@ # include "cmDependsJava.h" #endif +namespace { // Helper function used below. -static std::string cmSplitExtension(std::string const& in, std::string& base) +std::string cmSplitExtension(std::string const& in, std::string& base) { std::string ext; std::string::size_type dot_pos = in.rfind('.'); @@ -65,6 +70,43 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) return ext; } +// Helper predicate for removing absolute paths that don't point to the +// source or binary directory. It is used when CMAKE_DEPENDS_IN_PROJECT_ONLY +// is set ON, to only consider in-project dependencies during the build. +class NotInProjectDir +{ +public: + // Constructor with the source and binary directory's path + NotInProjectDir(cm::string_view sourceDir, cm::string_view binaryDir) + : SourceDir(sourceDir) + , BinaryDir(binaryDir) + { + } + + // Operator evaluating the predicate + bool operator()(const std::string& p) const + { + auto path = cmCMakePath(p).Normal(); + + // Keep all relative paths: + if (path.IsRelative()) { + return false; + } + + // If it's an absolute path, check if it starts with the source + // directory: + return !(cmCMakePath(SourceDir).IsPrefix(path) || + cmCMakePath(BinaryDir).IsPrefix(path)); + } + +private: + // The path to the source directory + cm::string_view SourceDir; + // The path to the binary directory + cm::string_view BinaryDir; +}; +} + cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( cmGlobalGenerator* gg, cmMakefile* mf) : cmLocalCommonGenerator(gg, mf, mf->GetCurrentBinaryDirectory()) @@ -552,8 +594,10 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( } } - // Write the list of commands. - os << cmWrap("\t", commands, "", "\n") << "\n"; + if (!commands.empty()) { + // Write the list of commands. + os << cmWrap("\t", commands, "", "\n") << "\n"; + } if (symbolic && !this->IsWatcomWMake()) { os << ".PHONY : " << tgt << "\n"; } @@ -960,7 +1004,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( std::string launcher; // Short-circuit if there is no launcher. - const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM"); + cmProp val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM"); if (cmNonempty(val)) { // Expand rule variables referenced in the given launcher command. cmRulePlaceholderExpander::RuleVariables vars; @@ -980,7 +1024,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( } vars.Output = output.c_str(); - launcher = val; + launcher = *val; rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); if (!launcher.empty()) { launcher += " "; @@ -1298,91 +1342,153 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( cmSystemTools::Error("Target DependInfo.cmake file not found"); } + bool status = true; + // Check if any multiple output pairs have a missing file. this->CheckMultipleOutputs(verbose); std::string const targetDir = cmSystemTools::GetFilenamePath(tgtInfo); - std::string const internalDependFile = targetDir + "/depend.internal"; - std::string const dependFile = targetDir + "/depend.make"; - - // If the target DependInfo.cmake file has changed since the last - // time dependencies were scanned then force rescanning. This may - // happen when a new source file is added and CMake regenerates the - // project but no other sources were touched. - bool needRescanDependInfo = false; - cmFileTimeCache* ftc = - this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache(); - { - int result; - if (!ftc->Compare(internalDependFile, tgtInfo, &result) || result < 0) { - if (verbose) { - cmSystemTools::Stdout(cmStrCat("Dependee \"", tgtInfo, - "\" is newer than depender \"", - internalDependFile, "\".\n")); + if (!this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES").empty()) { + // dependencies are managed by CMake itself + + std::string const internalDependFile = targetDir + "/depend.internal"; + std::string const dependFile = targetDir + "/depend.make"; + + // If the target DependInfo.cmake file has changed since the last + // time dependencies were scanned then force rescanning. This may + // happen when a new source file is added and CMake regenerates the + // project but no other sources were touched. + bool needRescanDependInfo = false; + cmFileTimeCache* ftc = + this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache(); + { + int result; + if (!ftc->Compare(internalDependFile, tgtInfo, &result) || result < 0) { + if (verbose) { + cmSystemTools::Stdout(cmStrCat("Dependee \"", tgtInfo, + "\" is newer than depender \"", + internalDependFile, "\".\n")); + } + needRescanDependInfo = true; } - needRescanDependInfo = true; } - } - // If the directory information is newer than depend.internal, include dirs - // may have changed. In this case discard all old dependencies. - bool needRescanDirInfo = false; - { - std::string dirInfoFile = - cmStrCat(this->GetCurrentBinaryDirectory(), - "/CMakeFiles/CMakeDirectoryInformation.cmake"); - int result; - if (!ftc->Compare(internalDependFile, dirInfoFile, &result) || - result < 0) { - if (verbose) { - cmSystemTools::Stdout(cmStrCat("Dependee \"", dirInfoFile, - "\" is newer than depender \"", - internalDependFile, "\".\n")); + // If the directory information is newer than depend.internal, include + // dirs may have changed. In this case discard all old dependencies. + bool needRescanDirInfo = false; + { + std::string dirInfoFile = + cmStrCat(this->GetCurrentBinaryDirectory(), + "/CMakeFiles/CMakeDirectoryInformation.cmake"); + int result; + if (!ftc->Compare(internalDependFile, dirInfoFile, &result) || + result < 0) { + if (verbose) { + cmSystemTools::Stdout(cmStrCat("Dependee \"", dirInfoFile, + "\" is newer than depender \"", + internalDependFile, "\".\n")); + } + needRescanDirInfo = true; } - needRescanDirInfo = true; + } + + // Check the implicit dependencies to see if they are up to date. + // The build.make file may have explicit dependencies for the object + // files but these will not affect the scanning process so they need + // not be considered. + cmDepends::DependencyMap validDependencies; + bool needRescanDependencies = false; + if (!needRescanDirInfo) { + cmDependsC checker; + checker.SetVerbose(verbose); + checker.SetFileTimeCache(ftc); + // cmDependsC::Check() fills the vector validDependencies() with the + // dependencies for those files where they are still valid, i.e. + // neither the files themselves nor any files they depend on have + // changed. We don't do that if the CMakeDirectoryInformation.cmake + // file has changed, because then potentially all dependencies have + // changed. This information is given later on to cmDependsC, which + // then only rescans the files where it did not get valid dependencies + // via this dependency vector. This means that in the normal case, when + // only few or one file have been edited, then also only this one file + // is actually scanned again, instead of all files for this target. + needRescanDependencies = + !checker.Check(dependFile, internalDependFile, validDependencies); + } + + if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) { + // The dependencies must be regenerated. + std::string targetName = cmSystemTools::GetFilenameName(targetDir); + targetName = targetName.substr(0, targetName.length() - 4); + std::string message = + cmStrCat("Scanning dependencies of target ", targetName); + cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | + cmsysTerminal_Color_ForegroundBold, + message.c_str(), true, color); + + status = this->ScanDependencies(targetDir, dependFile, + internalDependFile, validDependencies); } } - // Check the implicit dependencies to see if they are up to date. - // The build.make file may have explicit dependencies for the object - // files but these will not affect the scanning process so they need - // not be considered. - cmDepends::DependencyMap validDependencies; - bool needRescanDependencies = false; - if (!needRescanDirInfo) { - cmDependsC checker; - checker.SetVerbose(verbose); - checker.SetFileTimeCache(ftc); - // cmDependsC::Check() fills the vector validDependencies() with the - // dependencies for those files where they are still valid, i.e. neither - // the files themselves nor any files they depend on have changed. - // We don't do that if the CMakeDirectoryInformation.cmake file has - // changed, because then potentially all dependencies have changed. - // This information is given later on to cmDependsC, which then only - // rescans the files where it did not get valid dependencies via this - // dependency vector. This means that in the normal case, when only - // few or one file have been edited, then also only this one file is - // actually scanned again, instead of all files for this target. - needRescanDependencies = - !checker.Check(dependFile, internalDependFile, validDependencies); - } - - if (needRescanDependInfo || needRescanDirInfo || needRescanDependencies) { - // The dependencies must be regenerated. - std::string targetName = cmSystemTools::GetFilenameName(targetDir); - targetName = targetName.substr(0, targetName.length() - 4); - std::string message = - cmStrCat("Scanning dependencies of target ", targetName); - cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | - cmsysTerminal_Color_ForegroundBold, - message.c_str(), true, color); - - return this->ScanDependencies(targetDir, dependFile, internalDependFile, - validDependencies); + auto depends = + this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_DEPENDENCY_FILES"); + if (!depends.empty()) { + // dependencies are managed by compiler + auto depFiles = cmExpandedList(depends); + std::string const internalDepFile = + targetDir + "/compiler_depend.internal"; + std::string const depFile = targetDir + "/compiler_depend.make"; + cmDepends::DependencyMap dependencies; + cmDependsCompiler depsManager; + bool projectOnly = cmIsOn( + this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_IN_PROJECT_ONLY")); + + depsManager.SetVerbose(verbose); + depsManager.SetLocalGenerator(this); + + if (!depsManager.CheckDependencies( + internalDepFile, depFiles, dependencies, + projectOnly ? NotInProjectDir(this->GetSourceDirectory(), + this->GetBinaryDirectory()) + : std::function<bool(const std::string&)>())) { + // regenerate dependencies files + std::string targetName = + cmCMakePath(targetDir).GetFileName().RemoveExtension().GenericString(); + auto message = cmStrCat( + "Consolidate compiler generated dependencies of target ", targetName); + cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundMagenta | + cmsysTerminal_Color_ForegroundBold, + message.c_str(), true, color); + + // Open the make depends file. This should be copy-if-different + // because the make tool may try to reload it needlessly otherwise. + cmGeneratedFileStream ruleFileStream( + depFile, false, this->GlobalGenerator->GetMakefileEncoding()); + ruleFileStream.SetCopyIfDifferent(true); + if (!ruleFileStream) { + return false; + } + + // Open the cmake dependency tracking file. This should not be + // copy-if-different because dependencies are re-scanned when it is + // older than the DependInfo.cmake. + cmGeneratedFileStream internalRuleFileStream( + internalDepFile, false, this->GlobalGenerator->GetMakefileEncoding()); + if (!internalRuleFileStream) { + return false; + } + + this->WriteDisclaimer(ruleFileStream); + this->WriteDisclaimer(internalRuleFileStream); + + depsManager.WriteDependencies(dependencies, ruleFileStream, + internalRuleFileStream); + } } // The dependencies are already up-to-date. - return true; + return status; } bool cmLocalUnixMakefileGenerator3::ScanDependencies( @@ -1721,178 +1827,193 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, cmDepends clearer; clearer.SetVerbose(verbose); for (std::string const& file : files) { - std::string dir = cmSystemTools::GetFilenamePath(file); + auto snapshot = mf->GetState()->CreateBaseSnapshot(); + cmMakefile lmf(mf->GetGlobalGenerator(), snapshot); + lmf.ReadListFile(file); - // Clear the implicit dependency makefile. - std::string dependFile = dir + "/depend.make"; - clearer.Clear(dependFile); + if (!lmf.GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES").empty()) { + std::string dir = cmSystemTools::GetFilenamePath(file); - // Remove the internal dependency check file to force - // regeneration. - std::string internalDependFile = dir + "/depend.internal"; - cmSystemTools::RemoveFile(internalDependFile); - } -} - -namespace { -// Helper predicate for removing absolute paths that don't point to the -// source or binary directory. It is used when CMAKE_DEPENDS_IN_PROJECT_ONLY -// is set ON, to only consider in-project dependencies during the build. -class NotInProjectDir -{ -public: - // Constructor with the source and binary directory's path - NotInProjectDir(std::string sourceDir, std::string binaryDir) - : SourceDir(std::move(sourceDir)) - , BinaryDir(std::move(binaryDir)) - { - } + // Clear the implicit dependency makefile. + std::string dependFile = dir + "/depend.make"; + clearer.Clear(dependFile); - // Operator evaluating the predicate - bool operator()(const std::string& path) const - { - // Keep all relative paths: - if (!cmSystemTools::FileIsFullPath(path)) { - return false; + // Remove the internal dependency check file to force + // regeneration. + std::string internalDependFile = dir + "/depend.internal"; + cmSystemTools::RemoveFile(internalDependFile); } - // If it's an absolute path, check if it starts with the source - // directory: - return ( - !(IsInDirectory(SourceDir, path) || IsInDirectory(BinaryDir, path))); - } -private: - // Helper function used by the predicate - static bool IsInDirectory(const std::string& baseDir, - const std::string& testDir) - { - // First check if the test directory "starts with" the base directory: - if (!cmHasPrefix(testDir, baseDir)) { - return false; + auto depsFiles = lmf.GetSafeDefinition("CMAKE_DEPENDS_DEPENDENCY_FILES"); + if (!depsFiles.empty()) { + auto dir = cmCMakePath(file).GetParentPath(); + // Clear the implicit dependency makefile. + auto depFile = cmCMakePath(dir).Append("compiler_depend.make"); + clearer.Clear(depFile.GenericString()); + + // Remove the internal dependency check file + auto internalDepFile = + cmCMakePath(dir).Append("compiler_depend.internal"); + cmSystemTools::RemoveFile(internalDepFile.GenericString()); + + // Touch timestamp file to force dependencies regeneration + auto DepTimestamp = cmCMakePath(dir).Append("compiler_depend.ts"); + cmSystemTools::Touch(DepTimestamp.GenericString(), true); + + // clear the dependencies files generated by the compiler + std::vector<std::string> dependencies = cmExpandedList(depsFiles); + cmDependsCompiler depsManager; + depsManager.SetVerbose(verbose); + depsManager.ClearDependencies(dependencies); } - // If it does, then check that it's either the same string, or that the - // next character is a slash: - return ((testDir.size() == baseDir.size()) || - (testDir[baseDir.size()] == '/')); } - - // The path to the source directory - std::string SourceDir; - // The path to the binary directory - std::string BinaryDir; -}; } void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( std::ostream& cmakefileStream, cmGeneratorTarget* target) { - ImplicitDependLanguageMap const& implicitLangs = - this->GetImplicitDepends(target); + // To enable dependencies filtering + cmakefileStream << "\n" + << "# Consider dependencies only in project.\n" + << "set(CMAKE_DEPENDS_IN_PROJECT_ONLY " + << (cmIsOn(this->Makefile->GetSafeDefinition( + "CMAKE_DEPENDS_IN_PROJECT_ONLY")) + ? "ON" + : "OFF") + << ")\n\n"; + + auto const& implicitLangs = + this->GetImplicitDepends(target, cmDependencyScannerKind::CMake); // list the languages - cmakefileStream - << "# The set of languages for which implicit dependencies are needed:\n"; + cmakefileStream << "# The set of languages for which implicit " + "dependencies are needed:\n"; cmakefileStream << "set(CMAKE_DEPENDS_LANGUAGES\n"; for (auto const& implicitLang : implicitLangs) { cmakefileStream << " \"" << implicitLang.first << "\"\n"; } cmakefileStream << " )\n"; - // now list the files for each language - cmakefileStream - << "# The set of files for implicit dependencies of each language:\n"; - for (auto const& implicitLang : implicitLangs) { - cmakefileStream << "set(CMAKE_DEPENDS_CHECK_" << implicitLang.first - << "\n"; - ImplicitDependFileMap const& implicitPairs = implicitLang.second; - - // for each file pair - for (auto const& implicitPair : implicitPairs) { - for (auto const& di : implicitPair.second) { - cmakefileStream << " \"" << di << "\" "; - cmakefileStream << "\"" << implicitPair.first << "\"\n"; + if (!implicitLangs.empty()) { + // now list the files for each language + cmakefileStream + << "# The set of files for implicit dependencies of each language:\n"; + for (auto const& implicitLang : implicitLangs) { + const auto& lang = implicitLang.first; + + cmakefileStream << "set(CMAKE_DEPENDS_CHECK_" << lang << "\n"; + auto const& implicitPairs = implicitLang.second; + + // for each file pair + for (auto const& implicitPair : implicitPairs) { + for (auto const& di : implicitPair.second) { + cmakefileStream << " \"" << di << "\" "; + cmakefileStream << "\"" << implicitPair.first << "\"\n"; + } } - } - cmakefileStream << " )\n"; - - // Tell the dependency scanner what compiler is used. - std::string cidVar = - cmStrCat("CMAKE_", implicitLang.first, "_COMPILER_ID"); - cmProp cid = this->Makefile->GetDefinition(cidVar); - if (cmNonempty(cid)) { - cmakefileStream << "set(CMAKE_" << implicitLang.first - << "_COMPILER_ID \"" << *cid << "\")\n"; - } + cmakefileStream << " )\n"; - if (implicitLang.first == "Fortran") { - std::string smodSep = - this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_SEP"); - std::string smodExt = - this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT"); - cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_SEP \"" << smodSep - << "\")\n"; - cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_EXT \"" << smodExt - << "\")\n"; - } + // Tell the dependency scanner what compiler is used. + std::string cidVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID"); + cmProp cid = this->Makefile->GetDefinition(cidVar); + if (cmNonempty(cid)) { + cmakefileStream << "set(CMAKE_" << lang << "_COMPILER_ID \"" << *cid + << "\")\n"; + } - // Build a list of preprocessor definitions for the target. - std::set<std::string> defines; - this->GetTargetDefines(target, this->GetConfigName(), implicitLang.first, - defines); - if (!defines.empty()) { - /* clang-format off */ + if (lang == "Fortran") { + std::string smodSep = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_SEP"); + std::string smodExt = + this->Makefile->GetSafeDefinition("CMAKE_Fortran_SUBMODULE_EXT"); + cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_SEP \"" << smodSep + << "\")\n"; + cmakefileStream << "set(CMAKE_Fortran_SUBMODULE_EXT \"" << smodExt + << "\")\n"; + } + + // Build a list of preprocessor definitions for the target. + std::set<std::string> defines; + this->GetTargetDefines(target, this->GetConfigName(), lang, defines); + if (!defines.empty()) { + /* clang-format off */ cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS_" << implicitLang.first << "\n"; - /* clang-format on */ - for (std::string const& define : defines) { - cmakefileStream << " " << cmOutputConverter::EscapeForCMake(define) - << "\n"; + << "set(CMAKE_TARGET_DEFINITIONS_" << lang << "\n"; + /* clang-format on */ + for (std::string const& define : defines) { + cmakefileStream << " " << cmOutputConverter::EscapeForCMake(define) + << "\n"; + } + cmakefileStream << " )\n"; + } + + // Target-specific include directories: + cmakefileStream << "\n" + << "# The include file search paths:\n"; + cmakefileStream << "set(CMAKE_" << lang << "_TARGET_INCLUDE_PATH\n"; + std::vector<std::string> includes; + + this->GetIncludeDirectories(includes, target, lang, + this->GetConfigName()); + std::string const& binaryDir = this->GetState()->GetBinaryDirectory(); + if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) { + std::string const& sourceDir = this->GetState()->GetSourceDirectory(); + cm::erase_if(includes, ::NotInProjectDir(sourceDir, binaryDir)); + } + for (std::string const& include : includes) { + cmakefileStream << " \"" + << this->MaybeConvertToRelativePath(binaryDir, include) + << "\"\n"; } cmakefileStream << " )\n"; } - // Target-specific include directories: - cmakefileStream << "\n" - << "# The include file search paths:\n"; - cmakefileStream << "set(CMAKE_" << implicitLang.first - << "_TARGET_INCLUDE_PATH\n"; - std::vector<std::string> includes; - - this->GetIncludeDirectories(includes, target, implicitLang.first, - this->GetConfigName()); - std::string binaryDir = this->GetState()->GetBinaryDirectory(); - if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) { - std::string const& sourceDir = this->GetState()->GetSourceDirectory(); - cm::erase_if(includes, ::NotInProjectDir(sourceDir, binaryDir)); + // Store include transform rule properties. Write the directory + // rules first because they may be overridden by later target rules. + std::vector<std::string> transformRules; + if (cmProp xform = + this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) { + cmExpandList(*xform, transformRules); + } + if (cmProp xform = + target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) { + cmExpandList(*xform, transformRules); } - for (std::string const& include : includes) { - cmakefileStream << " \"" - << this->MaybeConvertToRelativePath(binaryDir, include) - << "\"\n"; + if (!transformRules.empty()) { + cmakefileStream << "\nset(CMAKE_INCLUDE_TRANSFORMS\n"; + for (std::string const& tr : transformRules) { + cmakefileStream << " " << cmOutputConverter::EscapeForCMake(tr) + << "\n"; + } + cmakefileStream << " )\n"; } - cmakefileStream << " )\n"; } - // Store include transform rule properties. Write the directory - // rules first because they may be overridden by later target rules. - std::vector<std::string> transformRules; - if (cmProp xform = - this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) { - cmExpandList(*xform, transformRules); - } - if (cmProp xform = - target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) { - cmExpandList(*xform, transformRules); - } - if (!transformRules.empty()) { - cmakefileStream << "set(CMAKE_INCLUDE_TRANSFORMS\n"; - for (std::string const& tr : transformRules) { - cmakefileStream << " " << cmOutputConverter::EscapeForCMake(tr) << "\n"; + auto const& compilerLangs = + this->GetImplicitDepends(target, cmDependencyScannerKind::Compiler); + + // list the dependency files managed by the compiler + cmakefileStream << "\n# The set of dependency files which are needed:\n"; + cmakefileStream << "set(CMAKE_DEPENDS_DEPENDENCY_FILES\n"; + for (auto const& compilerLang : compilerLangs) { + auto depFormat = this->Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", compilerLang.first, "_DEPFILE_FORMAT")); + auto const& compilerPairs = compilerLang.second; + for (auto const& compilerPair : compilerPairs) { + for (auto const& src : compilerPair.second) { + cmakefileStream << " \"" << src << "\" \"" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), compilerPair.first) + << "\" \"" << depFormat << "\" \"" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), compilerPair.first) + << ".d\"\n"; + } } - cmakefileStream << " )\n"; } + cmakefileStream << " )\n"; } void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) @@ -2049,16 +2170,18 @@ std::string cmLocalUnixMakefileGenerator3::GetTargetDirectory( } cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const& -cmLocalUnixMakefileGenerator3::GetImplicitDepends(const cmGeneratorTarget* tgt) +cmLocalUnixMakefileGenerator3::GetImplicitDepends( + const cmGeneratorTarget* tgt, cmDependencyScannerKind scanner) { - return this->ImplicitDepends[tgt->GetName()]; + return this->ImplicitDepends[tgt->GetName()][scanner]; } void cmLocalUnixMakefileGenerator3::AddImplicitDepends( const cmGeneratorTarget* tgt, const std::string& lang, - const std::string& obj, const std::string& src) + const std::string& obj, const std::string& src, + cmDependencyScannerKind scanner) { - this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src); + this->ImplicitDepends[tgt->GetName()][scanner][lang][obj].push_back(src); } void cmLocalUnixMakefileGenerator3::CreateCDCommand( diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 8286d67..14dd0ba 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -13,6 +13,7 @@ #include "cmDepends.h" #include "cmLocalCommonGenerator.h" +#include "cmLocalGenerator.h" class cmCustomCommand; class cmCustomCommandGenerator; @@ -152,23 +153,21 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. - struct ImplicitDependFileMap : public cmDepends::DependencyMap - { - }; - struct ImplicitDependLanguageMap - : public std::map<std::string, ImplicitDependFileMap> - { - }; - struct ImplicitDependTargetMap - : public std::map<std::string, ImplicitDependLanguageMap> - { - }; + using ImplicitDependFileMap = cmDepends::DependencyMap; + using ImplicitDependLanguageMap = + std::map<std::string, ImplicitDependFileMap>; + using ImplicitDependScannerMap = + std::map<cmDependencyScannerKind, ImplicitDependLanguageMap>; + using ImplicitDependTargetMap = + std::map<std::string, ImplicitDependScannerMap>; ImplicitDependLanguageMap const& GetImplicitDepends( - cmGeneratorTarget const* tgt); + cmGeneratorTarget const* tgt, + cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake); - void AddImplicitDepends(cmGeneratorTarget const* tgt, - const std::string& lang, const std::string& obj, - const std::string& src); + void AddImplicitDepends( + cmGeneratorTarget const* tgt, const std::string& lang, + const std::string& obj, const std::string& src, + cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake); // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); @@ -178,11 +177,11 @@ public: /** Get whether to create rules to generate preprocessed and assembly sources. This could be converted to a variable lookup later. */ - bool GetCreatePreprocessedSourceRules() + bool GetCreatePreprocessedSourceRules() const { return !this->SkipPreprocessedSourceRules; } - bool GetCreateAssemblySourceRules() + bool GetCreateAssemblySourceRules() const { return !this->SkipAssemblySourceRules; } diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 98f88c1..8c4b2a7 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -171,8 +171,11 @@ bool cmMacroFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, f.Functions = std::move(functions); f.FilePath = this->GetStartingContext().FilePath; mf.RecordPolicies(f.Policies); - mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f)); - return true; + return mf.GetState()->AddScriptedCommand( + this->Args[0], + BT<cmState::Command>(std::move(f), + mf.GetBacktrace().Push(this->GetStartingContext())), + mf); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0e4f888..4e93785 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -29,15 +29,12 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" -#include "cm_sys_stat.h" - #include "cmCommandArgumentParserHelper.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmExecutionStatus.h" #include "cmExpandedCommandArgument.h" // IWYU pragma: keep #include "cmExportBuildFileGenerator.h" -#include "cmFSPermissions.h" #include "cmFileLockPool.h" #include "cmFunctionBlocker.h" #include "cmGeneratedFileStream.h" @@ -72,8 +69,6 @@ class cmMessenger; -using namespace cmFSPermissions; - cmDirectoryId::cmDirectoryId(std::string s) : String(std::move(s)) { @@ -939,8 +934,6 @@ void cmMakefile::DoGenerate(cmLocalGenerator& lg) action.Value(lg, action.Backtrace); } this->GeneratorActionsInvoked = true; - this->DelayedOutputFiles.clear(); - this->DelayedOutputFilesHaveGenex = false; // go through all configured files and see which ones still exist. // we don't want cmake to re-run if a configured file is created and deleted @@ -1104,7 +1097,7 @@ cmTarget* cmMakefile::AddCustomCommandToTarget( } // Always create the byproduct sources and mark them generated. - this->CreateGeneratedByproducts(byproducts); + this->CreateGeneratedOutputs(byproducts); // Strings could be moved into the callback function with C++14. cm::optional<std::string> commentStr = MakeOptionalString(comment); @@ -1163,7 +1156,7 @@ void cmMakefile::AddCustomCommandToOutput( // Always create the output sources and mark them generated. this->CreateGeneratedOutputs(outputs); - this->CreateGeneratedByproducts(byproducts); + this->CreateGeneratedOutputs(byproducts); // Strings could be moved into the callback function with C++14. cm::optional<std::string> commentStr = MakeOptionalString(comment); @@ -1247,16 +1240,11 @@ void cmMakefile::AddCustomCommandOldStyle( } } -bool cmMakefile::AppendCustomCommandToOutput( +void cmMakefile::AppendCustomCommandToOutput( const std::string& output, const std::vector<std::string>& depends, const cmImplicitDependsList& implicit_depends, const cmCustomCommandLines& commandLines) { - // Check as good as we can if there will be a command for this output. - if (!this->MightHaveCustomCommand(output)) { - return false; - } - // Validate custom commands. if (this->ValidateCustomCommand(commandLines)) { // Dispatch command creation to allow generator expressions in outputs. @@ -1267,8 +1255,6 @@ bool cmMakefile::AppendCustomCommandToOutput( implicit_depends, commandLines); }); } - - return true; } cmUtilityOutput cmMakefile::GetUtilityOutput(cmTarget* target) @@ -1313,7 +1299,7 @@ cmTarget* cmMakefile::AddUtilityCommand( this->GetOrCreateGeneratedSource(force.Name); // Always create the byproduct sources and mark them generated. - this->CreateGeneratedByproducts(byproducts); + this->CreateGeneratedOutputs(byproducts); // Strings could be moved into the callback function with C++14. cm::optional<std::string> commentStr = MakeOptionalString(comment); @@ -1496,15 +1482,14 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) // Include transform property. There is no per-config version. { const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM"; - cmProp p = parent->GetProperty(prop); - this->SetProperty(prop, cmToCStr(p)); + this->SetProperty(prop, cmToCStr(parent->GetProperty(prop))); } // compile definitions property and per-config versions cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043); if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) { - cmProp p = parent->GetProperty("COMPILE_DEFINITIONS"); - this->SetProperty("COMPILE_DEFINITIONS", cmToCStr(p)); + this->SetProperty("COMPILE_DEFINITIONS", + cmToCStr(parent->GetProperty("COMPILE_DEFINITIONS"))); std::vector<std::string> configs = this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); for (std::string const& config : configs) { @@ -1516,12 +1501,11 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent) } // labels - cmProp p = parent->GetProperty("LABELS"); - this->SetProperty("LABELS", cmToCStr(p)); + this->SetProperty("LABELS", cmToCStr(parent->GetProperty("LABELS"))); // link libraries - p = parent->GetProperty("LINK_LIBRARIES"); - this->SetProperty("LINK_LIBRARIES", cmToCStr(p)); + this->SetProperty("LINK_LIBRARIES", + cmToCStr(parent->GetProperty("LINK_LIBRARIES"))); // the initial project name this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName()); @@ -2038,7 +2022,7 @@ void cmMakefile::RemoveDefinition(const std::string& name) #endif } -void cmMakefile::RemoveCacheDefinition(const std::string& name) +void cmMakefile::RemoveCacheDefinition(const std::string& name) const { this->GetState()->RemoveCacheEntry(name); } @@ -2154,213 +2138,6 @@ cmTarget* cmMakefile::AddNewUtilityTarget(const std::string& utilityName, } namespace { -bool AnyOutputMatches(const std::string& name, - const std::vector<std::string>& outputs) -{ - for (std::string const& output : outputs) { - std::string::size_type pos = output.rfind(name); - // If the output matches exactly - if (pos != std::string::npos && pos == output.size() - name.size() && - (pos == 0 || output[pos - 1] == '/')) { - return true; - } - } - return false; -} - -bool AnyTargetCommandOutputMatches( - const std::string& name, const std::vector<cmCustomCommand>& commands) -{ - for (cmCustomCommand const& command : commands) { - if (AnyOutputMatches(name, command.GetByproducts())) { - return true; - } - } - return false; -} -} - -cmTarget* cmMakefile::LinearGetTargetWithOutput(const std::string& name) const -{ - // We go through the ordered vector of targets to get reproducible results - // should multiple names match. - for (cmTarget* t : this->OrderedTargets) { - // Does the output of any command match the source file name? - if (AnyTargetCommandOutputMatches(name, t->GetPreBuildCommands())) { - return t; - } - if (AnyTargetCommandOutputMatches(name, t->GetPreLinkCommands())) { - return t; - } - if (AnyTargetCommandOutputMatches(name, t->GetPostBuildCommands())) { - return t; - } - } - return nullptr; -} - -cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput( - const std::string& name, cmSourceOutputKind kind, bool& byproduct) const -{ - // Outputs take precedence over byproducts. - byproduct = false; - cmSourceFile* fallback = nullptr; - - // Look through all the source files that have custom commands and see if the - // custom command has the passed source file as an output. - for (const auto& src : this->SourceFiles) { - // Does this source file have a custom command? - if (src->GetCustomCommand()) { - // Does the output of the custom command match the source file name? - if (AnyOutputMatches(name, src->GetCustomCommand()->GetOutputs())) { - // Return the first matching output. - return src.get(); - } - if (kind == cmSourceOutputKind::OutputOrByproduct) { - if (AnyOutputMatches(name, src->GetCustomCommand()->GetByproducts())) { - // Do not return the source yet as there might be a matching output. - fallback = src.get(); - } - } - } - } - - // Did we find a byproduct? - byproduct = fallback != nullptr; - return fallback; -} - -cmSourcesWithOutput cmMakefile::GetSourcesWithOutput( - const std::string& name) const -{ - // Linear search? Also see GetSourceFileWithOutput for detail. - if (!cmSystemTools::FileIsFullPath(name)) { - cmSourcesWithOutput sources; - sources.Target = this->LinearGetTargetWithOutput(name); - sources.Source = this->LinearGetSourceFileWithOutput( - name, cmSourceOutputKind::OutputOrByproduct, sources.SourceIsByproduct); - return sources; - } - // Otherwise we use an efficient lookup map. - auto o = this->OutputToSource.find(name); - if (o != this->OutputToSource.end()) { - return o->second.Sources; - } - return {}; -} - -cmSourceFile* cmMakefile::GetSourceFileWithOutput( - const std::string& name, cmSourceOutputKind kind) const -{ - // If the queried path is not absolute we use the backward compatible - // linear-time search for an output with a matching suffix. - if (!cmSystemTools::FileIsFullPath(name)) { - bool byproduct = false; - return this->LinearGetSourceFileWithOutput(name, kind, byproduct); - } - // Otherwise we use an efficient lookup map. - auto o = this->OutputToSource.find(name); - if (o != this->OutputToSource.end() && - (!o->second.Sources.SourceIsByproduct || - kind == cmSourceOutputKind::OutputOrByproduct)) { - // Source file could also be null pointer for example if we found the - // byproduct of a utility target, a PRE_BUILD, PRE_LINK, or POST_BUILD - // command of a target, or a not yet created custom command. - return o->second.Sources.Source; - } - return nullptr; -} - -bool cmMakefile::MightHaveCustomCommand(const std::string& name) const -{ - if (this->DelayedOutputFilesHaveGenex || - cmGeneratorExpression::Find(name) != std::string::npos) { - // Could be more restrictive, but for now we assume that there could always - // be a match when generator expressions are involved. - return true; - } - // Also see LinearGetSourceFileWithOutput. - if (!cmSystemTools::FileIsFullPath(name)) { - return AnyOutputMatches(name, this->DelayedOutputFiles); - } - // Otherwise we use an efficient lookup map. - auto o = this->OutputToSource.find(name); - if (o != this->OutputToSource.end()) { - return o->second.SourceMightBeOutput; - } - return false; -} - -void cmMakefile::AddTargetByproducts( - cmTarget* target, const std::vector<std::string>& byproducts) -{ - for (std::string const& o : byproducts) { - this->UpdateOutputToSourceMap(o, target); - } -} - -void cmMakefile::AddSourceOutputs(cmSourceFile* source, - const std::vector<std::string>& outputs, - const std::vector<std::string>& byproducts) -{ - for (std::string const& o : outputs) { - this->UpdateOutputToSourceMap(o, source, false); - } - for (std::string const& o : byproducts) { - this->UpdateOutputToSourceMap(o, source, true); - } -} - -void cmMakefile::UpdateOutputToSourceMap(std::string const& byproduct, - cmTarget* target) -{ - SourceEntry entry; - entry.Sources.Target = target; - - auto pr = this->OutputToSource.emplace(byproduct, entry); - if (!pr.second) { - SourceEntry& current = pr.first->second; - // Has the target already been set? - if (!current.Sources.Target) { - current.Sources.Target = target; - } else { - // Multiple custom commands/targets produce the same output (source file - // or target). See also comment in other UpdateOutputToSourceMap - // overload. - // - // TODO: Warn the user about this case. - } - } -} - -void cmMakefile::UpdateOutputToSourceMap(std::string const& output, - cmSourceFile* source, bool byproduct) -{ - SourceEntry entry; - entry.Sources.Source = source; - entry.Sources.SourceIsByproduct = byproduct; - entry.SourceMightBeOutput = !byproduct; - - auto pr = this->OutputToSource.emplace(output, entry); - if (!pr.second) { - SourceEntry& current = pr.first->second; - // Outputs take precedence over byproducts - if (!current.Sources.Source || - (current.Sources.SourceIsByproduct && !byproduct)) { - current.Sources.Source = source; - current.Sources.SourceIsByproduct = false; - current.SourceMightBeOutput = true; - } else { - // Multiple custom commands produce the same output but may - // be attached to a different source file (MAIN_DEPENDENCY). - // LinearGetSourceFileWithOutput would return the first one, - // so keep the mapping for the first one. - // - // TODO: Warn the user about this case. However, the VS 8 generator - // triggers it for separate generate.stamp rules in ZERO_CHECK and - // individual targets. - } - } } #if !defined(CMAKE_BOOTSTRAP) @@ -3055,7 +2832,7 @@ void cmMakefile::SetRecursionDepth(int recursionDepth) this->RecursionDepth = recursionDepth; } -std::string cmMakefile::NewDeferId() +std::string cmMakefile::NewDeferId() const { return this->GetGlobalGenerator()->NewDeferId(); } @@ -3629,11 +3406,7 @@ cmSourceFile* cmMakefile::CreateSource(const std::string& sourceName, bool generated, cmSourceFileLocationKind kind) { - auto sf = cm::make_unique<cmSourceFile>(this, sourceName, kind); - if (generated) { - sf->SetProperty("GENERATED", "1"); - } - + auto sf = cm::make_unique<cmSourceFile>(this, sourceName, generated, kind); auto name = this->GetCMakeInstance()->StripExtension(sf->GetLocation().GetName()); #if defined(_WIN32) || defined(__APPLE__) @@ -3665,7 +3438,7 @@ cmSourceFile* cmMakefile::GetOrCreateGeneratedSource( { cmSourceFile* sf = this->GetOrCreateSource(sourceName, true, cmSourceFileLocationKind::Known); - sf->SetProperty("GENERATED", "1"); + sf->MarkAsGenerated(); // In case we did not create the source file. return sf; } @@ -3675,38 +3448,10 @@ void cmMakefile::CreateGeneratedOutputs( for (std::string const& o : outputs) { if (cmGeneratorExpression::Find(o) == std::string::npos) { this->GetOrCreateGeneratedSource(o); - this->AddDelayedOutput(o); - } else { - this->DelayedOutputFilesHaveGenex = true; } } } -void cmMakefile::CreateGeneratedByproducts( - const std::vector<std::string>& byproducts) -{ - for (std::string const& o : byproducts) { - if (cmGeneratorExpression::Find(o) == std::string::npos) { - this->GetOrCreateGeneratedSource(o); - } - } -} - -void cmMakefile::AddDelayedOutput(std::string const& output) -{ - // Note that this vector might contain the output names in a different order - // than in source file iteration order. - this->DelayedOutputFiles.push_back(output); - - SourceEntry entry; - entry.SourceMightBeOutput = true; - - auto pr = this->OutputToSource.emplace(output, entry); - if (!pr.second) { - pr.first->second.SourceMightBeOutput = true; - } -} - void cmMakefile::AddTargetObject(std::string const& tgtName, std::string const& objFile) { @@ -4094,8 +3839,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output, int cmMakefile::ConfigureFile(const std::string& infile, const std::string& outfile, bool copyonly, bool atOnly, bool escapeQuotes, - bool use_source_permissions, - cmNewLineStyle newLine) + mode_t permissions, cmNewLineStyle newLine) { int res = 1; if (!this->CanIWriteThisFile(outfile)) { @@ -4117,12 +3861,8 @@ int cmMakefile::ConfigureFile(const std::string& infile, // output files that now don't exist. this->AddCMakeOutputFile(soutfile); - mode_t perm = 0; - if (!use_source_permissions) { - perm = perm | mode_owner_read | mode_owner_write | mode_group_read | - mode_world_read; - } else { - cmSystemTools::GetPermissions(sinfile, perm); + if (permissions == 0) { + cmSystemTools::GetPermissions(sinfile, permissions); } std::string::size_type pos = soutfile.rfind('/'); @@ -4137,7 +3877,7 @@ int cmMakefile::ConfigureFile(const std::string& infile, cmSystemTools::GetLastSystemError()); return 0; } - if (!cmSystemTools::SetPermissions(soutfile, perm)) { + if (!cmSystemTools::SetPermissions(soutfile, permissions)) { this->IssueMessage(MessageType::FATAL_ERROR, cmSystemTools::GetLastSystemError()); return 0; @@ -4194,7 +3934,7 @@ int cmMakefile::ConfigureFile(const std::string& infile, cmSystemTools::GetLastSystemError()); res = 0; } else { - if (!cmSystemTools::SetPermissions(soutfile, perm)) { + if (!cmSystemTools::SetPermissions(soutfile, permissions)) { this->IssueMessage(MessageType::FATAL_ERROR, cmSystemTools::GetLastSystemError()); res = 0; @@ -4283,7 +4023,7 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const } void cmMakefile::GetTests(const std::string& config, - std::vector<cmTest*>& tests) + std::vector<cmTest*>& tests) const { for (const auto& generator : this->GetTestGenerators()) { if (generator->TestsForConfig(config)) { @@ -4633,7 +4373,7 @@ cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id, return this->StateSnapshot.GetPolicy(id, parent_scope); } -bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) +bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) const { // Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting. if (cmProp val = this->GetDefinition(var)) { @@ -4670,7 +4410,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0072 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0075 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. @@ -4738,7 +4478,7 @@ bool cmMakefile::HasCMP0054AlreadyBeenReported( return !this->CMP0054ReportedIds.insert(context).second; } -void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) +void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm) const { /* Record the setting of every policy. */ using PolicyID = cmPolicies::PolicyID; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c7940fb..a864074 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,6 +20,8 @@ #include "cmsys/RegularExpression.hxx" +#include "cm_sys_stat.h" + #include "cmAlgorithms.h" #include "cmCustomCommandTypes.h" #include "cmListFileCache.h" @@ -59,24 +61,6 @@ class cmTestGenerator; class cmVariableWatch; class cmake; -/** Flag if byproducts shall also be considered. */ -enum class cmSourceOutputKind -{ - OutputOnly, - OutputOrByproduct -}; - -/** Target and source file which have a specific output. */ -struct cmSourcesWithOutput -{ - /** Target with byproduct. */ - cmTarget* Target = nullptr; - - /** Source file with output or byproduct. */ - cmSourceFile* Source = nullptr; - bool SourceIsByproduct = false; -}; - /** A type-safe wrapper for a string representing a directory id. */ class cmDirectoryId { @@ -225,25 +209,12 @@ public: const std::string& source, const cmCustomCommandLines& commandLines, const char* comment); - bool AppendCustomCommandToOutput( + void AppendCustomCommandToOutput( const std::string& output, const std::vector<std::string>& depends, const cmImplicitDependsList& implicit_depends, const cmCustomCommandLines& commandLines); /** - * Add target byproducts. - */ - void AddTargetByproducts(cmTarget* target, - const std::vector<std::string>& byproducts); - - /** - * Add source file outputs. - */ - void AddSourceOutputs(cmSourceFile* source, - const std::vector<std::string>& outputs, - const std::vector<std::string>& byproducts); - - /** * Add a define flag to the build. */ void AddDefineFlag(std::string const& definition); @@ -335,7 +306,7 @@ public: */ void RemoveDefinition(const std::string& name); //! Remove a definition from the cache. - void RemoveCacheDefinition(const std::string& name); + void RemoveCacheDefinition(const std::string& name) const; /** * Specify the name of the project for this build. @@ -376,7 +347,7 @@ public: bool parent_scope = false) const; bool SetPolicyVersion(std::string const& version_min, std::string const& version_max); - void RecordPolicies(cmPolicies::PolicyMap& pm); + void RecordPolicies(cmPolicies::PolicyMap& pm) const; //@} /** Helper class to push and pop policies automatically. */ @@ -430,8 +401,7 @@ public: } const char* GetIncludeRegularExpression() const { - cmProp p = this->GetProperty("INCLUDE_REGULAR_EXPRESSION"); - return p ? p->c_str() : nullptr; + return cmToCStr(this->GetProperty("INCLUDE_REGULAR_EXPRESSION")); } /** @@ -690,8 +660,7 @@ public: */ int ConfigureFile(const std::string& infile, const std::string& outfile, bool copyonly, bool atOnly, bool escapeQuotes, - bool use_source_permissions, - cmNewLineStyle = cmNewLineStyle()); + mode_t permissions = 0, cmNewLineStyle = cmNewLineStyle()); /** * Print a command's invocation @@ -753,20 +722,10 @@ public: return this->SourceFiles; } - /** - * Return the target if the provided source name is a byproduct of a utility - * target or a PRE_BUILD, PRE_LINK, or POST_BUILD command. - * Return the source file which has the provided source name as output. - */ - cmSourcesWithOutput GetSourcesWithOutput(const std::string& name) const; - - /** - * Is there a source file that has the provided source name as an output? - * If so then return it. - */ - cmSourceFile* GetSourceFileWithOutput( - const std::string& name, - cmSourceOutputKind kind = cmSourceOutputKind::OutputOnly) const; + std::vector<cmTarget*> const& GetOrderedTargets() const + { + return this->OrderedTargets; + } //! Add a new cmTest to the list of tests for this makefile. cmTest* CreateTest(const std::string& testName); @@ -779,7 +738,7 @@ public: /** * Get all tests that run under the given configuration. */ - void GetTests(const std::string& config, std::vector<cmTest*>& tests); + void GetTests(const std::string& config, std::vector<cmTest*>& tests) const; /** * Return a location of a file in cmake or custom modules directory @@ -926,7 +885,7 @@ public: return this->SystemIncludeDirectories; } - bool PolicyOptionalWarningEnabled(std::string const& var); + bool PolicyOptionalWarningEnabled(std::string const& var) const; void PushLoopBlock(); void PopLoopBlock(); @@ -967,7 +926,7 @@ public: int GetRecursionDepth() const; void SetRecursionDepth(int recursionDepth); - std::string NewDeferId(); + std::string NewDeferId() const; bool DeferCall(std::string id, std::string fileName, cmListFileFunction lff); bool DeferCancelCall(std::string const& id); cm::optional<std::string> DeferGetCallIds() const; @@ -983,8 +942,7 @@ protected: mutable cmTargetMap Targets; std::map<std::string, std::string> AliasTargets; - using TargetsVec = std::vector<cmTarget*>; - TargetsVec OrderedTargets; + std::vector<cmTarget*> OrderedTargets; std::vector<std::unique_ptr<cmSourceFile>> SourceFiles; @@ -1129,48 +1087,9 @@ private: bool ValidateCustomCommand(const cmCustomCommandLines& commandLines) const; void CreateGeneratedOutputs(const std::vector<std::string>& outputs); - void CreateGeneratedByproducts(const std::vector<std::string>& byproducts); std::vector<BT<GeneratorAction>> GeneratorActions; bool GeneratorActionsInvoked = false; - bool DelayedOutputFilesHaveGenex = false; - std::vector<std::string> DelayedOutputFiles; - - void AddDelayedOutput(std::string const& output); - - /** - * See LinearGetSourceFileWithOutput for background information - */ - cmTarget* LinearGetTargetWithOutput(const std::string& name) const; - - /** - * Generalized old version of GetSourceFileWithOutput kept for - * backward-compatibility. It implements a linear search and supports - * relative file paths. It is used as a fall back by GetSourceFileWithOutput - * and GetSourcesWithOutput. - */ - cmSourceFile* LinearGetSourceFileWithOutput(const std::string& name, - cmSourceOutputKind kind, - bool& byproduct) const; - - struct SourceEntry - { - cmSourcesWithOutput Sources; - bool SourceMightBeOutput = false; - }; - - // A map for fast output to input look up. - using OutputToSourceMap = std::unordered_map<std::string, SourceEntry>; - OutputToSourceMap OutputToSource; - - void UpdateOutputToSourceMap(std::string const& byproduct, cmTarget* target); - void UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source, - bool byproduct); - - /** - * Return if the provided source file might have a custom command. - */ - bool MightHaveCustomCommand(const std::string& name) const; bool CheckSystemVars; bool CheckCMP0000; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 871878c..1750e37 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -21,6 +21,7 @@ #include "cmMakefile.h" #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmState.h" #include "cmStateDirectory.h" @@ -232,10 +233,10 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule( std::string launcher; - const char* val = this->LocalGenerator->GetRuleLauncher( - this->GeneratorTarget, "RULE_LAUNCH_LINK"); + cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, + "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -591,10 +592,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string launcher; - const char* val = this->LocalGenerator->GetRuleLauncher( - this->GeneratorTarget, "RULE_LAUNCH_LINK"); + cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, + "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b32ea6a..ce64e2c 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -21,6 +21,7 @@ #include "cmMakefile.h" #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" +#include "cmProperty.h" #include "cmRulePlaceholderExpander.h" #include "cmState.h" #include "cmStateDirectory.h" @@ -366,10 +367,10 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules( vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); std::string launcher; - const char* val = this->LocalGenerator->GetRuleLauncher( - this->GeneratorTarget, "RULE_LAUNCH_LINK"); + cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, + "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -816,10 +817,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars.LanguageCompileFlags = langFlags.c_str(); std::string launcher; - const char* val = this->LocalGenerator->GetRuleLauncher( - this->GeneratorTarget, "RULE_LAUNCH_LINK"); + cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, + "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3776fec..ee47e46 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -12,7 +12,9 @@ #include <utility> #include <cm/memory> +#include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -23,6 +25,7 @@ #include "cmGlobalUnixMakefileGenerator3.h" #include "cmLinkLineComputer.h" // IWYU pragma: keep #include "cmLocalCommonGenerator.h" +#include "cmLocalGenerator.h" #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" #include "cmMakefileExecutableTargetGenerator.h" @@ -325,7 +328,45 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() << cmSystemTools::ConvertToOutputPath( this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull)) - << "\n\n"; + << "\n"; + + std::string depsUseCompiler = "CMAKE_DEPENDS_USE_COMPILER"; + if (!this->Makefile->IsDefinitionSet(depsUseCompiler) || + this->Makefile->IsOn(depsUseCompiler)) { + std::string compilerDependFile = + cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.make"); + *this->BuildFileStream + << "# Include any dependencies generated by the " + "compiler for this target.\n" + << this->GlobalGenerator->IncludeDirective << " " << root + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator->MaybeConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), compilerDependFile)) + << "\n\n"; + + if (!cmSystemTools::FileExists(compilerDependFile)) { + // Write an empty dependency file. + cmGeneratedFileStream depFileStream( + compilerDependFile, false, + this->GlobalGenerator->GetMakefileEncoding()); + depFileStream << "# Empty compiler generated dependencies file for " + << this->GeneratorTarget->GetName() << ".\n" + << "# This may be replaced when dependencies are built.\n"; + } + + std::string compilerDependTimestamp = + cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts"); + if (!cmSystemTools::FileExists(compilerDependTimestamp)) { + // Write a dependency timestamp file. + cmGeneratedFileStream depFileStream( + compilerDependTimestamp, false, + this->GlobalGenerator->GetMakefileEncoding()); + depFileStream << "# CMAKE generated file: DO NOT EDIT!\n" + << "# Timestamp file for compiler generated dependencies " + "management for " + << this->GeneratorTarget->GetName() << ".\n"; + } + } if (!this->NoRuleMessages) { // Include the progress variables for the target. @@ -472,6 +513,14 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( return; } + // Use compiler to generate dependencies, if supported. + bool compilerGenerateDeps = + this->GlobalGenerator->SupportsCompilerDependencies() && + cmIsOn(this->Makefile->GetDefinition( + cmStrCat("CMAKE_", lang, "_DEPENDS_USE_COMPILER"))); + auto scanner = compilerGenerateDeps ? cmDependencyScannerKind::Compiler + : cmDependencyScannerKind::CMake; + // Get the full path name of the object file. std::string const& objectName = this->GeneratorTarget->GetObjectName(&source); @@ -511,7 +560,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( std::string srcFullPath = cmSystemTools::CollapseFullPath(source.GetFullPath()); this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang, - objFullPath, srcFullPath); + objFullPath, srcFullPath, scanner); this->LocalGenerator->AppendRuleDepend(depends, this->FlagFileNameFull.c_str()); @@ -553,8 +602,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( depends.push_back( this->GeneratorTarget->GetPchFile(config, lang, arch)); } - this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, lang, - objFullPath, pchHeader); + this->LocalGenerator->AddImplicitDepends( + this->GeneratorTarget, lang, objFullPath, pchHeader, scanner); } } @@ -573,6 +622,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Build the set of compiler flags. std::string flags; + // Explicitly add the explicit language flag before any other flag + // so user flags can override it. + this->GeneratorTarget->AddExplicitLanguageFlags(flags, source); + // Add language-specific flags. std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")"); this->LocalGenerator->AppendFlags(flags, langFlags); @@ -688,7 +741,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( source.GetFullPath(), cmOutputConverter::SHELL); // Construct the build message. - std::vector<std::string> no_commands; + std::vector<std::string> no_depends; std::vector<std::string> commands; // add in a progress call if needed @@ -782,13 +835,33 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( "$(" + lang + "_INCLUDES)"); vars.Includes = includesString.c_str(); + std::string dependencyTarget; + std::string shellDependencyFile; + std::string dependencyTimestamp; + if (compilerGenerateDeps) { + dependencyTarget = this->LocalGenerator->EscapeForShell( + this->LocalGenerator->ConvertToMakefilePath( + this->LocalGenerator->MaybeConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), relativeObj))); + vars.DependencyTarget = dependencyTarget.c_str(); + + auto depFile = cmStrCat(obj, ".d"); + shellDependencyFile = this->LocalGenerator->ConvertToOutputFormat( + depFile, cmOutputConverter::SHELL); + vars.DependencyFile = shellDependencyFile.c_str(); + + dependencyTimestamp = this->LocalGenerator->MaybeConvertToRelativePath( + this->LocalGenerator->GetBinaryDirectory(), + cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts")); + } + // At the moment, it is assumed that C, C++, Fortran, and CUDA have both // assembly and preprocessor capabilities. The same is true for the // ability to export compile commands bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") || (lang == "OBJC") || (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA") || - lang == "ISPC"); + lang == "ISPC" || lang == "ASM"); bool const lang_has_assembly = lang_has_preprocessor; bool const lang_can_export_cmds = lang_has_preprocessor; @@ -870,15 +943,21 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( } // Maybe insert an include-what-you-use runner. - if (!compileCommands.empty() && (lang == "C" || lang == "CXX")) { - std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE"; - cmProp iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); + if (!compileCommands.empty() && + (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX")) { std::string const tidy_prop = lang + "_CLANG_TIDY"; cmProp tidy = this->GeneratorTarget->GetProperty(tidy_prop); - std::string const cpplint_prop = lang + "_CPPLINT"; - cmProp cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); - std::string const cppcheck_prop = lang + "_CPPCHECK"; - cmProp cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); + cmProp iwyu = nullptr; + cmProp cpplint = nullptr; + cmProp cppcheck = nullptr; + if (lang == "C" || lang == "CXX") { + std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE"; + iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); + std::string const cpplint_prop = lang + "_CPPLINT"; + cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + std::string const cppcheck_prop = lang + "_CPPCHECK"; + cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); + } if (cmNonempty(iwyu) || cmNonempty(tidy) || cmNonempty(cpplint) || cmNonempty(cppcheck)) { std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_co_compile"; @@ -940,10 +1019,57 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( std::string launcher; { - const char* val = this->LocalGenerator->GetRuleLauncher( + cmProp val = this->LocalGenerator->GetRuleLauncher( this->GeneratorTarget, "RULE_LAUNCH_COMPILE"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); + } + } + + std::string flagsWithDeps(flags); + + if (compilerGenerateDeps) { + // Injects dependency computation + auto depFlags = this->Makefile->GetSafeDefinition( + cmStrCat("CMAKE_DEPFILE_FLAGS_", lang)); + + if (!depFlags.empty()) { + // Add dependency flags + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + depFlags, vars); + flagsWithDeps.append(1, ' '); + flagsWithDeps.append(depFlags); + } + vars.Flags = flagsWithDeps.c_str(); + + const auto& extraCommands = this->Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_DEPENDS_EXTRA_COMMANDS")); + if (!extraCommands.empty()) { + auto commandList = cmExpandedList(extraCommands); + compileCommands.insert(compileCommands.end(), commandList.cbegin(), + commandList.cend()); + } + + const auto& depFormat = this->Makefile->GetRequiredDefinition( + cmStrCat("CMAKE_", lang, "_DEPFILE_FORMAT")); + + if (depFormat == "msvc"_s) { + // compiler must be launched through a wrapper to pick-up dependencies + std::string depFilter = + "$(CMAKE_COMMAND) -E cmake_cl_compile_depends "; + depFilter += cmStrCat("--dep-file=", shellDependencyFile); + depFilter += + cmStrCat(" --working-dir=", + this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->GetCurrentBinaryDirectory(), + cmOutputConverter::SHELL)); + const auto& prefix = this->Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_CL_SHOWINCLUDES_PREFIX")); + depFilter += cmStrCat(" --filter-prefix=", + this->LocalGenerator->ConvertToOutputFormat( + prefix, cmOutputConverter::SHELL)); + depFilter += " -- "; + compileCommands.front().insert(0, depFilter); } } @@ -972,8 +1098,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( cmExpandList(evaluated_outputs, outputs); } } - if (!ispcHeaderRelative - .empty()) { // can't move ispcHeader as vars is using it + if (!ispcHeaderRelative.empty()) { + // can't move ispcHeader as vars is using it outputs.emplace_back(ispcHeaderRelative); } @@ -981,10 +1107,19 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( this->CleanFiles.insert(outputs.begin() + 1, outputs.end()); } + if (compilerGenerateDeps) { + depends.push_back(dependencyTimestamp); + } + // Write the rule. this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs, depends, commands); + if (compilerGenerateDeps) { + // set back flags without dependency generation + vars.Flags = flags.c_str(); + } + bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); bool do_assembly_rules = @@ -1381,10 +1516,10 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule( std::string registerFileCmd; - // The generated register file contains macros that when expanded register - // the device routines. Because the routines are the same for all - // architectures the register file will be the same too. Thus generate it - // only on the first invocation to reduce overhead. + // The generated register file contains macros that when expanded + // register the device routines. Because the routines are the same for + // all architectures the register file will be the same too. Thus + // generate it only on the first invocation to reduce overhead. if (fatbinaryDepends.size() == 1) { std::string registerFileRel = this->LocalGenerator->MaybeConvertToRelativePath( @@ -1419,7 +1554,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule( fatbinaryOutputRel, fatbinaryDepends, { fatbinaryCommand }, false); - // Compile the stub that registers the kernels and contains the fatbinaries. + // Compile the stub that registers the kernels and contains the + // fatbinaries. cmRulePlaceholderExpander::RuleVariables vars; vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str(); vars.CMTargetType = @@ -1537,12 +1673,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( << this->GeneratorTarget->GetName() << "\n" << variableName << " ="; std::string object; - std::string lineContinue; - if (cmProp p = this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE")) { - lineContinue = *p; - } else { - lineContinue = "\\"; - } + const auto& lineContinue = this->GlobalGenerator->LineContinueDirective; cmProp pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION"); @@ -1550,7 +1681,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( if (cmSystemTools::StringEndsWith(obj, cmToCStr(pchExtension))) { continue; } - *this->BuildFileStream << " " << lineContinue << "\n"; + *this->BuildFileStream << " " << lineContinue; *this->BuildFileStream << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( obj, useWatcomQuote); @@ -1573,7 +1704,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( for (std::string const& obj : this->ExternalObjects) { object = this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, obj); - *this->BuildFileStream << " " << lineContinue << "\n"; + *this->BuildFileStream << " " << lineContinue; *this->BuildFileStream << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( obj, useWatcomQuote); @@ -1837,9 +1968,9 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects( if (size_t const limit = cmSystemTools::CalculateCommandLineLengthLimit()) { // Compute the total length of our list of object files with room // for argument separation and quoting. This does not convert paths - // relative to CMAKE_CURRENT_BINARY_DIR like the final list will be, so the - // actual list will likely be much shorter than this. However, in the - // worst case all objects will remain as absolute paths. + // relative to CMAKE_CURRENT_BINARY_DIR like the final list will be, so + // the actual list will likely be much shorter than this. However, in + // the worst case all objects will remain as absolute paths. size_t length = 0; for (std::string const& obj : this->Objects) { length += obj.size() + 3; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index ccb959b..a5b9466 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -266,10 +266,10 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule( vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS"; std::string launcher; - const char* val = this->GetLocalGenerator()->GetRuleLauncher( + cmProp val = this->GetLocalGenerator()->GetRuleLauncher( this->GetGeneratorTarget(), "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -452,10 +452,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, } std::string launcher; - const char* val = this->GetLocalGenerator()->GetRuleLauncher( + cmProp val = this->GetLocalGenerator()->GetRuleLauncher( this->GetGeneratorTarget(), "RULE_LAUNCH_LINK"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 662399e..838cf4c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -12,7 +12,9 @@ #include <utility> #include <cm/memory> +#include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include <cm3p/json/value.h> #include <cm3p/json/writer.h> @@ -105,7 +107,7 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule( '_', config); } -std::string cmNinjaTargetGenerator::LanguagePreprocessRule( +std::string cmNinjaTargetGenerator::LanguagePreprocessAndScanRule( std::string const& lang, const std::string& config) const { return cmStrCat( @@ -114,7 +116,7 @@ std::string cmNinjaTargetGenerator::LanguagePreprocessRule( '_', config); } -std::string cmNinjaTargetGenerator::LanguageDependencyRule( +std::string cmNinjaTargetGenerator::LanguageScanRule( std::string const& lang, const std::string& config) const { return cmStrCat( @@ -129,14 +131,7 @@ bool cmNinjaTargetGenerator::NeedExplicitPreprocessing( return lang == "Fortran"; } -bool cmNinjaTargetGenerator::UsePreprocessedSource( - std::string const& lang) const -{ - return lang == "Fortran"; -} - -bool cmNinjaTargetGenerator::CompilePreprocessedSourceWithDefines( - std::string const& lang) const +bool cmNinjaTargetGenerator::CompileWithDefines(std::string const& lang) const { return this->Makefile->IsOn( cmStrCat("CMAKE_", lang, "_COMPILE_WITH_DEFINES")); @@ -190,7 +185,15 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject( } } - std::string flags = this->GetFlags(language, config, filterArch); + std::string flags; + // Explicitly add the explicit language flag before any other flag + // so user flags can override it. + this->GeneratorTarget->AddExplicitLanguageFlags(flags, *source); + + if (!flags.empty()) { + flags += " "; + } + flags += this->GetFlags(language, config, filterArch); // Add Fortran format flags. if (language == "Fortran") { @@ -252,32 +255,6 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, this->LocalGenerator->AppendFlags(languageFlags, includeFlags); } -bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const -{ - std::string const& deptype = this->GetMakefile()->GetSafeDefinition( - cmStrCat("CMAKE_NINJA_DEPTYPE_", lang)); - if (deptype == "msvc") { - return true; - } - if (deptype == "intel") { - // Ninja does not really define "intel", but we use it to switch based - // on whether this environment supports "gcc" or "msvc" deptype. - if (!this->GetGlobalGenerator()->SupportsMultilineDepfile()) { - // This ninja version is too old to support the Intel depfile format. - // Fall back to msvc deptype. - return true; - } - if ((this->Makefile->GetHomeDirectory().find(' ') != std::string::npos) || - (this->Makefile->GetHomeOutputDirectory().find(' ') != - std::string::npos)) { - // The Intel compiler does not properly escape spaces in a depfile. - // Fall back to msvc deptype. - return true; - } - } - return false; -} - // TODO: Refactor with // void cmMakefileTargetGenerator::WriteTargetLanguageFlags(). std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source, @@ -527,82 +504,61 @@ namespace { // Create the command to run the dependency scanner std::string GetScanCommand(const std::string& cmakeCmd, const std::string& tdi, const std::string& lang, const std::string& ppFile, - bool needDyndep, const std::string& ddiFile) + const std::string& ddiFile) { - std::string ccmd = - cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi, " --lang=", lang, - " --pp=", ppFile, " --dep=$DEP_FILE"); - if (needDyndep) { - ccmd = cmStrCat(ccmd, " --obj=$OBJ_FILE --ddi=", ddiFile); - } - return ccmd; + return cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi, + " --lang=", lang, " --src=$in", " --pp=", ppFile, + " --dep=$DEP_FILE --obj=$OBJ_FILE --ddi=", ddiFile); } -// Helper function to create dependency scanning rule, with optional -// explicit preprocessing step if preprocessCommand is non-empty -cmNinjaRule GetPreprocessScanRule( - const std::string& ruleName, cmRulePlaceholderExpander::RuleVariables& vars, +// Helper function to create dependency scanning rule that may or may +// not perform explicit preprocessing too. +cmNinjaRule GetScanRule( + const std::string& ruleName, + cmRulePlaceholderExpander::RuleVariables const& vars, const std::string& responseFlag, const std::string& flags, - const std::string& launcher, cmRulePlaceholderExpander* const rulePlaceholderExpander, - std::string scanCommand, cmLocalNinjaGenerator* generator, - const std::string& preprocessCommand = "") + cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds) { cmNinjaRule rule(ruleName); - // Explicit preprocessing always uses a depfile. + // Scanning always uses a depfile for preprocessor dependencies. rule.DepType = ""; // no deps= for multiple outputs rule.DepFile = "$DEP_FILE"; - cmRulePlaceholderExpander::RuleVariables ppVars; - ppVars.CMTargetName = vars.CMTargetName; - ppVars.CMTargetType = vars.CMTargetType; - ppVars.Language = vars.Language; - ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE - ppVars.PreprocessedSource = "$out"; - ppVars.DependencyFile = rule.DepFile.c_str(); - - // Preprocessing uses the original source, compilation uses - // preprocessed output or original source - ppVars.Source = vars.Source; - vars.Source = "$in"; - - // Copy preprocessor definitions to the preprocessor rule. - ppVars.Defines = vars.Defines; + cmRulePlaceholderExpander::RuleVariables scanVars; + scanVars.CMTargetName = vars.CMTargetName; + scanVars.CMTargetType = vars.CMTargetType; + scanVars.Language = vars.Language; + scanVars.Object = "$out"; // for RULE_LAUNCH_COMPILE + scanVars.PreprocessedSource = "$out"; + scanVars.DependencyFile = rule.DepFile.c_str(); + scanVars.DependencyTarget = "$out"; - // Copy include directories to the preprocessor rule. The Fortran - // compilation rule still needs them for the INCLUDE directive. - ppVars.Includes = vars.Includes; + // Scanning needs the same preprocessor settings as direct compilation would. + scanVars.Source = vars.Source; + scanVars.Defines = vars.Defines; + scanVars.Includes = vars.Includes; - // Preprocessing and compilation use the same flags. - std::string ppFlags = flags; + // Scanning needs the compilation flags too. + std::string scanFlags = flags; // If using a response file, move defines, includes, and flags into it. if (!responseFlag.empty()) { rule.RspFile = "$RSP_FILE"; rule.RspContent = - cmStrCat(' ', ppVars.Defines, ' ', ppVars.Includes, ' ', ppFlags); - ppFlags = cmStrCat(responseFlag, rule.RspFile); - ppVars.Defines = ""; - ppVars.Includes = ""; + cmStrCat(' ', scanVars.Defines, ' ', scanVars.Includes, ' ', scanFlags); + scanFlags = cmStrCat(responseFlag, rule.RspFile); + scanVars.Defines = ""; + scanVars.Includes = ""; } - ppVars.Flags = ppFlags.c_str(); - - // Rule for preprocessing source file. - std::vector<std::string> ppCmds; + scanVars.Flags = scanFlags.c_str(); - if (!preprocessCommand.empty()) { - // Lookup the explicit preprocessing rule. - cmExpandList(preprocessCommand, ppCmds); - for (std::string& i : ppCmds) { - i = cmStrCat(launcher, i); - rulePlaceholderExpander->ExpandRuleVariables(generator, i, ppVars); - } + // Rule for scanning a source file. + for (std::string& scanCmd : scanCmds) { + rulePlaceholderExpander->ExpandRuleVariables(generator, scanCmd, scanVars); } - - // Run CMake dependency scanner on either preprocessed output or source file - ppCmds.emplace_back(std::move(scanCommand)); - rule.Command = generator->BuildCommandLine(ppCmds); + rule.Command = generator->BuildCommandLine(scanCmds); return rule; } @@ -628,11 +584,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, cmMakefile* mf = this->GetMakefile(); - // For some cases we do an explicit preprocessor invocation. - bool const explicitPP = this->NeedExplicitPreprocessing(lang); - bool const compilePPWithDefines = this->UsePreprocessedSource(lang) && - this->CompilePreprocessedSourceWithDefines(lang); + // For some cases we scan to dynamically discover dependencies. bool const needDyndep = this->NeedDyndep(lang); + bool const compilationPreprocesses = !this->NeedExplicitPreprocessing(lang); std::string flags = "$FLAGS"; @@ -655,56 +609,68 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, cmLocalGenerator::SHELL); std::string launcher; - const char* val = this->GetLocalGenerator()->GetRuleLauncher( + cmProp val = this->GetLocalGenerator()->GetRuleLauncher( this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE"); if (cmNonempty(val)) { - launcher = cmStrCat(val, ' '); + launcher = cmStrCat(*val, ' '); } std::string const cmakeCmd = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - if (explicitPP) { - // Combined preprocessing and dependency scanning - const auto ppScanCommand = GetScanCommand( - cmakeCmd, tdi, lang, "$out", needDyndep, "$DYNDEP_INTERMEDIATE_FILE"); - const auto ppVar = cmStrCat("CMAKE_", lang, "_PREPROCESS_SOURCE"); - - auto ppRule = GetPreprocessScanRule( - this->LanguagePreprocessRule(lang, config), vars, responseFlag, flags, - launcher, rulePlaceholderExpander.get(), ppScanCommand, - this->GetLocalGenerator(), mf->GetRequiredDefinition(ppVar)); + if (needDyndep) { + // Rule to scan dependencies of sources that need preprocessing. + { + std::vector<std::string> scanCommands; + std::string const& scanRuleName = + this->LanguagePreprocessAndScanRule(lang, config); + std::string const& ppCommmand = mf->GetRequiredDefinition( + cmStrCat("CMAKE_", lang, "_PREPROCESS_SOURCE")); + cmExpandList(ppCommmand, scanCommands); + for (std::string& i : scanCommands) { + i = cmStrCat(launcher, i); + } + scanCommands.emplace_back(GetScanCommand(cmakeCmd, tdi, lang, "$out", + "$DYNDEP_INTERMEDIATE_FILE")); - // Write the rule for preprocessing file of the given language. - ppRule.Comment = cmStrCat("Rule for preprocessing ", lang, " files."); - ppRule.Description = cmStrCat("Building ", lang, " preprocessed $out"); + auto scanRule = GetScanRule( + scanRuleName, vars, responseFlag, flags, rulePlaceholderExpander.get(), + this->GetLocalGenerator(), std::move(scanCommands)); - this->GetGlobalGenerator()->AddRule(ppRule); + scanRule.Comment = + cmStrCat("Rule for generating ", lang, " dependencies."); + scanRule.Description = cmStrCat("Building ", lang, " preprocessed $out"); - if (!compilePPWithDefines) { - // Remove preprocessor definitions from compilation step - vars.Defines = ""; + this->GetGlobalGenerator()->AddRule(scanRule); } - // Just dependency scanning for files that have preprocessing turned off - const auto scanCommand = - GetScanCommand(cmakeCmd, tdi, lang, "$in", needDyndep, "$out"); + { + // Compilation will not preprocess, so it does not need the defines + // unless the compiler wants them for some other purpose. + if (!this->CompileWithDefines(lang)) { + vars.Defines = ""; + } - auto scanRule = GetPreprocessScanRule( - this->LanguageDependencyRule(lang, config), vars, "", flags, launcher, - rulePlaceholderExpander.get(), scanCommand, this->GetLocalGenerator()); + // Rule to scan dependencies of sources that do not need preprocessing. + std::string const& scanRuleName = this->LanguageScanRule(lang, config); + std::vector<std::string> scanCommands; + scanCommands.emplace_back( + GetScanCommand(cmakeCmd, tdi, lang, "$in", "$out")); - // Write the rule for generating dependencies for the given language. - scanRule.Comment = cmStrCat("Rule for generating ", lang, - " dependencies on non-preprocessed files."); - scanRule.Description = - cmStrCat("Generating ", lang, " dependencies for $in"); + auto scanRule = GetScanRule( + scanRuleName, vars, "", flags, rulePlaceholderExpander.get(), + this->GetLocalGenerator(), std::move(scanCommands)); - this->GetGlobalGenerator()->AddRule(scanRule); - } + // Write the rule for generating dependencies for the given language. + scanRule.Comment = cmStrCat("Rule for generating ", lang, + " dependencies on non-preprocessed files."); + scanRule.Description = + cmStrCat("Generating ", lang, " dependencies for $in"); + + this->GetGlobalGenerator()->AddRule(scanRule); + } - if (needDyndep) { // Write the rule for ninja dyndep file generation. cmNinjaRule rule(this->LanguageDyndepRule(lang, config)); // Command line length is almost always limited -> use response file for @@ -743,12 +709,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, // Tell ninja dependency format so all deps can be loaded into a database std::string cldeps; - if (explicitPP) { - // The explicit preprocessing step will handle dependency scanning. - } else if (this->NeedDepTypeMSVC(lang)) { - rule.DepType = "msvc"; - rule.DepFile.clear(); - flags += " /showIncludes"; + if (!compilationPreprocesses) { + // The compiler will not do preprocessing, so it has no such dependencies. } else if (mf->IsOn(cmStrCat("CMAKE_NINJA_CMCLDEPS_", lang))) { // For the MS resource compiler we need cmcldeps, but skip dependencies // for source-file try_compile cases because they are always fresh. @@ -764,16 +726,23 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, "\" \"", cl, "\" "); } } else { - rule.DepType = "gcc"; - rule.DepFile = "$DEP_FILE"; + const auto& depType = this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_DEPFILE_FORMAT")); + if (depType == "msvc"_s) { + rule.DepType = "msvc"; + rule.DepFile.clear(); + } else { + rule.DepType = "gcc"; + rule.DepFile = "$DEP_FILE"; + } + vars.DependencyFile = rule.DepFile.c_str(); + vars.DependencyTarget = "$out"; + const std::string flagsName = cmStrCat("CMAKE_DEPFILE_FLAGS_", lang); std::string depfileFlags = mf->GetSafeDefinition(flagsName); if (!depfileFlags.empty()) { - cmSystemTools::ReplaceString(depfileFlags, "<DEPFILE>", "$DEP_FILE"); - cmSystemTools::ReplaceString(depfileFlags, "<OBJECT>", "$out"); - cmSystemTools::ReplaceString( - depfileFlags, "<CMAKE_C_COMPILER>", - cmToCStr(mf->GetDefinition("CMAKE_C_COMPILER"))); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), + depfileFlags, vars); flags += cmStrCat(' ', depfileFlags); } } @@ -815,15 +784,21 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, } // Maybe insert an include-what-you-use runner. - if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) { - std::string const iwyu_prop = cmStrCat(lang, "_INCLUDE_WHAT_YOU_USE"); - cmProp iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); + if (!compileCmds.empty() && + (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX")) { std::string const tidy_prop = cmStrCat(lang, "_CLANG_TIDY"); cmProp tidy = this->GeneratorTarget->GetProperty(tidy_prop); - std::string const cpplint_prop = cmStrCat(lang, "_CPPLINT"); - cmProp cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); - std::string const cppcheck_prop = cmStrCat(lang, "_CPPCHECK"); - cmProp cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); + cmProp iwyu = nullptr; + cmProp cpplint = nullptr; + cmProp cppcheck = nullptr; + if (lang == "C" || lang == "CXX") { + std::string const iwyu_prop = cmStrCat(lang, "_INCLUDE_WHAT_YOU_USE"); + iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); + std::string const cpplint_prop = cmStrCat(lang, "_CPPLINT"); + cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + std::string const cppcheck_prop = cmStrCat(lang, "_CPPCHECK"); + cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); + } if (cmNonempty(iwyu) || cmNonempty(tidy) || cmNonempty(cpplint) || cmNonempty(cppcheck)) { std::string run_iwyu = cmStrCat(cmakeCmd, " -E __run_co_compile"); @@ -887,6 +862,14 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, compileCmds.front().insert(0, cldeps); } + const auto& extraCommands = this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_DEPENDS_EXTRA_COMMANDS")); + if (!extraCommands.empty()) { + auto commandList = cmExpandedList(extraCommands); + compileCmds.insert(compileCmds.end(), commandList.cbegin(), + commandList.cend()); + } + for (std::string& i : compileCmds) { i = cmStrCat(launcher, i); rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), i, @@ -1062,78 +1045,81 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( } namespace { -cmNinjaBuild GetPreprocessOrScanBuild( - const std::string& ruleName, const std::string& ppFileName, bool compilePP, - bool compilePPWithDefines, cmNinjaBuild& objBuild, cmNinjaVars& vars, - const std::string& depFileName, bool needDyndep, - const std::string& objectFileName) +cmNinjaBuild GetScanBuildStatement(const std::string& ruleName, + const std::string& ppFileName, + bool compilePP, bool compilePPWithDefines, + cmNinjaBuild& objBuild, cmNinjaVars& vars, + const std::string& objectFileName, + cmLocalGenerator* lg) { - // Explicit preprocessing and dependency - cmNinjaBuild ppBuild(ruleName); + cmNinjaBuild scanBuild(ruleName); if (!ppFileName.empty()) { - ppBuild.Outputs.push_back(ppFileName); - ppBuild.RspFile = cmStrCat(ppFileName, ".rsp"); + scanBuild.RspFile = cmStrCat(ppFileName, ".rsp"); } else { - ppBuild.RspFile = "$out.rsp"; + scanBuild.RspFile = "$out.rsp"; } if (compilePP) { - // Move compilation dependencies to the preprocessing build statement. - std::swap(ppBuild.ExplicitDeps, objBuild.ExplicitDeps); - std::swap(ppBuild.ImplicitDeps, objBuild.ImplicitDeps); - std::swap(ppBuild.OrderOnlyDeps, objBuild.OrderOnlyDeps); - std::swap(ppBuild.Variables["IN_ABS"], vars["IN_ABS"]); + // Move compilation dependencies to the scan/preprocessing build statement. + std::swap(scanBuild.ExplicitDeps, objBuild.ExplicitDeps); + std::swap(scanBuild.ImplicitDeps, objBuild.ImplicitDeps); + std::swap(scanBuild.OrderOnlyDeps, objBuild.OrderOnlyDeps); + std::swap(scanBuild.Variables["IN_ABS"], vars["IN_ABS"]); // The actual compilation will now use the preprocessed source. objBuild.ExplicitDeps.push_back(ppFileName); } else { - // Copy compilation dependencies to the preprocessing build statement. - ppBuild.ExplicitDeps = objBuild.ExplicitDeps; - ppBuild.ImplicitDeps = objBuild.ImplicitDeps; - ppBuild.OrderOnlyDeps = objBuild.OrderOnlyDeps; - ppBuild.Variables["IN_ABS"] = vars["IN_ABS"]; + // Copy compilation dependencies to the scan/preprocessing build statement. + scanBuild.ExplicitDeps = objBuild.ExplicitDeps; + scanBuild.ImplicitDeps = objBuild.ImplicitDeps; + scanBuild.OrderOnlyDeps = objBuild.OrderOnlyDeps; + scanBuild.Variables["IN_ABS"] = vars["IN_ABS"]; } - // Preprocessing and compilation generally use the same flags. - ppBuild.Variables["FLAGS"] = vars["FLAGS"]; + // Scanning and compilation generally use the same flags. + scanBuild.Variables["FLAGS"] = vars["FLAGS"]; if (compilePP && !compilePPWithDefines) { - // Move preprocessor definitions to the preprocessor build statement. - std::swap(ppBuild.Variables["DEFINES"], vars["DEFINES"]); + // Move preprocessor definitions to the scan/preprocessor build statement. + std::swap(scanBuild.Variables["DEFINES"], vars["DEFINES"]); } else { - // Copy preprocessor definitions to the preprocessor build statement. - ppBuild.Variables["DEFINES"] = vars["DEFINES"]; + // Copy preprocessor definitions to the scan/preprocessor build statement. + scanBuild.Variables["DEFINES"] = vars["DEFINES"]; } // Copy include directories to the preprocessor build statement. The // Fortran compilation build statement still needs them for the INCLUDE // directive. - ppBuild.Variables["INCLUDES"] = vars["INCLUDES"]; + scanBuild.Variables["INCLUDES"] = vars["INCLUDES"]; + + // Tell dependency scanner the object file that will result from + // compiling the source. + scanBuild.Variables["OBJ_FILE"] = objectFileName; + + // Tell dependency scanner where to store dyndep intermediate results. + std::string const& ddiFile = cmStrCat(objectFileName, ".ddi"); + scanBuild.Variables["DYNDEP_INTERMEDIATE_FILE"] = ddiFile; + + // Outputs of the scan/preprocessor build statement. + if (!ppFileName.empty()) { + scanBuild.Outputs.push_back(ppFileName); + scanBuild.ImplicitOuts.push_back(ddiFile); + } else { + scanBuild.Outputs.push_back(ddiFile); + } - // Explicit preprocessing always uses a depfile. - ppBuild.Variables["DEP_FILE"] = depFileName; + // Scanning always uses a depfile for preprocessor dependencies. + std::string const& depFileName = cmStrCat(scanBuild.Outputs.front(), ".d"); + scanBuild.Variables["DEP_FILE"] = + lg->ConvertToOutputFormat(depFileName, cmOutputConverter::SHELL); if (compilePP) { // The actual compilation does not need a depfile because it // depends on the already-preprocessed source. vars.erase("DEP_FILE"); } - if (needDyndep) { - // Tell dependency scanner the object file that will result from - // compiling the source. - ppBuild.Variables["OBJ_FILE"] = objectFileName; - - // Tell dependency scanner where to store dyndep intermediate results. - std::string const ddiFile = cmStrCat(objectFileName, ".ddi"); - if (ppFileName.empty()) { - ppBuild.Outputs.push_back(ddiFile); - } else { - ppBuild.Variables["DYNDEP_INTERMEDIATE_FILE"] = ddiFile; - ppBuild.ImplicitOuts.push_back(ddiFile); - } - } - return ppBuild; + return scanBuild; } } @@ -1170,7 +1156,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["DEFINES"] = this->ComputeDefines(source, language, config); vars["INCLUDES"] = this->ComputeIncludes(source, language, config); - if (!this->NeedDepTypeMSVC(language)) { + if (this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", language, "_DEPFILE_FORMAT")) != "msvc"_s) { bool replaceExt(false); if (!language.empty()) { std::string repVar = @@ -1270,13 +1257,12 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( sourceFileName, objBuild.OrderOnlyDeps); } - // For some cases we need to generate a ninja dyndep file. + // For some cases we scan to dynamically discover dependencies. bool const needDyndep = this->NeedDyndep(language); + bool const compilationPreprocesses = + !this->NeedExplicitPreprocessing(language); - // For some cases we do an explicit preprocessor invocation. - bool const explicitPP = this->NeedExplicitPreprocessing(language); - if (explicitPP) { - + if (needDyndep) { // If source/target has preprocessing turned off, we still need to // generate an explicit dependency step const auto srcpp = source->GetSafeProperty("Fortran_PREPROCESS"); @@ -1288,27 +1274,24 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp); } - bool const compilePP = this->UsePreprocessedSource(language) && + bool const compilePP = !compilationPreprocesses && (preprocess != cmOutputConverter::FortranPreprocess::NotNeeded); bool const compilePPWithDefines = - compilePP && this->CompilePreprocessedSourceWithDefines(language); - - std::string const ppFileName = compilePP - ? this->ConvertToNinjaPath(this->GetPreprocessedFilePath(source, config)) - : ""; + compilePP && this->CompileWithDefines(language); - std::string const buildName = compilePP - ? this->LanguagePreprocessRule(language, config) - : this->LanguageDependencyRule(language, config); - - const auto depExtension = compilePP ? ".pp.d" : ".d"; - const std::string depFileName = - this->GetLocalGenerator()->ConvertToOutputFormat( - cmStrCat(objectFileName, depExtension), cmOutputConverter::SHELL); + std::string scanRuleName; + std::string ppFileName; + if (compilePP) { + scanRuleName = this->LanguagePreprocessAndScanRule(language, config); + ppFileName = this->ConvertToNinjaPath( + this->GetPreprocessedFilePath(source, config)); + } else { + scanRuleName = this->LanguageScanRule(language, config); + } - cmNinjaBuild ppBuild = GetPreprocessOrScanBuild( - buildName, ppFileName, compilePP, compilePPWithDefines, objBuild, vars, - depFileName, needDyndep, objectFileName); + cmNinjaBuild ppBuild = GetScanBuildStatement( + scanRuleName, ppFileName, compilePP, compilePPWithDefines, objBuild, + vars, objectFileName, this->LocalGenerator); if (compilePP) { // In case compilation requires flags that are incompatible with @@ -1330,7 +1313,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]); } - if (firstForConfig && needDyndep) { + if (firstForConfig) { std::string const ddiFile = cmStrCat(objectFileName, ".ddi"); this->Configs[config].DDIFiles[language].push_back(ddiFile); } @@ -1340,8 +1323,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), ppBuild, commandLineLengthLimit); - } - if (needDyndep) { + std::string const dyndep = this->GetDyndepFilePath(language, config); objBuild.OrderOnlyDeps.push_back(dyndep); vars["dyndep"] = dyndep; diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index a27c9b4..83a4342 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -42,8 +42,6 @@ public: std::string GetTargetName() const; - bool NeedDepTypeMSVC(const std::string& lang) const; - protected: bool SetMsvcTargetPdbVariable(cmNinjaVars&, const std::string& config) const; @@ -67,16 +65,15 @@ protected: std::string LanguageCompilerRule(const std::string& lang, const std::string& config) const; - std::string LanguagePreprocessRule(std::string const& lang, - const std::string& config) const; - std::string LanguageDependencyRule(std::string const& lang, - const std::string& config) const; - bool NeedExplicitPreprocessing(std::string const& lang) const; + std::string LanguagePreprocessAndScanRule(std::string const& lang, + const std::string& config) const; + std::string LanguageScanRule(std::string const& lang, + const std::string& config) const; std::string LanguageDyndepRule(std::string const& lang, const std::string& config) const; bool NeedDyndep(std::string const& lang) const; - bool UsePreprocessedSource(std::string const& lang) const; - bool CompilePreprocessedSourceWithDefines(std::string const& lang) const; + bool NeedExplicitPreprocessing(std::string const& lang) const; + bool CompileWithDefines(std::string const& lang) const; std::string OrderDependsTargetForTarget(const std::string& config); diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx deleted file mode 100644 index 1eede13..0000000 --- a/Source/cmPipeConnection.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmPipeConnection.h" - -#include <utility> - -#include "cmServer.h" - -cmPipeConnection::cmPipeConnection(std::string name, - cmConnectionBufferStrategy* bufferStrategy) - : cmEventBasedConnection(bufferStrategy) - , PipeName(std::move(name)) -{ -} - -void cmPipeConnection::Connect(uv_stream_t* server) -{ - if (this->WriteStream.get()) { - // Accept and close all pipes but the first: - cm::uv_pipe_ptr rejectPipe; - - rejectPipe.init(*this->Server->GetLoop(), 0); - uv_accept(server, rejectPipe); - - return; - } - - cm::uv_pipe_ptr ClientPipe; - ClientPipe.init(*this->Server->GetLoop(), 0, - static_cast<cmEventBasedConnection*>(this)); - - if (uv_accept(server, ClientPipe) != 0) { - return; - } - - uv_read_start(ClientPipe, on_alloc_buffer, on_read); - WriteStream = std::move(ClientPipe); - Server->OnConnected(this); -} - -bool cmPipeConnection::OnServeStart(std::string* errorMessage) -{ - this->ServerPipe.init(*this->Server->GetLoop(), 0, - static_cast<cmEventBasedConnection*>(this)); - - int r; - if ((r = uv_pipe_bind(this->ServerPipe, this->PipeName.c_str())) != 0) { - *errorMessage = std::string("Internal Error with ") + this->PipeName + - ": " + uv_err_name(r); - return false; - } - - if ((r = uv_listen(this->ServerPipe, 1, on_new_connection)) != 0) { - *errorMessage = std::string("Internal Error listening on ") + - this->PipeName + ": " + uv_err_name(r); - return false; - } - - return cmConnection::OnServeStart(errorMessage); -} - -bool cmPipeConnection::OnConnectionShuttingDown() -{ - if (this->WriteStream.get()) { - this->WriteStream->data = nullptr; - } - - this->ServerPipe.reset(); - - return cmEventBasedConnection::OnConnectionShuttingDown(); -} diff --git a/Source/cmPipeConnection.h b/Source/cmPipeConnection.h deleted file mode 100644 index 1215716..0000000 --- a/Source/cmPipeConnection.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <string> - -#include <cm3p/uv.h> - -#include "cmConnection.h" -#include "cmUVHandlePtr.h" - -class cmPipeConnection : public cmEventBasedConnection -{ -public: - cmPipeConnection(std::string name, - cmConnectionBufferStrategy* bufferStrategy = nullptr); - - bool OnServeStart(std::string* pString) override; - - bool OnConnectionShuttingDown() override; - - void Connect(uv_stream_t* server) override; - -private: - const std::string PipeName; - cm::uv_pipe_ptr ServerPipe; -}; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 18ce9c3..2194b0f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -340,6 +340,25 @@ class cmMakefile; 3, 19, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0114, \ "ExternalProject step targets fully adopt their steps.", 3, 19, 0, \ + cmPolicies::WARN) \ + SELECT(POLICY, CMP0115, "Source file extensions must be explicit.", 3, 20, \ + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0116, \ + "Ninja generators transform DEPFILEs from add_custom_command().", 3, \ + 20, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0117, \ + "MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \ + 20, 0, cmPolicies::WARN) \ + SELECT( \ + POLICY, CMP0118, \ + "The GENERATED source file property is now visible in all directories.", \ + 3, 20, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0119, \ + "LANGUAGE source file property explicitly compiles as specified " \ + "language.", \ + 3, 20, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0120, \ + "The WriteCompilerDetectionHeader module is removed.", 3, 20, 0, \ cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) @@ -375,7 +394,8 @@ class cmMakefile; F(CMP0105) \ F(CMP0108) \ F(CMP0112) \ - F(CMP0113) + F(CMP0113) \ + F(CMP0119) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 0cfba63..ed32de9 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -358,6 +358,17 @@ static bool IncludeByVariable(cmExecutionStatus& status, return true; } + std::string includeFile = + cmSystemTools::CollapseFullPath(*include, mf.GetCurrentSourceDirectory()); + if (!cmSystemTools::FileExists(includeFile)) { + status.SetError(cmStrCat("could not find requested file:\n ", *include)); + return false; + } + if (cmSystemTools::FileIsDirectory(includeFile)) { + status.SetError(cmStrCat("requested file is a directory:\n ", *include)); + return false; + } + const bool readit = mf.ReadDependentFile(*include); if (readit) { return true; @@ -367,7 +378,7 @@ static bool IncludeByVariable(cmExecutionStatus& status, return true; } - status.SetError(cmStrCat("could not find file:\n ", *include)); + status.SetError(cmStrCat("could not load requested file:\n ", *include)); return false; } diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index de462db..e058176 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -40,8 +40,7 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args, cmStrCat(mf.GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx"); cmSourceFile* sf = mf.GetOrCreateSource(newName, true); if (curr) { - cmProp p = curr->GetProperty("ABSTRACT"); - sf->SetProperty("ABSTRACT", cmToCStr(p)); + sf->SetProperty("ABSTRACT", cmToCStr(curr->GetProperty("ABSTRACT"))); } // Compute the name of the header from which to generate the file. diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index cf90417..2db1b84 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -29,13 +29,13 @@ public: { } - bool operator>(IntegerVersion const version) + bool operator>(IntegerVersion const version) const { return (this->Major > version.Major) || ((this->Major == version.Major) && (this->Minor > version.Minor)); } - bool operator>=(IntegerVersion const version) + bool operator>=(IntegerVersion const version) const { return (this->Major > version.Major) || ((this->Major == version.Major) && (this->Minor >= version.Minor)); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 3b62e9c..67834f1 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -29,6 +29,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmGlobalNinjaGenerator.h" #include "cmLinkItem.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" @@ -807,7 +808,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() qrc.Generated = sf->GetIsGenerated(); // RCC options { - std::string const opts = sf->GetSafeProperty(kw.AUTORCC_OPTIONS); + std::string const& opts = sf->GetSafeProperty(kw.AUTORCC_OPTIONS); if (!opts.empty()) { cmExpandList(opts, qrc.Options); } @@ -1237,11 +1238,23 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() const std::string outputFile = cmStrCat(this->Dir.Build, "/", timestampFileName); this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps"); - auto relativeBinaryDir = cmSystemTools::RelativePath( - this->LocalGen->GetBinaryDirectory(), - this->LocalGen->GetCurrentBinaryDirectory()); - if (!relativeBinaryDir.empty()) { - relativeBinaryDir = cmStrCat(relativeBinaryDir, "/"); + std::string relativeBinaryDir; + if (dynamic_cast<cmGlobalNinjaGenerator*>(this->GlobalGen)) { + switch (this->LocalGen->GetPolicyStatus(cmPolicies::CMP0116)) { + case cmPolicies::OLD: + case cmPolicies::WARN: + relativeBinaryDir = cmSystemTools::RelativePath( + this->LocalGen->GetBinaryDirectory(), + this->LocalGen->GetCurrentBinaryDirectory()); + if (!relativeBinaryDir.empty()) { + relativeBinaryDir = cmStrCat(relativeBinaryDir, "/"); + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + break; + } } this->AutogenTarget.DepFileRuleName = cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/", @@ -1624,7 +1637,7 @@ cmSourceFile* cmQtAutoGenInitializer::RegisterGeneratedSource( std::string const& filename) { cmSourceFile* gFile = this->Makefile->GetOrCreateSource(filename, true); - gFile->SetProperty("GENERATED", "1"); + gFile->MarkAsGenerated(); gFile->SetProperty("SKIP_AUTOGEN", "1"); return gFile; } diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 9cb172b..b27bb88 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -15,6 +15,7 @@ #include <vector> #include <cm/memory> +#include <cm/optional> #include <cm/string_view> #include <cmext/algorithm> @@ -26,7 +27,6 @@ #include "cmCryptoHash.h" #include "cmFileTime.h" #include "cmGccDepfileReader.h" -#include "cmGccDepfileReaderTypes.h" #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" @@ -2841,14 +2841,14 @@ bool cmQtAutoMocUicT::CreateDirectories() std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile( const char* filePath) { - cmGccDepfileContent content = cmReadGccDepfile(filePath); - if (content.empty()) { + auto const content = cmReadGccDepfile(filePath); + if (!content || content->empty()) { return {}; } // Moc outputs a depfile with exactly one rule. // Discard the rule and return the dependencies. - return content.front().paths; + return content->front().paths; } void cmQtAutoMocUicT::Abort(bool error) diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index f5f9c67..5363fef 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -3,7 +3,6 @@ #include "cmRulePlaceholderExpander.h" #include <cctype> -#include <cstring> #include <utility> #include "cmOutputConverter.h" @@ -20,11 +19,6 @@ cmRulePlaceholderExpander::cmRulePlaceholderExpander( { } -cmRulePlaceholderExpander::RuleVariables::RuleVariables() -{ - memset(this, 0, sizeof(*this)); -} - std::string cmRulePlaceholderExpander::ExpandRuleVariable( cmOutputConverter* outputConverter, std::string const& variable, const RuleVariables& replaceValues) @@ -141,6 +135,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( return replaceValues.DependencyFile; } } + if (replaceValues.DependencyTarget) { + if (variable == "DEP_TARGET") { + return replaceValues.DependencyTarget; + } + } if (replaceValues.Fatbinary) { if (variable == "FATBINARY") { return replaceValues.Fatbinary; diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index c8d107d..710f8a6 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -27,45 +27,45 @@ public: // ExpandRuleVariables struct RuleVariables { - RuleVariables(); - const char* CMTargetName; - const char* CMTargetType; - const char* TargetPDB; - const char* TargetCompilePDB; - const char* TargetVersionMajor; - const char* TargetVersionMinor; - const char* Language; - const char* AIXExports; - const char* Objects; - const char* Target; - const char* LinkLibraries; - const char* Source; - const char* AssemblySource; - const char* PreprocessedSource; - const char* Output; - const char* Object; - const char* ObjectDir; - const char* ObjectFileDir; - const char* Flags; - const char* ObjectsQuoted; - const char* SONameFlag; - const char* TargetSOName; - const char* TargetInstallNameDir; - const char* LinkFlags; - const char* Manifests; - const char* LanguageCompileFlags; - const char* Defines; - const char* Includes; - const char* DependencyFile; - const char* FilterPrefix; - const char* SwiftLibraryName; - const char* SwiftModule; - const char* SwiftModuleName; - const char* SwiftOutputFileMap; - const char* SwiftSources; - const char* ISPCHeader; - const char* Fatbinary; - const char* RegisterFile; + const char* CMTargetName = nullptr; + const char* CMTargetType = nullptr; + const char* TargetPDB = nullptr; + const char* TargetCompilePDB = nullptr; + const char* TargetVersionMajor = nullptr; + const char* TargetVersionMinor = nullptr; + const char* Language = nullptr; + const char* AIXExports = nullptr; + const char* Objects = nullptr; + const char* Target = nullptr; + const char* LinkLibraries = nullptr; + const char* Source = nullptr; + const char* AssemblySource = nullptr; + const char* PreprocessedSource = nullptr; + const char* Output = nullptr; + const char* Object = nullptr; + const char* ObjectDir = nullptr; + const char* ObjectFileDir = nullptr; + const char* Flags = nullptr; + const char* ObjectsQuoted = nullptr; + const char* SONameFlag = nullptr; + const char* TargetSOName = nullptr; + const char* TargetInstallNameDir = nullptr; + const char* LinkFlags = nullptr; + const char* Manifests = nullptr; + const char* LanguageCompileFlags = nullptr; + const char* Defines = nullptr; + const char* Includes = nullptr; + const char* DependencyFile = nullptr; + const char* DependencyTarget = nullptr; + const char* FilterPrefix = nullptr; + const char* SwiftLibraryName = nullptr; + const char* SwiftModule = nullptr; + const char* SwiftModuleName = nullptr; + const char* SwiftOutputFileMap = nullptr; + const char* SwiftSources = nullptr; + const char* ISPCHeader = nullptr; + const char* Fatbinary = nullptr; + const char* RegisterFile = nullptr; }; // Expand rule variables in CMake of the type found in language rules diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx new file mode 100644 index 0000000..40bf4c9 --- /dev/null +++ b/Source/cmScanDepFormat.cxx @@ -0,0 +1,267 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmScanDepFormat.h" + +#include <cctype> +#include <cstdio> + +#include <cm3p/json/reader.h> +#include <cm3p/json/value.h> +#include <cm3p/json/writer.h> + +#include "cmsys/FStream.hxx" + +#include "cmGeneratedFileStream.h" +#include "cmStringAlgorithms.h" +#include "cmSystemTools.h" + +static bool ParseFilename(Json::Value const& val, std::string& result) +{ + if (val.isString()) { + result = val.asString(); + } else { + return false; + } + + return true; +} + +static Json::Value EncodeFilename(std::string const& path) +{ + std::string data; + data.reserve(path.size()); + + for (auto const& byte : path) { + if (std::iscntrl(byte)) { + // Control characters. + data.append("\\u"); + char buf[5]; + std::snprintf(buf, sizeof(buf), "%04x", byte); + data.append(buf); + } else if (byte == '"' || byte == '\\') { + // Special JSON characters. + data.push_back('\\'); + data.push_back(byte); + } else { + // Other data. + data.push_back(byte); + } + } + + return data; +} + +#define PARSE_BLOB(val, res) \ + do { \ + if (!ParseFilename(val, res)) { \ + cmSystemTools::Error( \ + cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, \ + ": invalid blob")); \ + return false; \ + } \ + } while (0) + +#define PARSE_FILENAME(val, res) \ + do { \ + if (!ParseFilename(val, res)) { \ + cmSystemTools::Error( \ + cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, \ + ": invalid filename")); \ + return false; \ + } \ + \ + if (!cmSystemTools::FileIsFullPath(res)) { \ + res = cmStrCat(work_directory, '/', res); \ + } \ + } while (0) + +bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, cmSourceInfo* info) +{ + Json::Value ppio; + Json::Value const& ppi = ppio; + cmsys::ifstream ppf(arg_pp.c_str(), std::ios::in | std::ios::binary); + { + Json::Reader reader; + if (!reader.parse(ppf, ppio, false)) { + cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ", + arg_pp, + reader.getFormattedErrorMessages())); + return false; + } + } + + Json::Value const& version = ppi["version"]; + if (version.asUInt() != 0) { + cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ", + arg_pp, ": version ", version.asString())); + return false; + } + + Json::Value const& rules = ppi["rules"]; + if (rules.isArray()) { + if (rules.size() != 1) { + cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ", + arg_pp, ": expected 1 source entry")); + return false; + } + + for (auto const& rule : rules) { + Json::Value const& workdir = rule["work-directory"]; + if (!workdir.isString()) { + cmSystemTools::Error( + cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, + ": work-directory is not a string")); + return false; + } + std::string work_directory; + PARSE_BLOB(workdir, work_directory); + + Json::Value const& depends = rule["depends"]; + if (depends.isArray()) { + std::string depend_filename; + for (auto const& depend : depends) { + PARSE_FILENAME(depend, depend_filename); + info->Includes.push_back(depend_filename); + } + } + + if (rule.isMember("future-compile")) { + Json::Value const& future_compile = rule["future-compile"]; + + if (future_compile.isMember("outputs")) { + Json::Value const& outputs = future_compile["outputs"]; + if (outputs.isArray()) { + if (outputs.empty()) { + cmSystemTools::Error( + cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, + ": expected at least one 1 output")); + return false; + } + + PARSE_FILENAME(outputs[0], info->PrimaryOutput); + } + } + + if (future_compile.isMember("provides")) { + Json::Value const& provides = future_compile["provides"]; + if (provides.isArray()) { + for (auto const& provide : provides) { + cmSourceReqInfo provide_info; + + Json::Value const& logical_name = provide["logical-name"]; + PARSE_BLOB(logical_name, provide_info.LogicalName); + + if (provide.isMember("compiled-module-path")) { + Json::Value const& compiled_module_path = + provide["compiled-module-path"]; + PARSE_FILENAME(compiled_module_path, + provide_info.CompiledModulePath); + } else { + provide_info.CompiledModulePath = + cmStrCat(provide_info.LogicalName, ".mod"); + } + + info->Provides.push_back(provide_info); + } + } + } + + if (future_compile.isMember("requires")) { + Json::Value const& reqs = future_compile["requires"]; + if (reqs.isArray()) { + for (auto const& require : reqs) { + cmSourceReqInfo require_info; + + Json::Value const& logical_name = require["logical-name"]; + PARSE_BLOB(logical_name, require_info.LogicalName); + + if (require.isMember("compiled-module-path")) { + Json::Value const& compiled_module_path = + require["compiled-module-path"]; + PARSE_FILENAME(compiled_module_path, + require_info.CompiledModulePath); + } + + info->Requires.push_back(require_info); + } + } + } + } + } + } + + return true; +} + +bool cmScanDepFormat_P1689_Write(std::string const& path, + std::string const& input, + cmSourceInfo const& info) +{ + Json::Value ddi(Json::objectValue); + ddi["version"] = 0; + ddi["revision"] = 0; + + Json::Value& rules = ddi["rules"] = Json::arrayValue; + + Json::Value rule(Json::objectValue); + rule["work-directory"] = + EncodeFilename(cmSystemTools::GetCurrentWorkingDirectory()); + Json::Value& inputs = rule["inputs"] = Json::arrayValue; + inputs.append(EncodeFilename(input)); + + Json::Value& rule_outputs = rule["outputs"] = Json::arrayValue; + rule_outputs.append(EncodeFilename(path)); + + Json::Value& depends = rule["depends"] = Json::arrayValue; + for (auto const& include : info.Includes) { + depends.append(EncodeFilename(include)); + } + + Json::Value& future_compile = rule["future-compile"] = Json::objectValue; + + Json::Value& outputs = future_compile["outputs"] = Json::arrayValue; + outputs.append(info.PrimaryOutput); + + Json::Value& provides = future_compile["provides"] = Json::arrayValue; + for (auto const& provide : info.Provides) { + Json::Value provide_obj(Json::objectValue); + auto const encoded = EncodeFilename(provide.LogicalName); + provide_obj["logical-name"] = encoded; + if (provide.CompiledModulePath.empty()) { + provide_obj["compiled-module-path"] = encoded; + } else { + provide_obj["compiled-module-path"] = + EncodeFilename(provide.CompiledModulePath); + } + + // TODO: Source file tracking. See below. + + provides.append(provide_obj); + } + + Json::Value& reqs = future_compile["requires"] = Json::arrayValue; + for (auto const& require : info.Requires) { + Json::Value require_obj(Json::objectValue); + auto const encoded = EncodeFilename(require.LogicalName); + require_obj["logical-name"] = encoded; + if (require.CompiledModulePath.empty()) { + require_obj["compiled-module-path"] = encoded; + } else { + require_obj["compiled-module-path"] = + EncodeFilename(require.CompiledModulePath); + } + + // TODO: Source filename inclusion. Requires collating with the provides + // filenames (as a sanity check if available on both sides). + + reqs.append(require_obj); + } + + rules.append(rule); + + cmGeneratedFileStream ddif(path); + ddif << ddi; + + return !!ddif; +} diff --git a/Source/cmScanDepFormat.h b/Source/cmScanDepFormat.h new file mode 100644 index 0000000..1ad0ecf --- /dev/null +++ b/Source/cmScanDepFormat.h @@ -0,0 +1,30 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include <string> +#include <vector> + +struct cmSourceReqInfo +{ + std::string LogicalName; + std::string CompiledModulePath; +}; + +struct cmSourceInfo +{ + std::string PrimaryOutput; + + // Set of provided and required modules. + std::vector<cmSourceReqInfo> Provides; + std::vector<cmSourceReqInfo> Requires; + + // Set of files included in the translation unit. + std::vector<std::string> Includes; +}; + +bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, + cmSourceInfo* info); +bool cmScanDepFormat_P1689_Write(std::string const& path, + std::string const& input, + cmSourceInfo const& info); diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx deleted file mode 100644 index 7f97406..0000000 --- a/Source/cmServer.cxx +++ /dev/null @@ -1,570 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmServer.h" - -#include <algorithm> -#include <cassert> -#include <csignal> -#include <cstdint> -#include <iostream> -#include <mutex> -#include <utility> - -#include <cm/memory> -#include <cm/shared_mutex> - -#include <cm3p/json/reader.h> -#include <cm3p/json/writer.h> - -#include "cmsys/FStream.hxx" - -#include "cmConnection.h" -#include "cmFileMonitor.h" -#include "cmJsonObjectDictionary.h" -#include "cmServerDictionary.h" -#include "cmServerProtocol.h" -#include "cmSystemTools.h" -#include "cmake.h" - -void on_signal(uv_signal_t* signal, int signum) -{ - auto conn = static_cast<cmServerBase*>(signal->data); - conn->OnSignal(signum); -} - -static void on_walk_to_shutdown(uv_handle_t* handle, void* arg) -{ - (void)arg; - assert(uv_is_closing(handle)); - if (!uv_is_closing(handle)) { - uv_close(handle, &cmEventBasedConnection::on_close); - } -} - -class cmServer::DebugInfo -{ -public: - DebugInfo() - : StartTime(uv_hrtime()) - { - } - - bool PrintStatistics = false; - - std::string OutputFile; - uint64_t StartTime; -}; - -cmServer::cmServer(cmConnection* conn, bool supportExperimental) - : cmServerBase(conn) - , SupportExperimental(supportExperimental) -{ - // Register supported protocols: - this->RegisterProtocol(cm::make_unique<cmServerProtocol1>()); -} - -cmServer::~cmServer() -{ - Close(); -} - -void cmServer::ProcessRequest(cmConnection* connection, - const std::string& input) -{ - Json::Reader reader; - Json::Value value; - if (!reader.parse(input, value)) { - this->WriteParseError(connection, "Failed to parse JSON input."); - return; - } - - std::unique_ptr<DebugInfo> debug; - Json::Value debugValue = value["debug"]; - if (!debugValue.isNull()) { - debug = cm::make_unique<DebugInfo>(); - debug->OutputFile = debugValue["dumpToFile"].asString(); - debug->PrintStatistics = debugValue["showStats"].asBool(); - } - - const cmServerRequest request(this, connection, value[kTYPE_KEY].asString(), - value[kCOOKIE_KEY].asString(), value); - - if (request.Type.empty()) { - cmServerResponse response(request); - response.SetError("No type given in request."); - this->WriteResponse(connection, response, nullptr); - return; - } - - cmSystemTools::SetMessageCallback( - [&request](const std::string& msg, const char* title) { - reportMessage(msg, title, request); - }); - - if (this->Protocol) { - this->Protocol->CMakeInstance()->SetProgressCallback( - [&request](const std::string& msg, float prog) { - reportProgress(msg, prog, request); - }); - this->WriteResponse(connection, this->Protocol->Process(request), - debug.get()); - } else { - this->WriteResponse(connection, this->SetProtocolVersion(request), - debug.get()); - } -} - -void cmServer::RegisterProtocol(std::unique_ptr<cmServerProtocol> protocol) -{ - if (protocol->IsExperimental() && !this->SupportExperimental) { - protocol.reset(); - return; - } - auto version = protocol->ProtocolVersion(); - assert(version.first >= 0); - assert(version.second >= 0); - auto it = std::find_if( - this->SupportedProtocols.begin(), this->SupportedProtocols.end(), - [version](const std::unique_ptr<cmServerProtocol>& p) { - return p->ProtocolVersion() == version; - }); - if (it == this->SupportedProtocols.end()) { - this->SupportedProtocols.push_back(std::move(protocol)); - } -} - -void cmServer::PrintHello(cmConnection* connection) const -{ - Json::Value hello = Json::objectValue; - hello[kTYPE_KEY] = "hello"; - - Json::Value& protocolVersions = hello[kSUPPORTED_PROTOCOL_VERSIONS] = - Json::arrayValue; - - for (auto const& proto : this->SupportedProtocols) { - auto version = proto->ProtocolVersion(); - Json::Value tmp = Json::objectValue; - tmp[kMAJOR_KEY] = version.first; - tmp[kMINOR_KEY] = version.second; - if (proto->IsExperimental()) { - tmp[kIS_EXPERIMENTAL_KEY] = true; - } - protocolVersions.append(tmp); - } - - this->WriteJsonObject(connection, hello, nullptr); -} - -void cmServer::reportProgress(const std::string& msg, float progress, - const cmServerRequest& request) -{ - if (progress < 0.0f || progress > 1.0f) { - request.ReportMessage(msg, ""); - } else { - request.ReportProgress(0, static_cast<int>(progress * 1000), 1000, msg); - } -} - -void cmServer::reportMessage(const std::string& msg, const char* title, - const cmServerRequest& request) -{ - std::string titleString; - if (title) { - titleString = title; - } - request.ReportMessage(msg, titleString); -} - -cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) -{ - if (request.Type != kHANDSHAKE_TYPE) { - return request.ReportError("Waiting for type \"" + kHANDSHAKE_TYPE + - "\"."); - } - - Json::Value requestedProtocolVersion = request.Data[kPROTOCOL_VERSION_KEY]; - if (requestedProtocolVersion.isNull()) { - return request.ReportError("\"" + kPROTOCOL_VERSION_KEY + - "\" is required for \"" + kHANDSHAKE_TYPE + - "\"."); - } - - if (!requestedProtocolVersion.isObject()) { - return request.ReportError("\"" + kPROTOCOL_VERSION_KEY + - "\" must be a JSON object."); - } - - Json::Value majorValue = requestedProtocolVersion[kMAJOR_KEY]; - if (!majorValue.isInt()) { - return request.ReportError("\"" + kMAJOR_KEY + - "\" must be set and an integer."); - } - - Json::Value minorValue = requestedProtocolVersion[kMINOR_KEY]; - if (!minorValue.isNull() && !minorValue.isInt()) { - return request.ReportError("\"" + kMINOR_KEY + - "\" must be unset or an integer."); - } - - const int major = majorValue.asInt(); - const int minor = minorValue.isNull() ? -1 : minorValue.asInt(); - if (major < 0) { - return request.ReportError("\"" + kMAJOR_KEY + "\" must be >= 0."); - } - if (!minorValue.isNull() && minor < 0) { - return request.ReportError("\"" + kMINOR_KEY + - "\" must be >= 0 when set."); - } - - this->Protocol = - cmServer::FindMatchingProtocol(this->SupportedProtocols, major, minor); - if (!this->Protocol) { - return request.ReportError("Protocol version not supported."); - } - - std::string errorMessage; - if (!this->Protocol->Activate(this, request, &errorMessage)) { - this->Protocol = nullptr; - return request.ReportError("Failed to activate protocol version: " + - errorMessage); - } - return request.Reply(Json::objectValue); -} - -bool cmServer::Serve(std::string* errorMessage) -{ - if (this->SupportedProtocols.empty()) { - *errorMessage = - "No protocol versions defined. Maybe you need --experimental?"; - return false; - } - assert(!this->Protocol); - - return cmServerBase::Serve(errorMessage); -} - -cmFileMonitor* cmServer::FileMonitor() const -{ - return fileMonitor.get(); -} - -void cmServer::WriteJsonObject(const Json::Value& jsonValue, - const DebugInfo* debug) const -{ - cm::shared_lock<cm::shared_mutex> lock(ConnectionsMutex); - for (auto& connection : this->Connections) { - WriteJsonObject(connection.get(), jsonValue, debug); - } -} - -void cmServer::WriteJsonObject(cmConnection* connection, - const Json::Value& jsonValue, - const DebugInfo* debug) const -{ - Json::FastWriter writer; - - auto beforeJson = uv_hrtime(); - std::string result = writer.write(jsonValue); - - if (debug) { - Json::Value copy = jsonValue; - if (debug->PrintStatistics) { - Json::Value stats = Json::objectValue; - auto endTime = uv_hrtime(); - - stats["jsonSerialization"] = double(endTime - beforeJson) / 1000000.0; - stats["totalTime"] = double(endTime - debug->StartTime) / 1000000.0; - stats["size"] = static_cast<int>(result.size()); - if (!debug->OutputFile.empty()) { - stats["dumpFile"] = debug->OutputFile; - } - - copy["zzzDebug"] = stats; - - result = writer.write(copy); // Update result to include debug info - } - - if (!debug->OutputFile.empty()) { - cmsys::ofstream myfile(debug->OutputFile.c_str()); - myfile << result; - } - } - - connection->WriteData(result); -} - -cmServerProtocol* cmServer::FindMatchingProtocol( - const std::vector<std::unique_ptr<cmServerProtocol>>& protocols, int major, - int minor) -{ - cmServerProtocol* bestMatch = nullptr; - for (const auto& protocol : protocols) { - auto version = protocol->ProtocolVersion(); - if (major != version.first) { - continue; - } - if (minor == version.second) { - return protocol.get(); - } - if (!bestMatch || bestMatch->ProtocolVersion().second < version.second) { - bestMatch = protocol.get(); - } - } - return minor < 0 ? bestMatch : nullptr; -} - -void cmServer::WriteProgress(const cmServerRequest& request, int min, - int current, int max, - const std::string& message) const -{ - assert(min <= current && current <= max); - assert(message.length() != 0); - - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = kPROGRESS_TYPE; - obj[kREPLY_TO_KEY] = request.Type; - obj[kCOOKIE_KEY] = request.Cookie; - obj[kPROGRESS_MESSAGE_KEY] = message; - obj[kPROGRESS_MINIMUM_KEY] = min; - obj[kPROGRESS_MAXIMUM_KEY] = max; - obj[kPROGRESS_CURRENT_KEY] = current; - - this->WriteJsonObject(request.Connection, obj, nullptr); -} - -void cmServer::WriteMessage(const cmServerRequest& request, - const std::string& message, - const std::string& title) const -{ - if (message.empty()) { - return; - } - - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = kMESSAGE_TYPE; - obj[kREPLY_TO_KEY] = request.Type; - obj[kCOOKIE_KEY] = request.Cookie; - obj[kMESSAGE_KEY] = message; - if (!title.empty()) { - obj[kTITLE_KEY] = title; - } - - WriteJsonObject(request.Connection, obj, nullptr); -} - -void cmServer::WriteParseError(cmConnection* connection, - const std::string& message) const -{ - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = kERROR_TYPE; - obj[kERROR_MESSAGE_KEY] = message; - obj[kREPLY_TO_KEY] = ""; - obj[kCOOKIE_KEY] = ""; - - this->WriteJsonObject(connection, obj, nullptr); -} - -void cmServer::WriteSignal(const std::string& name, - const Json::Value& data) const -{ - assert(data.isObject()); - Json::Value obj = data; - obj[kTYPE_KEY] = kSIGNAL_TYPE; - obj[kREPLY_TO_KEY] = ""; - obj[kCOOKIE_KEY] = ""; - obj[kNAME_KEY] = name; - - WriteJsonObject(obj, nullptr); -} - -void cmServer::WriteResponse(cmConnection* connection, - const cmServerResponse& response, - const DebugInfo* debug) const -{ - assert(response.IsComplete()); - - Json::Value obj = response.Data(); - obj[kCOOKIE_KEY] = response.Cookie; - obj[kTYPE_KEY] = response.IsError() ? kERROR_TYPE : kREPLY_TYPE; - obj[kREPLY_TO_KEY] = response.Type; - if (response.IsError()) { - obj[kERROR_MESSAGE_KEY] = response.ErrorMessage(); - } - - this->WriteJsonObject(connection, obj, debug); -} - -void cmServer::OnConnected(cmConnection* connection) -{ - PrintHello(connection); -} - -void cmServer::OnServeStart() -{ - cmServerBase::OnServeStart(); - fileMonitor = std::make_shared<cmFileMonitor>(GetLoop()); -} - -void cmServer::StartShutDown() -{ - if (fileMonitor) { - fileMonitor->StopMonitoring(); - fileMonitor.reset(); - } - cmServerBase::StartShutDown(); -} - -static void __start_thread(void* arg) -{ - auto server = static_cast<cmServerBase*>(arg); - std::string error; - bool success = server->Serve(&error); - if (!success || !error.empty()) { - std::cerr << "Error during serve: " << error << std::endl; - } -} - -bool cmServerBase::StartServeThread() -{ - ServeThreadRunning = true; - uv_thread_create(&ServeThread, __start_thread, this); - return true; -} - -static void __shutdownThread(uv_async_t* arg) -{ - auto server = static_cast<cmServerBase*>(arg->data); - server->StartShutDown(); -} - -bool cmServerBase::Serve(std::string* errorMessage) -{ -#ifndef NDEBUG - uv_thread_t blank_thread_t = {}; - assert(uv_thread_equal(&blank_thread_t, &ServeThreadId)); - ServeThreadId = uv_thread_self(); -#endif - - errorMessage->clear(); - - ShutdownSignal.init(Loop, __shutdownThread, this); - - SIGINTHandler.init(Loop, this); - SIGHUPHandler.init(Loop, this); - - SIGINTHandler.start(&on_signal, SIGINT); - SIGHUPHandler.start(&on_signal, SIGHUP); - - OnServeStart(); - - { - cm::shared_lock<cm::shared_mutex> lock(ConnectionsMutex); - for (auto& connection : Connections) { - if (!connection->OnServeStart(errorMessage)) { - return false; - } - } - } - - if (uv_run(&Loop, UV_RUN_DEFAULT) != 0) { - // It is important we don't ever let the event loop exit with open handles - // at best this is a memory leak, but it can also introduce race conditions - // which can hang the program. - assert(false && "Event loop stopped in unclean state."); - - *errorMessage = "Internal Error: Event loop stopped in unclean state."; - return false; - } - - return true; -} - -void cmServerBase::OnConnected(cmConnection*) -{ -} - -void cmServerBase::OnServeStart() -{ -} - -void cmServerBase::StartShutDown() -{ - ShutdownSignal.reset(); - SIGINTHandler.reset(); - SIGHUPHandler.reset(); - - { - std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex); - for (auto& connection : Connections) { - connection->OnConnectionShuttingDown(); - } - Connections.clear(); - } - - uv_walk(&Loop, on_walk_to_shutdown, nullptr); -} - -bool cmServerBase::OnSignal(int signum) -{ - (void)signum; - StartShutDown(); - return true; -} - -cmServerBase::cmServerBase(cmConnection* connection) -{ - auto err = uv_loop_init(&Loop); - (void)err; - Loop.data = this; - assert(err == 0); - - AddNewConnection(connection); -} - -void cmServerBase::Close() -{ - if (Loop.data) { - if (ServeThreadRunning) { - this->ShutdownSignal.send(); - uv_thread_join(&ServeThread); - } - - uv_loop_close(&Loop); - Loop.data = nullptr; - } -} -cmServerBase::~cmServerBase() -{ - Close(); -} - -void cmServerBase::AddNewConnection(cmConnection* ownedConnection) -{ - { - std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex); - Connections.emplace_back(ownedConnection); - } - ownedConnection->SetServer(this); -} - -uv_loop_t* cmServerBase::GetLoop() -{ - return &Loop; -} - -void cmServerBase::OnDisconnect(cmConnection* pConnection) -{ - auto pred = [pConnection](const std::unique_ptr<cmConnection>& m) { - return m.get() == pConnection; - }; - { - std::unique_lock<cm::shared_mutex> lock(ConnectionsMutex); - Connections.erase( - std::remove_if(Connections.begin(), Connections.end(), pred), - Connections.end()); - } - - if (Connections.empty()) { - this->ShutdownSignal.send(); - } -} diff --git a/Source/cmServer.h b/Source/cmServer.h deleted file mode 100644 index 9543329..0000000 --- a/Source/cmServer.h +++ /dev/null @@ -1,162 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <memory> -#include <string> -#include <vector> - -#include <cm/shared_mutex> - -#include <cm3p/json/value.h> -#include <cm3p/uv.h> - -#include "cmUVHandlePtr.h" - -class cmConnection; -class cmFileMonitor; -class cmServerProtocol; -class cmServerRequest; -class cmServerResponse; - -/*** - * This essentially hold and manages a libuv event queue and responds to - * messages - * on any of its connections. - */ -class cmServerBase -{ -public: - cmServerBase(cmConnection* connection); - virtual ~cmServerBase(); - - virtual void AddNewConnection(cmConnection* ownedConnection); - - /*** - * The main override responsible for tailoring behavior towards - * whatever the given server is supposed to do - * - * This should almost always be called by the given connections - * directly. - * - * @param connection The connection the request was received on - * @param request The actual request - */ - virtual void ProcessRequest(cmConnection* connection, - const std::string& request) = 0; - virtual void OnConnected(cmConnection* connection); - - /*** - * Start a dedicated thread. If this is used to start the server, it will - * join on the - * servers dtor. - */ - virtual bool StartServeThread(); - virtual bool Serve(std::string* errorMessage); - - virtual void OnServeStart(); - virtual void StartShutDown(); - - virtual bool OnSignal(int signum); - uv_loop_t* GetLoop(); - void Close(); - void OnDisconnect(cmConnection* pConnection); - -protected: - mutable cm::shared_mutex ConnectionsMutex; - std::vector<std::unique_ptr<cmConnection>> Connections; - - bool ServeThreadRunning = false; - uv_thread_t ServeThread; - cm::uv_async_ptr ShutdownSignal; -#ifndef NDEBUG -public: - // When the server starts it will mark down it's current thread ID, - // which is useful in other contexts to just assert that operations - // are performed on that same thread. - uv_thread_t ServeThreadId = {}; - -protected: -#endif - - uv_loop_t Loop; - - cm::uv_signal_ptr SIGINTHandler; - cm::uv_signal_ptr SIGHUPHandler; -}; - -class cmServer : public cmServerBase -{ -public: - class DebugInfo; - - cmServer(cmConnection* conn, bool supportExperimental); - ~cmServer() override; - - cmServer(cmServer const&) = delete; - cmServer& operator=(cmServer const&) = delete; - - bool Serve(std::string* errorMessage) override; - - cmFileMonitor* FileMonitor() const; - -private: - void RegisterProtocol(std::unique_ptr<cmServerProtocol> protocol); - - // Callbacks from cmServerConnection: - - void ProcessRequest(cmConnection* connection, - const std::string& request) override; - std::shared_ptr<cmFileMonitor> fileMonitor; - -public: - void OnServeStart() override; - - void StartShutDown() override; - -public: - void OnConnected(cmConnection* connection) override; - -private: - static void reportProgress(const std::string& msg, float progress, - const cmServerRequest& request); - static void reportMessage(const std::string& msg, const char* title, - const cmServerRequest& request); - - // Handle requests: - cmServerResponse SetProtocolVersion(const cmServerRequest& request); - - void PrintHello(cmConnection* connection) const; - - // Write responses: - void WriteProgress(const cmServerRequest& request, int min, int current, - int max, const std::string& message) const; - void WriteMessage(const cmServerRequest& request, const std::string& message, - const std::string& title) const; - void WriteResponse(cmConnection* connection, - const cmServerResponse& response, - const DebugInfo* debug) const; - void WriteParseError(cmConnection* connection, - const std::string& message) const; - void WriteSignal(const std::string& name, const Json::Value& obj) const; - - void WriteJsonObject(Json::Value const& jsonValue, - const DebugInfo* debug) const; - - void WriteJsonObject(cmConnection* connection, Json::Value const& jsonValue, - const DebugInfo* debug) const; - - static cmServerProtocol* FindMatchingProtocol( - const std::vector<std::unique_ptr<cmServerProtocol>>& protocols, int major, - int minor); - - const bool SupportExperimental; - - cmServerProtocol* Protocol = nullptr; - std::vector<std::unique_ptr<cmServerProtocol>> SupportedProtocols; - - friend class cmServerProtocol; - friend class cmServerRequest; -}; diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx deleted file mode 100644 index b4f41a0..0000000 --- a/Source/cmServerConnection.cxx +++ /dev/null @@ -1,165 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmConfigure.h" - -#include "cmServerConnection.h" - -#include <cm3p/uv.h> - -#include "cmServer.h" -#include "cmServerDictionary.h" - -#ifdef _WIN32 -# include "io.h" -#else -# include <unistd.h> -#endif -#include <cassert> -#include <utility> - -cmStdIoConnection::cmStdIoConnection( - cmConnectionBufferStrategy* bufferStrategy) - : cmEventBasedConnection(bufferStrategy) -{ -} - -cm::uv_stream_ptr cmStdIoConnection::SetupStream(int file_id) -{ - switch (uv_guess_handle(file_id)) { - case UV_TTY: { - cm::uv_tty_ptr tty; - tty.init(*this->Server->GetLoop(), file_id, file_id == 0, - static_cast<cmEventBasedConnection*>(this)); - uv_tty_set_mode(tty, UV_TTY_MODE_NORMAL); - return { std::move(tty) }; - } - case UV_FILE: - if (file_id == 0) { - return nullptr; - } - // Intentional fallthrough; stdin can _not_ be treated as a named - // pipe, however stdout can be. - CM_FALLTHROUGH; - case UV_NAMED_PIPE: { - cm::uv_pipe_ptr pipe; - pipe.init(*this->Server->GetLoop(), 0, - static_cast<cmEventBasedConnection*>(this)); - uv_pipe_open(pipe, file_id); - return { std::move(pipe) }; - } - default: - assert(false && "Unable to determine stream type"); - return nullptr; - } -} - -void cmStdIoConnection::SetServer(cmServerBase* s) -{ - cmConnection::SetServer(s); - if (!s) { - return; - } - - this->ReadStream = SetupStream(0); - this->WriteStream = SetupStream(1); -} - -void shutdown_connection(uv_prepare_t* prepare) -{ - cmStdIoConnection* connection = - static_cast<cmStdIoConnection*>(prepare->data); - - if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(prepare))) { - uv_close(reinterpret_cast<uv_handle_t*>(prepare), - &cmEventBasedConnection::on_close_delete<uv_prepare_t>); - } - connection->OnDisconnect(0); -} - -bool cmStdIoConnection::OnServeStart(std::string* pString) -{ - Server->OnConnected(this); - if (this->ReadStream.get()) { - uv_read_start(this->ReadStream, on_alloc_buffer, on_read); - } else if (uv_guess_handle(0) == UV_FILE) { - char buffer[1024]; - while (auto len = read(0, buffer, sizeof(buffer))) { - ReadData(std::string(buffer, buffer + len)); - } - - // We can't start the disconnect from here, add a prepare hook to do that - // for us - auto prepare = new uv_prepare_t(); - prepare->data = this; - uv_prepare_init(Server->GetLoop(), prepare); - uv_prepare_start(prepare, shutdown_connection); - } - return cmConnection::OnServeStart(pString); -} - -bool cmStdIoConnection::OnConnectionShuttingDown() -{ - if (ReadStream.get()) { - uv_read_stop(ReadStream); - ReadStream->data = nullptr; - } - - this->ReadStream.reset(); - - cmEventBasedConnection::OnConnectionShuttingDown(); - - return true; -} - -cmServerPipeConnection::cmServerPipeConnection(const std::string& name) - : cmPipeConnection(name, new cmServerBufferStrategy) -{ -} - -cmServerStdIoConnection::cmServerStdIoConnection() - : cmStdIoConnection(new cmServerBufferStrategy) -{ -} - -cmConnectionBufferStrategy::~cmConnectionBufferStrategy() = default; - -void cmConnectionBufferStrategy::clear() -{ -} - -std::string cmServerBufferStrategy::BufferOutMessage( - const std::string& rawBuffer) const -{ - return std::string("\n") + kSTART_MAGIC + std::string("\n") + rawBuffer + - kEND_MAGIC + std::string("\n"); -} - -std::string cmServerBufferStrategy::BufferMessage(std::string& RawReadBuffer) -{ - for (;;) { - auto needle = RawReadBuffer.find('\n'); - - if (needle == std::string::npos) { - return ""; - } - std::string line = RawReadBuffer.substr(0, needle); - const auto ls = line.size(); - if (ls > 1 && line.at(ls - 1) == '\r') { - line.erase(ls - 1, 1); - } - RawReadBuffer.erase(RawReadBuffer.begin(), - RawReadBuffer.begin() + static_cast<long>(needle) + 1); - if (line == kSTART_MAGIC) { - RequestBuffer.clear(); - continue; - } - if (line == kEND_MAGIC) { - std::string rtn; - rtn.swap(this->RequestBuffer); - return rtn; - } - - this->RequestBuffer += line; - this->RequestBuffer += "\n"; - } -} diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h deleted file mode 100644 index a70edb4..0000000 --- a/Source/cmServerConnection.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <string> - -#include "cmConnection.h" -#include "cmPipeConnection.h" -#include "cmUVHandlePtr.h" - -class cmServerBase; - -/*** - * This connection buffer strategy accepts messages in the form of - * [== "CMake Server" ==[ -{ - ... some JSON message ... -} -]== "CMake Server" ==] - * and only passes on the core json; it discards the envelope. - */ -class cmServerBufferStrategy : public cmConnectionBufferStrategy -{ -public: - std::string BufferMessage(std::string& rawBuffer) override; - std::string BufferOutMessage(const std::string& rawBuffer) const override; - -private: - std::string RequestBuffer; -}; - -/*** - * Generic connection over std io interfaces -- tty - */ -class cmStdIoConnection : public cmEventBasedConnection -{ -public: - cmStdIoConnection(cmConnectionBufferStrategy* bufferStrategy); - - void SetServer(cmServerBase* s) override; - - bool OnConnectionShuttingDown() override; - - bool OnServeStart(std::string* pString) override; - -private: - cm::uv_stream_ptr SetupStream(int file_id); - cm::uv_stream_ptr ReadStream; -}; - -/*** - * These specific connections use the cmake server - * buffering strategy. - */ -class cmServerStdIoConnection : public cmStdIoConnection -{ -public: - cmServerStdIoConnection(); -}; - -class cmServerPipeConnection : public cmPipeConnection -{ -public: - cmServerPipeConnection(const std::string& name); -}; diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h deleted file mode 100644 index 961e4b7..0000000 --- a/Source/cmServerDictionary.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include <string> - -// Vocabulary: - -static const std::string kDIRTY_SIGNAL = "dirty"; -static const std::string kFILE_CHANGE_SIGNAL = "fileChange"; - -static const std::string kCACHE_TYPE = "cache"; -static const std::string kCMAKE_INPUTS_TYPE = "cmakeInputs"; -static const std::string kCODE_MODEL_TYPE = "codemodel"; -static const std::string kCOMPUTE_TYPE = "compute"; -static const std::string kCONFIGURE_TYPE = "configure"; -static const std::string kERROR_TYPE = "error"; -static const std::string kFILESYSTEM_WATCHERS_TYPE = "fileSystemWatchers"; -static const std::string kGLOBAL_SETTINGS_TYPE = "globalSettings"; -static const std::string kHANDSHAKE_TYPE = "handshake"; -static const std::string kMESSAGE_TYPE = "message"; -static const std::string kPROGRESS_TYPE = "progress"; -static const std::string kREPLY_TYPE = "reply"; -static const std::string kSET_GLOBAL_SETTINGS_TYPE = "setGlobalSettings"; -static const std::string kSIGNAL_TYPE = "signal"; -static const std::string kCTEST_INFO_TYPE = "ctestInfo"; - -static const std::string kBUILD_FILES_KEY = "buildFiles"; -static const std::string kCACHE_ARGUMENTS_KEY = "cacheArguments"; -static const std::string kCACHE_KEY = "cache"; -static const std::string kCAPABILITIES_KEY = "capabilities"; -static const std::string kCHECK_SYSTEM_VARS_KEY = "checkSystemVars"; -static const std::string kCMAKE_ROOT_DIRECTORY_KEY = "cmakeRootDirectory"; -static const std::string kCOOKIE_KEY = "cookie"; -static const std::string kDEBUG_OUTPUT_KEY = "debugOutput"; -static const std::string kERROR_MESSAGE_KEY = "errorMessage"; -static const std::string kEXTRA_GENERATOR_KEY = "extraGenerator"; -static const std::string kGENERATOR_KEY = "generator"; -static const std::string kIS_EXPERIMENTAL_KEY = "isExperimental"; -static const std::string kKEYS_KEY = "keys"; -static const std::string kMAJOR_KEY = "major"; -static const std::string kMESSAGE_KEY = "message"; -static const std::string kMINOR_KEY = "minor"; -static const std::string kPLATFORM_KEY = "platform"; -static const std::string kPROGRESS_CURRENT_KEY = "progressCurrent"; -static const std::string kPROGRESS_MAXIMUM_KEY = "progressMaximum"; -static const std::string kPROGRESS_MESSAGE_KEY = "progressMessage"; -static const std::string kPROGRESS_MINIMUM_KEY = "progressMinimum"; -static const std::string kPROTOCOL_VERSION_KEY = "protocolVersion"; -static const std::string kREPLY_TO_KEY = "inReplyTo"; -static const std::string kSUPPORTED_PROTOCOL_VERSIONS = - "supportedProtocolVersions"; -static const std::string kTITLE_KEY = "title"; -static const std::string kTOOLSET_KEY = "toolset"; -static const std::string kTRACE_EXPAND_KEY = "traceExpand"; -static const std::string kTRACE_KEY = "trace"; -static const std::string kWARN_UNINITIALIZED_KEY = "warnUninitialized"; -static const std::string kWARN_UNUSED_CLI_KEY = "warnUnusedCli"; -static const std::string kWARN_UNUSED_KEY = "warnUnused"; -static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; -static const std::string kWATCHED_FILES_KEY = "watchedFiles"; - -static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==["; -static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]"; - -static const std::string kRENAME_PROPERTY_VALUE = "rename"; -static const std::string kCHANGE_PROPERTY_VALUE = "change"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx deleted file mode 100644 index e586fd9..0000000 --- a/Source/cmServerProtocol.cxx +++ /dev/null @@ -1,760 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmServerProtocol.h" - -#include <algorithm> -#include <cassert> -#include <functional> -#include <string> -#include <utility> -#include <vector> - -#include <cm/memory> -#include <cmext/algorithm> - -#include <cm3p/uv.h> - -#include "cmExternalMakefileProjectGenerator.h" -#include "cmFileMonitor.h" -#include "cmGlobalGenerator.h" -#include "cmJsonObjectDictionary.h" -#include "cmJsonObjects.h" -#include "cmMessageType.h" -#include "cmProperty.h" -#include "cmServer.h" -#include "cmServerDictionary.h" -#include "cmState.h" -#include "cmSystemTools.h" -#include "cmake.h" - -// Get rid of some windows macros: -#undef max - -namespace { - -std::vector<std::string> toStringList(const Json::Value& in) -{ - std::vector<std::string> result; - for (auto const& it : in) { - result.push_back(it.asString()); - } - return result; -} - -} // namespace - -cmServerRequest::cmServerRequest(cmServer* server, cmConnection* connection, - std::string t, std::string c, Json::Value d) - : Type(std::move(t)) - , Cookie(std::move(c)) - , Data(std::move(d)) - , Connection(connection) - , m_Server(server) -{ -} - -void cmServerRequest::ReportProgress(int min, int current, int max, - const std::string& message) const -{ - this->m_Server->WriteProgress(*this, min, current, max, message); -} - -void cmServerRequest::ReportMessage(const std::string& message, - const std::string& title) const -{ - m_Server->WriteMessage(*this, message, title); -} - -cmServerResponse cmServerRequest::Reply(const Json::Value& data) const -{ - cmServerResponse response(*this); - response.SetData(data); - return response; -} - -cmServerResponse cmServerRequest::ReportError(const std::string& message) const -{ - cmServerResponse response(*this); - response.SetError(message); - return response; -} - -cmServerResponse::cmServerResponse(const cmServerRequest& request) - : Type(request.Type) - , Cookie(request.Cookie) -{ -} - -void cmServerResponse::SetData(const Json::Value& data) -{ - assert(this->m_Payload == PAYLOAD_UNKNOWN); - if (!data[kCOOKIE_KEY].isNull() || !data[kTYPE_KEY].isNull()) { - this->SetError("Response contains cookie or type field."); - return; - } - this->m_Payload = PAYLOAD_DATA; - this->m_Data = data; -} - -void cmServerResponse::SetError(const std::string& message) -{ - assert(this->m_Payload == PAYLOAD_UNKNOWN); - this->m_Payload = PAYLOAD_ERROR; - this->m_ErrorMessage = message; -} - -bool cmServerResponse::IsComplete() const -{ - return this->m_Payload != PAYLOAD_UNKNOWN; -} - -bool cmServerResponse::IsError() const -{ - assert(this->m_Payload != PAYLOAD_UNKNOWN); - return this->m_Payload == PAYLOAD_ERROR; -} - -std::string cmServerResponse::ErrorMessage() const -{ - if (this->m_Payload == PAYLOAD_ERROR) { - return this->m_ErrorMessage; - } - return std::string(); -} - -Json::Value cmServerResponse::Data() const -{ - assert(this->m_Payload != PAYLOAD_UNKNOWN); - return this->m_Data; -} - -bool cmServerProtocol::Activate(cmServer* server, - const cmServerRequest& request, - std::string* errorMessage) -{ - assert(server); - this->m_Server = server; - this->m_CMakeInstance = - cm::make_unique<cmake>(cmake::RoleProject, cmState::Project); - this->m_WarnUnused = false; - const bool result = this->DoActivate(request, errorMessage); - if (!result) { - this->m_CMakeInstance = nullptr; - } - return result; -} - -cmFileMonitor* cmServerProtocol::FileMonitor() const -{ - return this->m_Server ? this->m_Server->FileMonitor() : nullptr; -} - -void cmServerProtocol::SendSignal(const std::string& name, - const Json::Value& data) const -{ - if (this->m_Server) { - this->m_Server->WriteSignal(name, data); - } -} - -cmake* cmServerProtocol::CMakeInstance() const -{ - return this->m_CMakeInstance.get(); -} - -bool cmServerProtocol::DoActivate(const cmServerRequest& /*request*/, - std::string* /*errorMessage*/) -{ - return true; -} - -std::pair<int, int> cmServerProtocol1::ProtocolVersion() const -{ - return { 1, 2 }; -} - -static void setErrorMessage(std::string* errorMessage, const std::string& text) -{ - if (errorMessage) { - *errorMessage = text; - } -} - -static bool getOrTestHomeDirectory(cmState* state, std::string& value, - std::string* errorMessage) -{ - const std::string cachedValue = - *state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); - if (value.empty()) { - value = cachedValue; - return true; - } - const std::string suffix = "/CMakeLists.txt"; - const std::string cachedValueCML = cachedValue + suffix; - const std::string valueCML = value + suffix; - if (!cmSystemTools::SameFile(valueCML, cachedValueCML)) { - setErrorMessage(errorMessage, - std::string("\"CMAKE_HOME_DIRECTORY\" is set but " - "incompatible with configured " - "source directory value.")); - return false; - } - return true; -} - -static bool getOrTestValue(cmState* state, const std::string& key, - std::string& value, - const std::string& keyDescription, - std::string* errorMessage) -{ - const std::string cachedValue = state->GetSafeCacheEntryValue(key); - if (value.empty()) { - value = cachedValue; - } - if (!cachedValue.empty() && cachedValue != value) { - setErrorMessage(errorMessage, - std::string("\"") + key + - "\" is set but incompatible with configured " + - keyDescription + " value."); - return false; - } - return true; -} - -bool cmServerProtocol1::DoActivate(const cmServerRequest& request, - std::string* errorMessage) -{ - std::string sourceDirectory = request.Data[kSOURCE_DIRECTORY_KEY].asString(); - std::string buildDirectory = request.Data[kBUILD_DIRECTORY_KEY].asString(); - std::string generator = request.Data[kGENERATOR_KEY].asString(); - std::string extraGenerator = request.Data[kEXTRA_GENERATOR_KEY].asString(); - std::string toolset = request.Data[kTOOLSET_KEY].asString(); - std::string platform = request.Data[kPLATFORM_KEY].asString(); - - // normalize source and build directory - if (!sourceDirectory.empty()) { - sourceDirectory = cmSystemTools::CollapseFullPath(sourceDirectory); - cmSystemTools::ConvertToUnixSlashes(sourceDirectory); - } - if (!buildDirectory.empty()) { - buildDirectory = cmSystemTools::CollapseFullPath(buildDirectory); - cmSystemTools::ConvertToUnixSlashes(buildDirectory); - } - - if (buildDirectory.empty()) { - setErrorMessage(errorMessage, - std::string("\"") + kBUILD_DIRECTORY_KEY + - "\" is missing."); - return false; - } - - cmake* cm = CMakeInstance(); - if (cmSystemTools::PathExists(buildDirectory)) { - if (!cmSystemTools::FileIsDirectory(buildDirectory)) { - setErrorMessage(errorMessage, - std::string("\"") + kBUILD_DIRECTORY_KEY + - "\" exists but is not a directory."); - return false; - } - - const std::string cachePath = cmake::FindCacheFile(buildDirectory); - if (cm->LoadCache(cachePath)) { - cmState* state = cm->GetState(); - - // Check generator: - if (!getOrTestValue(state, "CMAKE_GENERATOR", generator, "generator", - errorMessage)) { - return false; - } - - // check extra generator: - if (!getOrTestValue(state, "CMAKE_EXTRA_GENERATOR", extraGenerator, - "extra generator", errorMessage)) { - return false; - } - - // check sourcedir: - if (!getOrTestHomeDirectory(state, sourceDirectory, errorMessage)) { - return false; - } - - // check toolset: - if (!getOrTestValue(state, "CMAKE_GENERATOR_TOOLSET", toolset, "toolset", - errorMessage)) { - return false; - } - - // check platform: - if (!getOrTestValue(state, "CMAKE_GENERATOR_PLATFORM", platform, - "platform", errorMessage)) { - return false; - } - } - } - - if (sourceDirectory.empty()) { - setErrorMessage(errorMessage, - std::string("\"") + kSOURCE_DIRECTORY_KEY + - "\" is unset but required."); - return false; - } - if (!cmSystemTools::FileIsDirectory(sourceDirectory)) { - setErrorMessage(errorMessage, - std::string("\"") + kSOURCE_DIRECTORY_KEY + - "\" is not a directory."); - return false; - } - if (generator.empty()) { - setErrorMessage(errorMessage, - std::string("\"") + kGENERATOR_KEY + - "\" is unset but required."); - return false; - } - - std::vector<cmake::GeneratorInfo> generators; - cm->GetRegisteredGenerators(generators); - auto baseIt = std::find_if(generators.begin(), generators.end(), - [&generator](const cmake::GeneratorInfo& info) { - return info.name == generator; - }); - if (baseIt == generators.end()) { - setErrorMessage(errorMessage, - std::string("Generator \"") + generator + - "\" not supported."); - return false; - } - auto extraIt = std::find_if( - generators.begin(), generators.end(), - [&generator, &extraGenerator](const cmake::GeneratorInfo& info) { - return info.baseName == generator && info.extraName == extraGenerator; - }); - if (extraIt == generators.end()) { - setErrorMessage(errorMessage, - std::string("The combination of generator \"" + generator + - "\" and extra generator \"" + extraGenerator + - "\" is not supported.")); - return false; - } - if (!extraIt->supportsToolset && !toolset.empty()) { - setErrorMessage(errorMessage, - std::string("Toolset was provided but is not supported by " - "the requested generator.")); - return false; - } - if (!extraIt->supportsPlatform && !platform.empty()) { - setErrorMessage(errorMessage, - std::string("Platform was provided but is not supported " - "by the requested generator.")); - return false; - } - - this->GeneratorInfo = - GeneratorInformation(generator, extraGenerator, toolset, platform, - sourceDirectory, buildDirectory); - - this->m_State = STATE_ACTIVE; - return true; -} - -void cmServerProtocol1::HandleCMakeFileChanges(const std::string& path, - int event, int status) -{ - assert(status == 0); - static_cast<void>(status); - - if (!m_isDirty) { - m_isDirty = true; - SendSignal(kDIRTY_SIGNAL, Json::objectValue); - } - Json::Value obj = Json::objectValue; - obj[kPATH_KEY] = path; - Json::Value properties = Json::arrayValue; - if (event & UV_RENAME) { - properties.append(kRENAME_PROPERTY_VALUE); - } - if (event & UV_CHANGE) { - properties.append(kCHANGE_PROPERTY_VALUE); - } - - obj[kPROPERTIES_KEY] = properties; - SendSignal(kFILE_CHANGE_SIGNAL, obj); -} - -cmServerResponse cmServerProtocol1::Process(const cmServerRequest& request) -{ - assert(this->m_State >= STATE_ACTIVE); - - if (request.Type == kCACHE_TYPE) { - return this->ProcessCache(request); - } - if (request.Type == kCMAKE_INPUTS_TYPE) { - return this->ProcessCMakeInputs(request); - } - if (request.Type == kCODE_MODEL_TYPE) { - return this->ProcessCodeModel(request); - } - if (request.Type == kCOMPUTE_TYPE) { - return this->ProcessCompute(request); - } - if (request.Type == kCONFIGURE_TYPE) { - return this->ProcessConfigure(request); - } - if (request.Type == kFILESYSTEM_WATCHERS_TYPE) { - return this->ProcessFileSystemWatchers(request); - } - if (request.Type == kGLOBAL_SETTINGS_TYPE) { - return this->ProcessGlobalSettings(request); - } - if (request.Type == kSET_GLOBAL_SETTINGS_TYPE) { - return this->ProcessSetGlobalSettings(request); - } - if (request.Type == kCTEST_INFO_TYPE) { - return this->ProcessCTests(request); - } - - return request.ReportError("Unknown command!"); -} - -bool cmServerProtocol1::IsExperimental() const -{ - return true; -} - -cmServerResponse cmServerProtocol1::ProcessCache( - const cmServerRequest& request) -{ - cmState* state = this->CMakeInstance()->GetState(); - - Json::Value result = Json::objectValue; - - std::vector<std::string> allKeys = state->GetCacheEntryKeys(); - - Json::Value list = Json::arrayValue; - std::vector<std::string> keys = toStringList(request.Data[kKEYS_KEY]); - if (keys.empty()) { - keys = allKeys; - } else { - for (auto const& i : keys) { - if (!cm::contains(allKeys, i)) { - return request.ReportError("Key \"" + i + "\" not found in cache."); - } - } - } - std::sort(keys.begin(), keys.end()); - for (auto const& key : keys) { - Json::Value entry = Json::objectValue; - entry[kKEY_KEY] = key; - entry[kTYPE_KEY] = - cmState::CacheEntryTypeToString(state->GetCacheEntryType(key)); - entry[kVALUE_KEY] = *state->GetCacheEntryValue(key); - - Json::Value props = Json::objectValue; - bool haveProperties = false; - for (auto const& prop : state->GetCacheEntryPropertyList(key)) { - haveProperties = true; - props[prop] = *state->GetCacheEntryProperty(key, prop); - } - if (haveProperties) { - entry[kPROPERTIES_KEY] = props; - } - - list.append(entry); - } - - result[kCACHE_KEY] = list; - return request.Reply(result); -} - -cmServerResponse cmServerProtocol1::ProcessCMakeInputs( - const cmServerRequest& request) -{ - if (this->m_State < STATE_CONFIGURED) { - return request.ReportError("This instance was not yet configured."); - } - - const cmake* cm = this->CMakeInstance(); - const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot(); - const std::string& sourceDir = cm->GetHomeDirectory(); - - Json::Value result = Json::objectValue; - result[kSOURCE_DIRECTORY_KEY] = sourceDir; - result[kCMAKE_ROOT_DIRECTORY_KEY] = cmakeRootDir; - result[kBUILD_FILES_KEY] = cmDumpCMakeInputs(cm); - return request.Reply(result); -} - -cmServerResponse cmServerProtocol1::ProcessCodeModel( - const cmServerRequest& request) -{ - if (this->m_State != STATE_COMPUTED) { - return request.ReportError("No build system was generated yet."); - } - - return request.Reply(cmDumpCodeModel(this->CMakeInstance())); -} - -cmServerResponse cmServerProtocol1::ProcessCompute( - const cmServerRequest& request) -{ - if (this->m_State > STATE_CONFIGURED) { - return request.ReportError("This build system was already generated."); - } - if (this->m_State < STATE_CONFIGURED) { - return request.ReportError("This project was not configured yet."); - } - - cmake* cm = this->CMakeInstance(); - int ret = cm->Generate(); - - if (ret < 0) { - return request.ReportError("Failed to compute build system."); - } - m_State = STATE_COMPUTED; - return request.Reply(Json::Value()); -} - -cmServerResponse cmServerProtocol1::ProcessConfigure( - const cmServerRequest& request) -{ - if (this->m_State == STATE_INACTIVE) { - return request.ReportError("This instance is inactive."); - } - - FileMonitor()->StopMonitoring(); - - std::string errorMessage; - cmake* cm = this->CMakeInstance(); - this->GeneratorInfo.SetupGenerator(cm, &errorMessage); - if (!errorMessage.empty()) { - return request.ReportError(errorMessage); - } - - // Make sure the types of cacheArguments matches (if given): - std::vector<std::string> cacheArgs = { "unused" }; - bool cacheArgumentsError = false; - const Json::Value passedArgs = request.Data[kCACHE_ARGUMENTS_KEY]; - if (!passedArgs.isNull()) { - if (passedArgs.isString()) { - cacheArgs.push_back(passedArgs.asString()); - } else if (passedArgs.isArray()) { - for (auto const& arg : passedArgs) { - if (!arg.isString()) { - cacheArgumentsError = true; - break; - } - cacheArgs.push_back(arg.asString()); - } - } else { - cacheArgumentsError = true; - } - } - if (cacheArgumentsError) { - request.ReportError( - "cacheArguments must be unset, a string or an array of strings."); - } - - std::string sourceDir = cm->GetHomeDirectory(); - const std::string buildDir = cm->GetHomeOutputDirectory(); - - cmGlobalGenerator* gg = cm->GetGlobalGenerator(); - - if (buildDir.empty()) { - return request.ReportError("No build directory set via Handshake."); - } - - if (cm->LoadCache(buildDir)) { - // build directory has been set up before - cmProp cachedSourceDir = - cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); - if (!cachedSourceDir) { - return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache."); - } - if (sourceDir.empty()) { - sourceDir = *cachedSourceDir; - cm->SetHomeDirectory(sourceDir); - } - - cmProp cachedGenerator = - cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR"); - if (cachedGenerator) { - if (gg && gg->GetName() != *cachedGenerator) { - return request.ReportError("Configured generator does not match with " - "CMAKE_GENERATOR found in cache."); - } - } - } else { - // build directory has not been set up before - if (sourceDir.empty()) { - return request.ReportError("No sourceDirectory set via " - "setGlobalSettings and no cache found in " - "buildDirectory."); - } - } - - cmSystemTools::ResetErrorOccuredFlag(); // Reset error state - - if (cm->AddCMakePaths() != 1) { - return request.ReportError("Failed to set CMake paths."); - } - - if (!cm->SetCacheArgs(cacheArgs)) { - return request.ReportError("cacheArguments could not be set."); - } - - int ret = cm->Configure(); - cm->IssueMessage( - MessageType::DEPRECATION_WARNING, - "The 'cmake-server(7)' is deprecated. " - "Please port clients to use the 'cmake-file-api(7)' instead."); - if (ret < 0) { - return request.ReportError("Configuration failed."); - } - - std::vector<std::string> toWatchList; - cmGetCMakeInputs(gg, std::string(), buildDir, nullptr, &toWatchList, - nullptr); - - FileMonitor()->MonitorPaths(toWatchList, - [this](const std::string& p, int e, int s) { - this->HandleCMakeFileChanges(p, e, s); - }); - - m_State = STATE_CONFIGURED; - m_isDirty = false; - return request.Reply(Json::Value()); -} - -cmServerResponse cmServerProtocol1::ProcessGlobalSettings( - const cmServerRequest& request) -{ - cmake* cm = this->CMakeInstance(); - Json::Value obj = Json::objectValue; - - // Capabilities information: - obj[kCAPABILITIES_KEY] = cm->ReportCapabilitiesJson(); - - obj[kDEBUG_OUTPUT_KEY] = cm->GetDebugOutput(); - obj[kTRACE_KEY] = cm->GetTrace(); - obj[kTRACE_EXPAND_KEY] = cm->GetTraceExpand(); - obj[kWARN_UNINITIALIZED_KEY] = cm->GetWarnUninitialized(); - obj[kWARN_UNUSED_KEY] = m_WarnUnused; - obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli(); - obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars(); - - obj[kSOURCE_DIRECTORY_KEY] = this->GeneratorInfo.SourceDirectory; - obj[kBUILD_DIRECTORY_KEY] = this->GeneratorInfo.BuildDirectory; - - // Currently used generator: - obj[kGENERATOR_KEY] = this->GeneratorInfo.GeneratorName; - obj[kEXTRA_GENERATOR_KEY] = this->GeneratorInfo.ExtraGeneratorName; - - return request.Reply(obj); -} - -static void setBool(const cmServerRequest& request, const std::string& key, - std::function<void(bool)> const& setter) -{ - if (request.Data[key].isNull()) { - return; - } - setter(request.Data[key].asBool()); -} - -cmServerResponse cmServerProtocol1::ProcessSetGlobalSettings( - const cmServerRequest& request) -{ - const std::vector<std::string> boolValues = { - kDEBUG_OUTPUT_KEY, kTRACE_KEY, kTRACE_EXPAND_KEY, - kWARN_UNINITIALIZED_KEY, kWARN_UNUSED_KEY, kWARN_UNUSED_CLI_KEY, - kCHECK_SYSTEM_VARS_KEY - }; - for (std::string const& i : boolValues) { - if (!request.Data[i].isNull() && !request.Data[i].isBool()) { - return request.ReportError("\"" + i + - "\" must be unset or a bool value."); - } - } - - cmake* cm = this->CMakeInstance(); - - setBool(request, kDEBUG_OUTPUT_KEY, - [cm](bool e) { cm->SetDebugOutputOn(e); }); - setBool(request, kTRACE_KEY, [cm](bool e) { cm->SetTrace(e); }); - setBool(request, kTRACE_EXPAND_KEY, [cm](bool e) { cm->SetTraceExpand(e); }); - setBool(request, kWARN_UNINITIALIZED_KEY, - [cm](bool e) { cm->SetWarnUninitialized(e); }); - setBool(request, kWARN_UNUSED_KEY, [this](bool e) { m_WarnUnused = e; }); - setBool(request, kWARN_UNUSED_CLI_KEY, - [cm](bool e) { cm->SetWarnUnusedCli(e); }); - setBool(request, kCHECK_SYSTEM_VARS_KEY, - [cm](bool e) { cm->SetCheckSystemVars(e); }); - - return request.Reply(Json::Value()); -} - -cmServerResponse cmServerProtocol1::ProcessFileSystemWatchers( - const cmServerRequest& request) -{ - const cmFileMonitor* const fm = FileMonitor(); - Json::Value result = Json::objectValue; - Json::Value files = Json::arrayValue; - for (auto const& f : fm->WatchedFiles()) { - files.append(f); - } - Json::Value directories = Json::arrayValue; - for (auto const& d : fm->WatchedDirectories()) { - directories.append(d); - } - result[kWATCHED_FILES_KEY] = files; - result[kWATCHED_DIRECTORIES_KEY] = directories; - - return request.Reply(result); -} - -cmServerResponse cmServerProtocol1::ProcessCTests( - const cmServerRequest& request) -{ - if (this->m_State < STATE_COMPUTED) { - return request.ReportError("This instance was not yet computed."); - } - - return request.Reply(cmDumpCTestInfo(this->CMakeInstance())); -} - -cmServerProtocol1::GeneratorInformation::GeneratorInformation( - std::string generatorName, std::string extraGeneratorName, - std::string toolset, std::string platform, std::string sourceDirectory, - std::string buildDirectory) - : GeneratorName(std::move(generatorName)) - , ExtraGeneratorName(std::move(extraGeneratorName)) - , Toolset(std::move(toolset)) - , Platform(std::move(platform)) - , SourceDirectory(std::move(sourceDirectory)) - , BuildDirectory(std::move(buildDirectory)) -{ -} - -void cmServerProtocol1::GeneratorInformation::SetupGenerator( - cmake* cm, std::string* errorMessage) -{ - const std::string fullGeneratorName = - cmExternalMakefileProjectGenerator::CreateFullGeneratorName( - GeneratorName, ExtraGeneratorName); - - cm->SetHomeDirectory(SourceDirectory); - cm->SetHomeOutputDirectory(BuildDirectory); - - auto gg = cm->CreateGlobalGenerator(fullGeneratorName); - if (!gg) { - setErrorMessage( - errorMessage, - std::string("Could not set up the requested combination of \"") + - kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\""); - return; - } - - cm->SetGlobalGenerator(std::move(gg)); - - cm->SetGeneratorToolset(Toolset); - cm->SetGeneratorPlatform(Platform); -} diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h deleted file mode 100644 index 6009e23..0000000 --- a/Source/cmServerProtocol.h +++ /dev/null @@ -1,162 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <memory> -#include <string> -#include <utility> - -#include <cm3p/json/value.h> - -#include "cmake.h" - -class cmConnection; -class cmFileMonitor; -class cmServer; -class cmServerRequest; - -class cmServerResponse -{ -public: - explicit cmServerResponse(const cmServerRequest& request); - - void SetData(const Json::Value& data); - void SetError(const std::string& message); - - bool IsComplete() const; - bool IsError() const; - std::string ErrorMessage() const; - Json::Value Data() const; - - const std::string Type; - const std::string Cookie; - -private: - enum PayLoad - { - PAYLOAD_UNKNOWN, - PAYLOAD_ERROR, - PAYLOAD_DATA - }; - PayLoad m_Payload = PAYLOAD_UNKNOWN; - std::string m_ErrorMessage; - Json::Value m_Data; -}; - -class cmServerRequest -{ -public: - cmServerResponse Reply(const Json::Value& data) const; - cmServerResponse ReportError(const std::string& message) const; - - const std::string Type; - const std::string Cookie; - const Json::Value Data; - cmConnection* Connection; - -private: - cmServerRequest(cmServer* server, cmConnection* connection, std::string t, - std::string c, Json::Value d); - - void ReportProgress(int min, int current, int max, - const std::string& message) const; - void ReportMessage(const std::string& message, - const std::string& title) const; - - cmServer* m_Server; - - friend class cmServer; -}; - -class cmServerProtocol -{ -public: - cmServerProtocol() = default; - virtual ~cmServerProtocol() = default; - - cmServerProtocol(cmServerProtocol const&) = delete; - cmServerProtocol& operator=(cmServerProtocol const&) = delete; - - virtual std::pair<int, int> ProtocolVersion() const = 0; - virtual bool IsExperimental() const = 0; - virtual cmServerResponse Process(const cmServerRequest& request) = 0; - - bool Activate(cmServer* server, const cmServerRequest& request, - std::string* errorMessage); - - cmFileMonitor* FileMonitor() const; - void SendSignal(const std::string& name, const Json::Value& data) const; - -protected: - cmake* CMakeInstance() const; - // Implement protocol specific activation tasks here. Called from Activate(). - virtual bool DoActivate(const cmServerRequest& request, - std::string* errorMessage); - bool m_WarnUnused = false; // storage for legacy option - -private: - std::unique_ptr<cmake> m_CMakeInstance; - cmServer* m_Server = nullptr; // not owned! - - friend class cmServer; -}; - -class cmServerProtocol1 : public cmServerProtocol -{ -public: - std::pair<int, int> ProtocolVersion() const override; - bool IsExperimental() const override; - cmServerResponse Process(const cmServerRequest& request) override; - -private: - bool DoActivate(const cmServerRequest& request, - std::string* errorMessage) override; - - void HandleCMakeFileChanges(const std::string& path, int event, int status); - - // Handle requests: - cmServerResponse ProcessCache(const cmServerRequest& request); - cmServerResponse ProcessCMakeInputs(const cmServerRequest& request); - cmServerResponse ProcessCodeModel(const cmServerRequest& request); - cmServerResponse ProcessCompute(const cmServerRequest& request); - cmServerResponse ProcessConfigure(const cmServerRequest& request); - cmServerResponse ProcessGlobalSettings(const cmServerRequest& request); - cmServerResponse ProcessSetGlobalSettings(const cmServerRequest& request); - cmServerResponse ProcessFileSystemWatchers(const cmServerRequest& request); - cmServerResponse ProcessCTests(const cmServerRequest& request); - - enum State - { - STATE_INACTIVE, - STATE_ACTIVE, - STATE_CONFIGURED, - STATE_COMPUTED - }; - State m_State = STATE_INACTIVE; - - bool m_isDirty = false; - - struct GeneratorInformation - { - public: - GeneratorInformation() = default; - GeneratorInformation(std::string generatorName, - std::string extraGeneratorName, std::string toolset, - std::string platform, std::string sourceDirectory, - std::string buildDirectory); - - void SetupGenerator(cmake* cm, std::string* errorMessage); - - std::string GeneratorName; - std::string ExtraGeneratorName; - std::string Toolset; - std::string Platform; - - std::string SourceDirectory; - std::string BuildDirectory; - }; - - GeneratorInformation GeneratorInfo; -}; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index df6a38a..970564d 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -10,9 +10,12 @@ #include "cmGlobalGenerator.h" #include "cmInstalledFile.h" #include "cmMakefile.h" +#include "cmMessageType.h" +#include "cmPolicies.h" #include "cmProperty.h" #include "cmRange.h" #include "cmSourceFile.h" +#include "cmSourceFileLocation.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -157,7 +160,7 @@ bool HandleSourceFileDirectoryScopeValidation( return true; } -bool HandleAndValidateSourceFileDirectortoryScopes( +bool HandleAndValidateSourceFileDirectoryScopes( cmExecutionStatus& status, bool source_file_directory_option_enabled, bool source_file_target_option_enabled, std::vector<std::string>& source_file_directories, @@ -216,8 +219,92 @@ void MakeSourceFilePathsAbsoluteIfNeeded( source_files_absolute_paths.push_back(absolute_file_path); } } + +bool HandleAndValidateSourceFilePropertyGENERATED( + cmSourceFile* sf, std::string const& propertyValue, PropertyOp op) +{ + auto& mf = *sf->GetLocation().GetMakefile(); + auto policyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118); + + const bool policyWARN = policyStatus == cmPolicies::WARN; + const bool policyNEW = policyStatus != cmPolicies::OLD && !policyWARN; + + if (policyWARN) { + if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) { + mf.IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0118), + "\nAttempt to set property 'GENERATED' with the following " + "non-boolean value (which will be interpreted as \"0\"):\n", + propertyValue, + "\nThat exact value will not be retrievable. A value of " + "\"0\" will be returned instead.\n" + "This will be an error under policy CMP0118.\n")); + } + if (cmIsOff(propertyValue)) { + mf.IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0118), + "\nUnsetting property 'GENERATED' will not be allowed under " + "policy CMP0118!\n")); + } + if (op == PropertyOp::Append || op == PropertyOp::AppendAsString) { + mf.IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0118), + "\nAppending to property 'GENERATED' will not be allowed " + "under policy CMP0118!\n")); + } + } else if (policyNEW) { + if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) { + mf.IssueMessage( + MessageType::AUTHOR_ERROR, + cmStrCat( + "Policy CMP0118 is set to NEW and the following non-boolean value " + "given for property 'GENERATED' is therefore not allowed:\n", + propertyValue, "\nReplace it with a boolean value!\n")); + return true; + } + if (cmIsOff(propertyValue)) { + mf.IssueMessage( + MessageType::AUTHOR_ERROR, + "Unsetting the 'GENERATED' property is not allowed under CMP0118!\n"); + return true; + } + if (op == PropertyOp::Append || op == PropertyOp::AppendAsString) { + mf.IssueMessage(MessageType::AUTHOR_ERROR, + "Policy CMP0118 is set to NEW and appending to the " + "'GENERATED' property is therefore not allowed. Only " + "setting it to \"1\" is allowed!\n"); + return true; + } + } + + // Set property. + if (!policyNEW) { + // Do it the traditional way. + switch (op) { + case PropertyOp::Append: + sf->AppendProperty("GENERATED", propertyValue, false); + break; + case PropertyOp::AppendAsString: + sf->AppendProperty("GENERATED", propertyValue, true); + break; + case PropertyOp::Remove: + sf->SetProperty("GENERATED", nullptr); + break; + case PropertyOp::Set: + sf->SetProperty("GENERATED", propertyValue.c_str()); + break; + } + } else { + sf->MarkAsGenerated(); + } + return true; } +} // END: namespace SetPropertyCommand + bool cmSetPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { @@ -324,7 +411,7 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args, std::vector<cmMakefile*> source_file_directory_makefiles; bool file_scopes_handled = - SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes( + SetPropertyCommand::HandleAndValidateSourceFileDirectoryScopes( status, source_file_directory_option_enabled, source_file_target_option_enabled, source_file_directories, source_file_target_directories, source_file_directory_makefiles); @@ -367,7 +454,7 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args, return true; } -namespace { +namespace /* anonymous */ { bool HandleGlobalMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, @@ -525,6 +612,18 @@ bool HandleSource(cmSourceFile* sf, const std::string& propertyName, const std::string& propertyValue, bool appendAsString, bool appendMode, bool remove) { + // Special validation and handling of GENERATED flag? + if (propertyName == "GENERATED") { + SetPropertyCommand::PropertyOp op = (remove) + ? SetPropertyCommand::PropertyOp::Remove + : (appendAsString) + ? SetPropertyCommand::PropertyOp::AppendAsString + : (appendMode) ? SetPropertyCommand::PropertyOp::Append + : SetPropertyCommand::PropertyOp::Set; + return SetPropertyCommand::HandleAndValidateSourceFilePropertyGENERATED( + sf, propertyValue, op); + } + // Set or append the property. if (appendMode) { sf->AppendProperty(propertyName, propertyValue, appendAsString); diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 89fdd9a..05c4873 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -9,6 +9,7 @@ class cmMakefile; class cmExecutionStatus; +class cmSourceFile; bool cmSetPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status); @@ -25,7 +26,7 @@ bool HandleSourceFileDirectoryScopeValidation( std::vector<std::string>& source_file_directories, std::vector<std::string>& source_file_target_directories); -bool HandleAndValidateSourceFileDirectortoryScopes( +bool HandleAndValidateSourceFileDirectoryScopes( cmExecutionStatus& status, bool source_directories_option_encountered, bool source_target_directories_option_encountered, std::vector<std::string>& source_directories, @@ -39,4 +40,16 @@ void MakeSourceFilePathsAbsoluteIfNeeded( std::vector<std::string>& source_files_absolute_paths, std::vector<std::string>::const_iterator files_it_begin, std::vector<std::string>::const_iterator files_it_end, bool needed); + +enum class PropertyOp +{ + Remove, + Set, + Append, + AppendAsString +}; + +bool HandleAndValidateSourceFilePropertyGENERATED( + cmSourceFile* sf, std::string const& propertyValue, + PropertyOp op = PropertyOp::Set); } diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index c1b0c28..742aa96 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -7,6 +7,7 @@ #include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmMakefile.h" @@ -82,7 +83,7 @@ bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args, const auto props_begin = options_it; bool file_scopes_handled = - SetPropertyCommand::HandleAndValidateSourceFileDirectortoryScopes( + SetPropertyCommand::HandleAndValidateSourceFileDirectoryScopes( status, source_file_directory_option_enabled, source_file_target_option_enabled, source_file_directories, source_file_target_directories, source_file_directory_makefiles); @@ -167,7 +168,13 @@ static bool RunCommandForScope( if (cmSourceFile* sf = mf->GetOrCreateSource(sfname)) { // loop through the props and set them for (auto k = propertyPairs.begin(); k != propertyPairs.end(); k += 2) { - sf->SetProperty(*k, (k + 1)->c_str()); + // Special handling for GENERATED property? + if (*k == "GENERATED"_s) { + SetPropertyCommand::HandleAndValidateSourceFilePropertyGENERATED( + sf, *(k + 1)); + } else { + sf->SetProperty(*k, (k + 1)->c_str()); + } } } } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index ef44a57..9d9a7c3 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -8,6 +8,7 @@ #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" +#include "cmPolicies.h" #include "cmProperty.h" #include "cmState.h" #include "cmStringAlgorithms.h" @@ -15,9 +16,12 @@ #include "cmake.h" cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name, - cmSourceFileLocationKind kind) - : Location(mf, name, kind) + bool generated, cmSourceFileLocationKind kind) + : Location(mf, name, (!generated) ? kind : cmSourceFileLocationKind::Known) { + if (generated) { + this->MarkAsGenerated(); + } } std::string const& cmSourceFile::GetExtension() const @@ -25,6 +29,8 @@ std::string const& cmSourceFile::GetExtension() const return this->Extension; } +const std::string propTRUE = "1"; +const std::string propFALSE = "0"; const std::string cmSourceFile::propLANGUAGE = "LANGUAGE"; const std::string cmSourceFile::propLOCATION = "LOCATION"; const std::string cmSourceFile::propGENERATED = "GENERATED"; @@ -54,16 +60,14 @@ std::string const& cmSourceFile::GetOrDetermineLanguage() } // Perform computation needed to get the language if necessary. - if (this->FullPath.empty() && this->Language.empty()) { - // If a known extension is given or a known full path is given - // then trust that the current extension is sufficient to - // determine the language. This will fail only if the user - // specifies a full path to the source but leaves off the - // extension, which is kind of weird. - if (this->Location.ExtensionIsAmbiguous() && + if (this->Language.empty()) { + // If a known extension is given or a known full path is given then trust + // that the current extension is sufficient to determine the language. This + // will fail only if the user specifies a full path to the source but + // leaves off the extension, which is kind of weird. + if (this->FullPath.empty() && this->Location.ExtensionIsAmbiguous() && this->Location.DirectoryIsAmbiguous()) { - // Finalize the file location to get the extension and set the - // language. + // Finalize the file location to get the extension and set the language. this->ResolveFullPath(); } else { // Use the known extension to get the language if possible. @@ -93,10 +97,11 @@ cmSourceFileLocation const& cmSourceFile::GetLocation() const return this->Location; } -std::string const& cmSourceFile::ResolveFullPath(std::string* error) +std::string const& cmSourceFile::ResolveFullPath(std::string* error, + std::string* cmp0115Warning) { if (this->FullPath.empty()) { - if (this->FindFullPath(error)) { + if (this->FindFullPath(error, cmp0115Warning)) { this->CheckExtension(); } } @@ -108,14 +113,18 @@ std::string const& cmSourceFile::GetFullPath() const return this->FullPath; } -bool cmSourceFile::FindFullPath(std::string* error) +bool cmSourceFile::FindFullPath(std::string* error, + std::string* cmp0115Warning) { // If the file is generated compute the location without checking on disk. - if (this->GetIsGenerated()) { + // Note: We also check for a locally set GENERATED property, because + // it might have been set before policy CMP0118 was set to NEW. + if (this->GetIsGenerated(CheckScope::GlobalAndLocal)) { // The file is either already a full path or is relative to the // build directory for the target. this->Location.DirectoryUseBinary(); this->FullPath = this->Location.GetFullPath(); + this->FindFullPathFailed = false; return true; } @@ -131,9 +140,11 @@ bool cmSourceFile::FindFullPath(std::string* error) // List of extension lists std::vector<std::string> exts = makefile->GetCMakeInstance()->GetAllExtensions(); + auto cmp0115 = makefile->GetPolicyStatus(cmPolicies::CMP0115); // Tries to find the file in a given directory - auto findInDir = [this, &exts, &lPath](std::string const& dir) -> bool { + auto findInDir = [this, &exts, &lPath, cmp0115, cmp0115Warning, + makefile](std::string const& dir) -> bool { // Compute full path std::string const fullPath = cmSystemTools::CollapseFullPath(lPath, dir); // Try full path @@ -141,13 +152,29 @@ bool cmSourceFile::FindFullPath(std::string* error) this->FullPath = fullPath; return true; } - // Try full path with extension - for (std::string const& ext : exts) { - if (!ext.empty()) { - std::string extPath = cmStrCat(fullPath, '.', ext); - if (cmSystemTools::FileExists(extPath)) { - this->FullPath = extPath; - return true; + // This has to be an if statement due to a bug in Oracle Developer Studio. + // See https://community.oracle.com/tech/developers/discussion/4476246/ + // for details. + if (cmp0115 == cmPolicies::OLD || cmp0115 == cmPolicies::WARN) { + // Try full path with extension + for (std::string const& ext : exts) { + if (!ext.empty()) { + std::string extPath = cmStrCat(fullPath, '.', ext); + if (cmSystemTools::FileExists(extPath)) { + this->FullPath = extPath; + if (cmp0115 == cmPolicies::WARN) { + std::string warning = + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0115), + "\nFile:\n ", extPath); + if (cmp0115Warning) { + *cmp0115Warning = std::move(warning); + } else { + makefile->GetCMakeInstance()->IssueMessage( + MessageType::AUTHOR_WARNING, warning); + } + } + return true; + } } } } @@ -168,11 +195,19 @@ bool cmSourceFile::FindFullPath(std::string* error) } // Compose error - std::string err = - cmStrCat("Cannot find source file:\n ", lPath, "\nTried extensions"); - for (std::string const& ext : exts) { - err += " ."; - err += ext; + std::string err = cmStrCat("Cannot find source file:\n ", lPath); + switch (cmp0115) { + case cmPolicies::OLD: + case cmPolicies::WARN: + err = cmStrCat(err, "\nTried extensions"); + for (auto const& ext : exts) { + err = cmStrCat(err, " .", ext); + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + break; } if (error != nullptr) { *error = std::move(err); @@ -246,11 +281,6 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value) } else { this->Properties.SetProperty(prop, value); } - - // Update IsGenerated flag - if (prop == propGENERATED) { - this->IsGenerated = cmIsOn(value); - } } void cmSourceFile::AppendProperty(const std::string& prop, @@ -274,14 +304,9 @@ void cmSourceFile::AppendProperty(const std::string& prop, } else { this->Properties.AppendProperty(prop, value, asString); } - - // Update IsGenerated flag - if (prop == propGENERATED) { - this->IsGenerated = this->GetPropertyAsBool(propGENERATED); - } } -const char* cmSourceFile::GetPropertyForUser(const std::string& prop) +cmProp cmSourceFile::GetPropertyForUser(const std::string& prop) { // This method is a consequence of design history and backwards // compatibility. GetProperty is (and should be) a const method. @@ -305,13 +330,27 @@ const char* cmSourceFile::GetPropertyForUser(const std::string& prop) // Similarly, LANGUAGE can be determined by the file extension // if it is requested by the user. if (prop == propLANGUAGE) { - // The c_str pointer is valid until `this->Language` is modified. - return this->GetOrDetermineLanguage().c_str(); + // The pointer is valid until `this->Language` is modified. + return &this->GetOrDetermineLanguage(); + } + + // Special handling for GENERATED property. + if (prop == propGENERATED) { + // We need to check policy CMP0118 in order to determine if we need to + // possibly consider the value of a locally set GENERATED property, too. + auto policyStatus = + this->Location.GetMakefile()->GetPolicyStatus(cmPolicies::CMP0118); + if (this->GetIsGenerated( + (policyStatus == cmPolicies::WARN || policyStatus == cmPolicies::OLD) + ? CheckScope::GlobalAndLocal + : CheckScope::Global)) { + return &propTRUE; + } + return &propFALSE; } // Perform the normal property lookup. - cmProp p = this->GetProperty(prop); - return p ? p->c_str() : nullptr; + return this->GetProperty(prop); } cmProp cmSourceFile::GetProperty(const std::string& prop) const @@ -369,13 +408,15 @@ cmProp cmSourceFile::GetProperty(const std::string& prop) const return retVal; } -const char* cmSourceFile::GetSafeProperty(const std::string& prop) const +const std::string& cmSourceFile::GetSafeProperty(const std::string& prop) const { cmProp ret = this->GetProperty(prop); - if (!ret) { - return ""; + if (ret) { + return *ret; } - return ret->c_str(); + + static std::string const s_empty; + return s_empty; } bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const @@ -383,11 +424,29 @@ bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const return cmIsOn(this->GetProperty(prop)); } +void cmSourceFile::MarkAsGenerated() +{ + this->IsGenerated = true; + auto& mf = *this->Location.GetMakefile(); + mf.GetGlobalGenerator()->MarkAsGeneratedFile(this->ResolveFullPath()); +} + +bool cmSourceFile::GetIsGenerated(CheckScope checkScope) const +{ + if (this->IsGenerated) { + // Globally marked as generated! + return true; + } + if (checkScope == CheckScope::GlobalAndLocal) { + // Check locally stored properties. + return this->GetPropertyAsBool(propGENERATED); + } + return false; +} + void cmSourceFile::SetProperties(cmPropertyMap properties) { this->Properties = std::move(properties); - - this->IsGenerated = this->GetPropertyAsBool(propGENERATED); } cmCustomCommand* cmSourceFile::GetCustomCommand() const diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 39ea8e3..94b5cc8 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -20,18 +20,18 @@ class cmMakefile; /** \class cmSourceFile * \brief Represent a class loaded from a makefile. * - * cmSourceFile is represents a class loaded from - * a makefile. + * cmSourceFile represents a class loaded from a makefile. */ class cmSourceFile { public: /** - * Construct with the makefile storing the source and the initial - * name referencing it. + * Construct with the makefile storing the source and the initial name + * referencing it. If it shall be marked as generated, this source file's + * kind is assumed to be known, regardless of the given value. */ cmSourceFile( - cmMakefile* mf, const std::string& name, + cmMakefile* mf, const std::string& name, bool generated, cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous); /** @@ -47,16 +47,36 @@ public: //! Might return a nullptr if the property is not set or invalid cmProp GetProperty(const std::string& prop) const; //! Always returns a valid pointer - const char* GetSafeProperty(const std::string& prop) const; + const std::string& GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; /** Implement getting a property when called from a CMake language command like get_property or get_source_file_property. */ - const char* GetPropertyForUser(const std::string& prop); + cmProp GetPropertyForUser(const std::string& prop); - //! Checks is the GENERATED property is set and true - /// @return Equivalent to GetPropertyAsBool("GENERATED") - bool GetIsGenerated() const { return this->IsGenerated; } + /// Marks this file as generated + /** + * This stores this file's path in the global table for all generated source + * files. + */ + void MarkAsGenerated(); + enum class CheckScope + { + Global, + GlobalAndLocal + }; + /// Determines if this source file is marked as generated. + /** + * This will check if this file's path is stored in the global table of all + * generated source files. If that is not the case and checkScope is set to + * GlobalAndLocal the value of the possibly existing local GENERATED property + * is returned instead. + * @param checkScope Determines if alternatively for backwards-compatibility + * a local GENERATED property should be considered, too. + * @return true if this source file is marked as generated, otherwise false. + */ + bool GetIsGenerated( + CheckScope checkScope = CheckScope::GlobalAndLocal) const; const std::vector<BT<std::string>>& GetCompileOptions() const { @@ -77,7 +97,8 @@ public: * Resolves the full path to the file. Attempts to locate the file on disk * and finalizes its location. */ - std::string const& ResolveFullPath(std::string* error = nullptr); + std::string const& ResolveFullPath(std::string* error = nullptr, + std::string* cmp0115Warning = nullptr); /** * The resolved full path to the file. The returned file name might be empty @@ -138,7 +159,7 @@ private: bool FindFullPathFailed = false; bool IsGenerated = false; - bool FindFullPath(std::string* error); + bool FindFullPath(std::string* error, std::string* cmp0115Warning); void CheckExtension(); void CheckLanguage(std::string const& ext); diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 222bafa..921eb0e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -33,8 +33,7 @@ cmSourceFileLocation::cmSourceFileLocation(cmMakefile const* mf, this->AmbiguousExtension = true; this->Directory = cmSystemTools::GetFilenamePath(name); if (cmSystemTools::FileIsFullPath(this->Directory)) { - this->Directory = cmSystemTools::CollapseFullPath( - this->Directory, mf->GetHomeOutputDirectory()); + this->Directory = cmSystemTools::CollapseFullPath(this->Directory); } this->Name = cmSystemTools::GetFilenameName(name); if (kind == cmSourceFileLocationKind::Known) { diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx index 8672f61..5d8ccf1 100644 --- a/Source/cmStandardLevelResolver.cxx +++ b/Source/cmStandardLevelResolver.cxx @@ -311,19 +311,19 @@ std::unordered_map<std::string, StanardLevelComputer> StandardComputerMapping = std::vector<std::string>{ "90", "99", "11" } } }, { "CXX", StanardLevelComputer{ - "CXX", std::vector<int>{ 98, 11, 14, 17, 20 }, - std::vector<std::string>{ "98", "11", "14", "17", "20" } } }, + "CXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } }, { "CUDA", StanardLevelComputer{ - "CUDA", std::vector<int>{ 03, 11, 14, 17, 20 }, - std::vector<std::string>{ "03", "11", "14", "17", "20" } } }, + "CUDA", std::vector<int>{ 03, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "03", "11", "14", "17", "20", "23" } } }, { "OBJC", StanardLevelComputer{ "OBJC", std::vector<int>{ 90, 99, 11 }, std::vector<std::string>{ "90", "99", "11" } } }, { "OBJCXX", StanardLevelComputer{ - "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20 }, - std::vector<std::string>{ "98", "11", "14", "17", "20" } } }, + "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } }, }; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d268e62..3692a01 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -441,6 +441,19 @@ void cmState::AddBuiltinCommand(std::string const& name, }); } +void cmState::AddFlowControlCommand(std::string const& name, Command command) +{ + this->FlowControlCommands.insert(name); + this->AddBuiltinCommand(name, std::move(command)); +} + +void cmState::AddFlowControlCommand(std::string const& name, + BuiltinCommand command) +{ + this->FlowControlCommands.insert(name); + this->AddBuiltinCommand(name, command); +} + void cmState::AddDisallowedCommand(std::string const& name, BuiltinCommand command, cmPolicies::PolicyID policy, @@ -470,7 +483,7 @@ void cmState::AddDisallowedCommand(std::string const& name, void cmState::AddUnexpectedCommand(std::string const& name, const char* error) { - this->AddBuiltinCommand( + this->AddFlowControlCommand( name, [name, error](std::vector<cmListFileArgument> const&, cmExecutionStatus& status) -> bool { @@ -485,16 +498,28 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error) }); } -void cmState::AddScriptedCommand(std::string const& name, Command command) +bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command, + cmMakefile& mf) { std::string sName = cmSystemTools::LowerCase(name); + if (this->FlowControlCommands.count(sName)) { + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Built-in flow control command \"", sName, + "\" cannot be overridden."), + command.Backtrace); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + // if the command already exists, give a new name to the old command. if (Command oldCmd = this->GetCommandByExactName(sName)) { this->ScriptedCommands["_" + sName] = oldCmd; } - this->ScriptedCommands[sName] = std::move(command); + this->ScriptedCommands[sName] = std::move(command.Value); + return true; } cmState::Command cmState::GetCommand(std::string const& name) const diff --git a/Source/cmState.h b/Source/cmState.h index e4c9eb5..4e41156 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -9,6 +9,7 @@ #include <set> #include <string> #include <unordered_map> +#include <unordered_set> #include <vector> #include "cmDefinitions.h" @@ -24,6 +25,7 @@ class cmCacheManager; class cmCommand; class cmGlobVerificationManager; +class cmMakefile; class cmStateSnapshot; class cmMessenger; class cmExecutionStatus; @@ -159,10 +161,13 @@ public: std::unique_ptr<cmCommand> command); void AddBuiltinCommand(std::string const& name, Command command); void AddBuiltinCommand(std::string const& name, BuiltinCommand command); + void AddFlowControlCommand(std::string const& name, Command command); + void AddFlowControlCommand(std::string const& name, BuiltinCommand command); void AddDisallowedCommand(std::string const& name, BuiltinCommand command, cmPolicies::PolicyID policy, const char* message); void AddUnexpectedCommand(std::string const& name, const char* error); - void AddScriptedCommand(std::string const& name, Command command); + bool AddScriptedCommand(std::string const& name, BT<Command> command, + cmMakefile& mf); void RemoveBuiltinCommand(std::string const& name); void RemoveUserDefinedCommands(); std::vector<std::string> GetCommandNames() const; @@ -225,6 +230,7 @@ private: std::vector<std::string> EnabledLanguages; std::unordered_map<std::string, Command> BuiltinCommands; std::unordered_map<std::string, Command> ScriptedCommands; + std::unordered_set<std::string> FlowControlCommands; cmPropertyMap GlobalProperties; std::unique_ptr<cmCacheManager> CacheManager; std::unique_ptr<cmGlobVerificationManager> GlobVerificationManager; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d26de9c..9db5dc6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -213,7 +213,7 @@ public: bool CheckImportedLibName(std::string const& prop, std::string const& value) const; - std::string ProcessSourceItemCMP0049(const std::string& s); + std::string ProcessSourceItemCMP0049(const std::string& s) const; }; namespace { @@ -372,6 +372,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("ISPC_INSTRUCTION_SETS"); initProp("LINK_SEARCH_START_STATIC"); initProp("LINK_SEARCH_END_STATIC"); + initProp("OBJC_CLANG_TIDY"); + initProp("OBJCXX_CLANG_TIDY"); initProp("Swift_LANGUAGE_VERSION"); initProp("Swift_MODULE_DIRECTORY"); initProp("VS_JUST_MY_CODE_DEBUGGING"); @@ -623,6 +625,11 @@ void cmTarget::AddUtility(std::string const& name, bool cross, cmMakefile* mf) { name, cross }, mf ? mf->GetBacktrace() : cmListFileBacktrace())); } +void cmTarget::AddUtility(BT<std::pair<std::string, bool>> util) +{ + impl->Utilities.emplace(std::move(util)); +} + std::set<BT<std::pair<std::string, bool>>> const& cmTarget::GetUtilities() const { @@ -740,7 +747,8 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) } } -std::string cmTargetInternals::ProcessSourceItemCMP0049(const std::string& s) +std::string cmTargetInternals::ProcessSourceItemCMP0049( + const std::string& s) const { std::string src = s; @@ -791,7 +799,7 @@ struct CreateLocation { } - cmSourceFileLocation operator()(const std::string& filename) + cmSourceFileLocation operator()(const std::string& filename) const { return cmSourceFileLocation(this->Makefile, filename); } @@ -857,7 +865,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src, bool before) cmSourceFileLocationKind::Known); } -void cmTarget::ClearDependencyInformation(cmMakefile& mf) +void cmTarget::ClearDependencyInformation(cmMakefile& mf) const { std::string depname = cmStrCat(this->GetName(), "_LIB_DEPENDS"); mf.RemoveCacheDefinition(depname); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d8f66bc..27f0c59 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -114,7 +114,7 @@ public: LinkLibraryVectorType const& GetOriginalLinkLibraries() const; //! Clear the dependency information recorded for this target, if any. - void ClearDependencyInformation(cmMakefile& mf); + void ClearDependencyInformation(cmMakefile& mf) const; void AddLinkLibrary(cmMakefile& mf, std::string const& lib, cmTargetLinkLibraryType llt); @@ -164,6 +164,7 @@ public: */ void AddUtility(std::string const& name, bool cross, cmMakefile* mf = nullptr); + void AddUtility(BT<std::pair<std::string, bool>> util); //! Get the utilities used by this target std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const; diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 9e30136..b050a58 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -45,15 +45,26 @@ bool cmTargetPropCommandBase::HandleArguments( this->HandleMissingTarget(args[0]); return false; } - if ((this->Target->GetType() != cmStateEnums::EXECUTABLE) && - (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) && - (this->Target->GetType() != cmStateEnums::SHARED_LIBRARY) && - (this->Target->GetType() != cmStateEnums::MODULE_LIBRARY) && - (this->Target->GetType() != cmStateEnums::OBJECT_LIBRARY) && - (this->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) && - (this->Target->GetType() != cmStateEnums::UNKNOWN_LIBRARY)) { - this->SetError("called with non-compilable target type"); - return false; + const bool isRegularTarget = + (this->Target->GetType() == cmStateEnums::EXECUTABLE) || + (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) || + (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) || + (this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) || + (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) || + (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) || + (this->Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY); + const bool isCustomTarget = this->Target->GetType() == cmStateEnums::UTILITY; + + if (prop == "SOURCES") { + if (!isRegularTarget && !isCustomTarget) { + this->SetError("called with non-compilable target type"); + return false; + } + } else { + if (!isRegularTarget) { + this->SetError("called with non-compilable target type"); + return false; + } } bool system = false; @@ -131,6 +142,11 @@ bool cmTargetPropCommandBase::ProcessContentArgs( this->SetError("may only set INTERFACE properties on IMPORTED targets"); return false; } + if (this->Target->GetType() == cmStateEnums::UTILITY && + scope != "PRIVATE") { + this->SetError("may only set PRIVATE properties on custom targets"); + return false; + } } return this->PopulateTargetProperies(scope, content, prepend, system); } diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx new file mode 100644 index 0000000..163d7e0 --- /dev/null +++ b/Source/cmTransformDepfile.cxx @@ -0,0 +1,115 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmTransformDepfile.h" + +#include <string> +#include <type_traits> +#include <utility> +#include <vector> + +#include <cm/optional> + +#include "cmsys/FStream.hxx" + +#include "cmGccDepfileReader.h" +#include "cmGccDepfileReaderTypes.h" +#include "cmStringAlgorithms.h" +#include "cmSystemTools.h" + +namespace { +void WriteFilenameGcc(cmsys::ofstream& fout, const std::string& filename) +{ + for (auto c : filename) { + switch (c) { + case ' ': + fout << "\\ "; + break; + case '\\': + fout << "\\\\"; + break; + default: + fout << c; + break; + } + } +} + +void WriteGccDepfile(cmsys::ofstream& fout, const cmGccDepfileContent& content) +{ + for (auto const& dep : content) { + bool first = true; + for (auto const& rule : dep.rules) { + if (!first) { + fout << " \\\n "; + } + first = false; + WriteFilenameGcc(fout, rule); + } + fout << ':'; + for (auto const& path : dep.paths) { + fout << " \\\n "; + WriteFilenameGcc(fout, path); + } + fout << '\n'; + } +} + +void WriteVsTlog(cmsys::ofstream& fout, const cmGccDepfileContent& content) +{ + for (auto const& dep : content) { + fout << '^'; + bool first = true; + for (auto const& rule : dep.rules) { + if (!first) { + fout << '|'; + } + first = false; + fout << cmSystemTools::ConvertToOutputPath(rule); + } + fout << "\r\n"; + for (auto const& path : dep.paths) { + fout << cmSystemTools::ConvertToOutputPath(path) << "\r\n"; + } + } +} +} + +bool cmTransformDepfile(cmDepfileFormat format, const std::string& prefix, + const std::string& infile, const std::string& outfile) +{ + cmGccDepfileContent content; + if (cmSystemTools::FileExists(infile)) { + auto result = cmReadGccDepfile(infile.c_str()); + if (!result) { + return false; + } + content = *std::move(result); + } + + for (auto& dep : content) { + for (auto& rule : dep.rules) { + if (!cmSystemTools::FileIsFullPath(rule)) { + rule = cmStrCat(prefix, rule); + } + } + for (auto& path : dep.paths) { + if (!cmSystemTools::FileIsFullPath(path)) { + path = cmStrCat(prefix, path); + } + } + } + + cmsys::ofstream fout(outfile.c_str()); + if (!fout) { + return false; + } + switch (format) { + case cmDepfileFormat::GccDepfile: + WriteGccDepfile(fout, content); + break; + case cmDepfileFormat::VsTlog: + WriteVsTlog(fout, content); + break; + } + return true; +} diff --git a/Source/cmTransformDepfile.h b/Source/cmTransformDepfile.h new file mode 100644 index 0000000..792c1aa --- /dev/null +++ b/Source/cmTransformDepfile.h @@ -0,0 +1,14 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include <string> + +enum class cmDepfileFormat +{ + GccDepfile, + VsTlog, +}; + +bool cmTransformDepfile(cmDepfileFormat format, const std::string& prefix, + const std::string& infile, const std::string& outfile); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4eb3b7f..9c41504 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -676,7 +676,7 @@ void cmVisualStudio10TargetGenerator::Generate() cmStrCat(this->DefaultArtifactDir, "\\nasm.props"); ConvertToWindowsSlash(propsLocal); this->Makefile->ConfigureFile(propsTemplate, propsLocal, false, true, - true, true); + true); Elem(e1, "Import").Attribute("Project", propsLocal); } } @@ -1020,9 +1020,9 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0) cm::string_view tagName = cm::string_view(p).substr(propNamePrefix.length()); if (!tagName.empty()) { - const std::string& value = *props.GetPropertyValue(p); - if (!value.empty()) { - e2.Element(tagName, value); + cmProp value = props.GetPropertyValue(p); + if (cmNonempty(value)) { + e2.Element(tagName, *value); } } } @@ -2402,27 +2402,28 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( configDefines += *ccdefs; } - // Add precompile headers compile options. - std::string customAndPchOptions = options; + // We have pch state in the following situation: + // 1. We have SKIP_PRECOMPILE_HEADERS == true + // 2. We are creating the pre-compiled header + // 3. We are a different language than the linker language AND pch is + // enabled const std::string pchSource = this->GeneratorTarget->GetPchSource(config, lang); - if (!pchSource.empty() && !sf.GetProperty("SKIP_PRECOMPILE_HEADERS")) { - std::string pchOptions; - if (sf.GetFullPath() == pchSource) { - pchOptions = - this->GeneratorTarget->GetPchCreateCompileOptions(config, lang); - } else { - pchOptions = - this->GeneratorTarget->GetPchUseCompileOptions(config, lang); - } - customAndPchOptions = cmStrCat(customAndPchOptions, ';', pchOptions); - } + const bool skipPCH = + pchSource.empty() || sf.GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS"); + const bool makePCH = (sf.GetFullPath() == pchSource); + const bool useSharedPCH = + !skipPCH && (lang == this->GeneratorTarget->GetLinkerLanguage(config)); + const bool useDifferentLangPCH = + !skipPCH && (lang != this->GeneratorTarget->GetLinkerLanguage(config)); + const bool needsPCHFlags = + (makePCH || useSharedPCH || useDifferentLangPCH); // if we have flags or defines for this config then // use them if (!flags.empty() || !options.empty() || !configDefines.empty() || - !includes.empty() || compileAs || noWinRT || - !customAndPchOptions.empty()) { + !includes.empty() || compileAs || noWinRT || !options.empty() || + needsPCHFlags) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmIDEFlagTable const* flagtable = nullptr; const std::string& srclang = source->GetLanguage(); @@ -2455,15 +2456,35 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } else { clOptions.Parse(flags); } - if (!customAndPchOptions.empty()) { + + if (needsPCHFlags) { + // Add precompile headers compile options. + std::string expandedOptions; + std::string pchOptions; + if (makePCH) { + pchOptions = + this->GeneratorTarget->GetPchCreateCompileOptions(config, lang); + } else if (useSharedPCH) { + std::string pchHeader = + this->GeneratorTarget->GetPchHeader(config, lang); + clOptions.AddFlag("ForcedIncludeFiles", pchHeader); + } else if (useDifferentLangPCH) { + pchOptions = + this->GeneratorTarget->GetPchUseCompileOptions(config, lang); + } + this->LocalGenerator->AppendCompileOptions(expandedOptions, + pchOptions); + clOptions.Parse(expandedOptions); + } + + if (!options.empty()) { std::string expandedOptions; if (configDependentOptions) { this->LocalGenerator->AppendCompileOptions( expandedOptions, - genexInterpreter.Evaluate(customAndPchOptions, "COMPILE_OPTIONS")); + genexInterpreter.Evaluate(options, "COMPILE_OPTIONS")); } else { - this->LocalGenerator->AppendCompileOptions(expandedOptions, - customAndPchOptions); + this->LocalGenerator->AppendCompileOptions(expandedOptions, options); } clOptions.Parse(expandedOptions); } @@ -2786,6 +2807,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->GeneratorTarget->GetPchHeader(configName, linkLanguage); if (this->MSTools && vcxproj == this->ProjectType && pchHeader.empty()) { clOptions.AddFlag("PrecompiledHeader", "NotUsing"); + } else if (this->MSTools && vcxproj == this->ProjectType && + !pchHeader.empty()) { + clOptions.AddFlag("PrecompiledHeader", "Use"); + clOptions.AddFlag("PrecompiledHeaderFile", pchHeader); + std::string pchFile = + this->GeneratorTarget->GetPchFile(configName, linkLanguage); + clOptions.AddFlag("PrecompiledHeaderOutputFile", pchFile); } // Get preprocessor definitions for this directory. @@ -4183,8 +4211,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) cmLocalGenerator* lg = dt->GetLocalGenerator(); std::string name = dt->GetName(); std::string path; - cmProp p = dt->GetProperty("EXTERNAL_MSPROJECT"); - if (p) { + if (cmProp p = dt->GetProperty("EXTERNAL_MSPROJECT")) { path = *p; } else { path = cmStrCat(lg->GetCurrentBinaryDirectory(), '/', dt->GetName(), @@ -4972,9 +4999,9 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties( if (cmHasPrefix(p, propNamePrefix)) { std::string tagName = p.substr(propNamePrefix.length()); if (!tagName.empty()) { - const std::string& val = *props.GetPropertyValue(p); - if (!val.empty()) { - tags[tagName] = val; + cmProp val = props.GetPropertyValue(p); + if (cmNonempty(val)) { + tags[tagName] = *val; } else { tags.erase(tagName); } diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 78d4727..ab7f99e 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -81,6 +81,13 @@ public: void SetObject(cmXCodeObject* value) { this->Object = value; } cmXCodeObject* GetObject() { return this->Object; } void AddObject(cmXCodeObject* value) { this->List.push_back(value); } + size_t GetObjectCount() { return this->List.size(); } + void InsertObject(size_t position, cmXCodeObject* value) + { + if (position < GetObjectCount()) { + this->List.insert(this->List.begin() + position, value); + } + } void PrependObject(cmXCodeObject* value) { this->List.insert(this->List.begin(), value); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 60a493c..cfd724b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -132,6 +132,131 @@ namespace { using JsonValueMapType = std::unordered_map<std::string, Json::Value>; #endif +struct CommandArgument +{ + enum struct Values + { + Zero, + One, + Two, + }; + + std::string InvalidSyntaxMessage; + std::string InvalidValueMessage; + std::string Name; + CommandArgument::Values Type; + std::function<bool(std::string const& value, cmake* state)> StoreCall; + + template <typename FunctionType> + CommandArgument(std::string n, CommandArgument::Values t, + FunctionType&& func) + : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n)) + , InvalidValueMessage(cmStrCat("Invalid value used with ", n)) + , Name(std::move(n)) + , Type(t) + , StoreCall(std::forward<FunctionType>(func)) + { + } + + template <typename FunctionType> + CommandArgument(std::string n, std::string failedMsg, + CommandArgument::Values t, FunctionType&& func) + : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n)) + , InvalidValueMessage(std::move(failedMsg)) + , Name(std::move(n)) + , Type(t) + , StoreCall(std::forward<FunctionType>(func)) + { + } + + bool matches(std::string const& input) const + { + return cmHasPrefix(input, this->Name); + } + + template <typename T> + bool parse(std::string const& input, T& index, + std::vector<std::string> const& allArgs, cmake* state) const + { + enum struct ParseMode + { + Valid, + Invalid, + SyntaxError, + ValueError + }; + ParseMode parseState = ParseMode::Valid; + + // argument is the next parameter + if (this->Type == CommandArgument::Values::Zero) { + if (input.size() == this->Name.size()) { + parseState = this->StoreCall(input, state) ? ParseMode::Valid + : ParseMode::Invalid; + } else { + parseState = ParseMode::SyntaxError; + } + + } else if (this->Type == CommandArgument::Values::One) { + if (input.size() == this->Name.size()) { + ++index; + if (index >= allArgs.size() || allArgs[index][0] == '-') { + parseState = ParseMode::ValueError; + } else { + parseState = this->StoreCall(allArgs[index], state) + ? ParseMode::Valid + : ParseMode::Invalid; + } + } else { + // parse the string to get the value + auto possible_value = cm::string_view(input).substr(this->Name.size()); + if (possible_value.empty()) { + parseState = ParseMode::SyntaxError; + parseState = ParseMode::ValueError; + } else if (possible_value[0] == '=') { + possible_value.remove_prefix(1); + if (possible_value.empty()) { + parseState = ParseMode::ValueError; + } else { + parseState = this->StoreCall(std::string(possible_value), state) + ? ParseMode::Valid + : ParseMode::Invalid; + } + } + if (parseState == ParseMode::Valid) { + parseState = this->StoreCall(std::string(possible_value), state) + ? ParseMode::Valid + : ParseMode::Invalid; + } + } + } else if (this->Type == CommandArgument::Values::Two) { + if (input.size() == this->Name.size()) { + if (index + 2 >= allArgs.size() || allArgs[index + 1][0] == '-' || + allArgs[index + 2][0] == '-') { + parseState = ParseMode::ValueError; + } else { + index += 2; + parseState = + this->StoreCall(cmStrCat(allArgs[index - 1], ";", allArgs[index]), + state) + ? ParseMode::Valid + : ParseMode::Invalid; + } + } + } + + if (parseState == ParseMode::SyntaxError) { + cmSystemTools::Error(this->InvalidSyntaxMessage); + } else if (parseState == ParseMode::ValueError) { + cmSystemTools::Error(this->InvalidValueMessage); + } + return (parseState == ParseMode::Valid); + } +}; + +auto IgnoreAndTrueLambda = [](std::string const&, cmake*) -> bool { + return true; +}; + } // namespace static bool cmakeCheckStampFile(const std::string& stampName); @@ -263,7 +388,7 @@ Json::Value cmake::ReportCapabilitiesJson() const } obj["generators"] = generators; obj["fileApi"] = cmFileAPI::ReportCapabilities(); - obj["serverMode"] = true; + obj["serverMode"] = false; return obj; } @@ -384,152 +509,145 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) { auto findPackageMode = false; auto seenScriptOption = false; - for (unsigned int i = 1; i < args.size(); ++i) { - std::string const& arg = args[i]; - if (cmHasLiteralPrefix(arg, "-D")) { - std::string entry = arg.substr(2); - if (entry.empty()) { - ++i; - if (i < args.size()) { - entry = args[i]; - } else { - cmSystemTools::Error("-D must be followed with VAR=VALUE."); - return false; - } - } - std::string var; - std::string value; - cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; - if (cmState::ParseCacheEntry(entry, var, value, type)) { + + auto DefineLambda = [](std::string const& entry, cmake* state) -> bool { + std::string var; + std::string value; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; + if (cmState::ParseCacheEntry(entry, var, value, type)) { #ifndef CMAKE_BOOTSTRAP - this->UnprocessedPresetVariables.erase(var); + state->UnprocessedPresetVariables.erase(var); #endif - this->ProcessCacheArg(var, value, type); - } else { - cmSystemTools::Error("Parse error in command line argument: " + arg + - "\n" + "Should be: VAR:type=value\n"); - return false; - } - } else if (cmHasLiteralPrefix(arg, "-W")) { - std::string entry = arg.substr(2); - if (entry.empty()) { - ++i; - if (i < args.size()) { - entry = args[i]; - } else { - cmSystemTools::Error("-W must be followed with [no-]<name>."); - return false; - } - } + state->ProcessCacheArg(var, value, type); + } else { + cmSystemTools::Error(cmStrCat("Parse error in command line argument: ", + entry, "\n Should be: VAR:type=value\n")); + return false; + } + return true; + }; - std::string name; - bool foundNo = false; - bool foundError = false; - unsigned int nameStartPosition = 0; + auto WarningLambda = [](cm::string_view entry, cmake* state) -> bool { + bool foundNo = false; + bool foundError = false; - if (entry.find("no-", nameStartPosition) == 0) { - foundNo = true; - nameStartPosition += 3; - } + if (cmHasLiteralPrefix(entry, "no-")) { + foundNo = true; + entry.remove_prefix(3); + } - if (entry.find("error=", nameStartPosition) == 0) { - foundError = true; - nameStartPosition += 6; - } + if (cmHasLiteralPrefix(entry, "error=")) { + foundError = true; + entry.remove_prefix(6); + } - name = entry.substr(nameStartPosition); - if (name.empty()) { - cmSystemTools::Error("No warning name provided."); - return false; - } + if (entry.empty()) { + cmSystemTools::Error("No warning name provided."); + return false; + } - if (!foundNo && !foundError) { - // -W<name> - this->DiagLevels[name] = std::max(this->DiagLevels[name], DIAG_WARN); - } else if (foundNo && !foundError) { - // -Wno<name> - this->DiagLevels[name] = DIAG_IGNORE; - } else if (!foundNo && foundError) { - // -Werror=<name> - this->DiagLevels[name] = DIAG_ERROR; - } else { - // -Wno-error=<name> - this->DiagLevels[name] = std::min(this->DiagLevels[name], DIAG_WARN); - } - } else if (cmHasLiteralPrefix(arg, "-U")) { - std::string entryPattern = arg.substr(2); - if (entryPattern.empty()) { - ++i; - if (i < args.size()) { - entryPattern = args[i]; - } else { - cmSystemTools::Error("-U must be followed with VAR."); - return false; - } + std::string const name = std::string(entry); + if (!foundNo && !foundError) { + // -W<name> + state->DiagLevels[name] = std::max(state->DiagLevels[name], DIAG_WARN); + } else if (foundNo && !foundError) { + // -Wno<name> + state->DiagLevels[name] = DIAG_IGNORE; + } else if (!foundNo && foundError) { + // -Werror=<name> + state->DiagLevels[name] = DIAG_ERROR; + } else { + // -Wno-error=<name> + // This can downgrade an error to a warning, but should not enable + // or disable a warning in the first place. + auto dli = state->DiagLevels.find(name); + if (dli != state->DiagLevels.end()) { + dli->second = std::min(dli->second, DIAG_WARN); } - cmsys::RegularExpression regex( - cmsys::Glob::PatternToRegex(entryPattern, true, true)); - // go through all cache entries and collect the vars which will be - // removed - std::vector<std::string> entriesToDelete; - std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys(); - for (std::string const& ck : cacheKeys) { - cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(ck); - if (t != cmStateEnums::STATIC) { - if (regex.find(ck)) { - entriesToDelete.push_back(ck); - } + } + return true; + }; + + auto UnSetLambda = [](std::string const& entryPattern, + cmake* state) -> bool { + cmsys::RegularExpression regex( + cmsys::Glob::PatternToRegex(entryPattern, true, true)); + // go through all cache entries and collect the vars which will be + // removed + std::vector<std::string> entriesToDelete; + std::vector<std::string> cacheKeys = state->State->GetCacheEntryKeys(); + for (std::string const& ck : cacheKeys) { + cmStateEnums::CacheEntryType t = state->State->GetCacheEntryType(ck); + if (t != cmStateEnums::STATIC) { + if (regex.find(ck)) { + entriesToDelete.push_back(ck); } } + } - // now remove them from the cache - for (std::string const& currentEntry : entriesToDelete) { + // now remove them from the cache + for (std::string const& currentEntry : entriesToDelete) { #ifndef CMAKE_BOOTSTRAP - this->UnprocessedPresetVariables.erase(currentEntry); + state->UnprocessedPresetVariables.erase(currentEntry); #endif - this->State->RemoveCacheEntry(currentEntry); - } - } else if (cmHasLiteralPrefix(arg, "-C")) { - std::string path = arg.substr(2); - if (path.empty()) { - ++i; - if (i < args.size()) { - path = args[i]; - } else { - cmSystemTools::Error("-C must be followed by a file name."); - return false; - } - } - cmSystemTools::Stdout("loading initial cache file " + path + "\n"); - // Resolve script path specified on command line relative to $PWD. - path = cmSystemTools::CollapseFullPath(path); - this->ReadListFile(args, path); - } else if (cmHasLiteralPrefix(arg, "-P")) { - i++; - if (i >= args.size()) { - cmSystemTools::Error("-P must be followed by a file name."); - return false; - } - std::string path = args[i]; - if (path.empty()) { - cmSystemTools::Error("No cmake script provided."); - return false; - } - // Register fake project commands that hint misuse in script mode. - GetProjectCommandsInScriptMode(this->GetState()); - // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be - // set to $PWD for -P mode. - this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - this->SetHomeOutputDirectory( - cmSystemTools::GetCurrentWorkingDirectory()); - this->ReadListFile(args, path); - seenScriptOption = true; - } else if (arg == "--" && seenScriptOption) { + state->State->RemoveCacheEntry(currentEntry); + } + return true; + }; + + auto ScriptLambda = [&](std::string const& path, cmake* state) -> bool { + // Register fake project commands that hint misuse in script mode. + GetProjectCommandsInScriptMode(state->GetState()); + // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be + // set to $PWD for -P mode. + state->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + state->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + state->ReadListFile(args, path); + seenScriptOption = true; + return true; + }; + + std::vector<CommandArgument> arguments = { + CommandArgument{ "-D", "-D must be followed with VAR=VALUE.", + CommandArgument::Values::One, DefineLambda }, + CommandArgument{ "-W", "-W must be followed with [no-]<name>.", + CommandArgument::Values::One, WarningLambda }, + CommandArgument{ "-U", "-U must be followed with VAR.", + CommandArgument::Values::One, UnSetLambda }, + CommandArgument{ "-C", "-C must be followed by a file name.", + CommandArgument::Values::One, + [&](std::string const& value, cmake* state) -> bool { + cmSystemTools::Stdout("loading initial cache file " + + value + "\n"); + // Resolve script path specified on command line + // relative to $PWD. + auto path = cmSystemTools::CollapseFullPath(value); + state->ReadListFile(args, path); + return true; + } }, + CommandArgument{ "-P", "-P must be followed by a file name.", + CommandArgument::Values::One, ScriptLambda }, + CommandArgument{ "--find-package", CommandArgument::Values::Zero, + [&](std::string const&, cmake*) -> bool { + findPackageMode = true; + return true; + } }, + }; + for (decltype(args.size()) i = 1; i < args.size(); ++i) { + std::string const& arg = args[i]; + + if (arg == "--" && seenScriptOption) { // Stop processing CMake args and avoid possible errors // when arbitrary args are given to CMake script. break; - } else if (cmHasLiteralPrefix(arg, "--find-package")) { - findPackageMode = true; + } + for (auto const& m : arguments) { + if (m.matches(arg)) { + const bool parsedCorrectly = m.parse(arg, i, args, this); + if (!parsedCorrectly) { + return false; + } + } } } @@ -728,255 +846,341 @@ void cmake::SetArgs(const std::vector<std::string>& args) bool haveToolset = false; bool havePlatform = false; bool haveBArg = false; + bool scriptMode = false; + std::string possibleUnknownArg; #if !defined(CMAKE_BOOTSTRAP) std::string profilingFormat; std::string profilingOutput; std::string presetName; bool listPresets = false; #endif - for (unsigned int i = 1; i < args.size(); ++i) { - std::string const& arg = args[i]; - if (cmHasLiteralPrefix(arg, "-H") || cmHasLiteralPrefix(arg, "-S")) { - std::string path = arg.substr(2); - if (path.empty()) { - ++i; - if (i >= args.size()) { - cmSystemTools::Error("No source directory specified for -S"); - return; - } - path = args[i]; - if (path[0] == '-') { - cmSystemTools::Error("No source directory specified for -S"); - return; - } - } - path = cmSystemTools::CollapseFullPath(path); - cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeDirectory(path); - // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 - // NOLINTNEXTLINE(bugprone-branch-clone) - } else if (cmHasLiteralPrefix(arg, "-O")) { - // There is no local generate anymore. Ignore -O option. - } else if (cmHasLiteralPrefix(arg, "-B")) { - std::string path = arg.substr(2); - if (path.empty()) { - ++i; - if (i >= args.size()) { - cmSystemTools::Error("No build directory specified for -B"); - return; - } - path = args[i]; - if (path[0] == '-') { - cmSystemTools::Error("No build directory specified for -B"); - return; - } - } + auto SourceArgLambda = [](std::string const& value, cmake* state) -> bool { + std::string path = cmSystemTools::CollapseFullPath(value); + cmSystemTools::ConvertToUnixSlashes(path); + state->SetHomeDirectory(path); + return true; + }; - path = cmSystemTools::CollapseFullPath(path); - cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeOutputDirectory(path); - haveBArg = true; - } else if ((i < args.size() - 2) && - cmHasLiteralPrefix(arg, "--check-build-system")) { - this->CheckBuildSystemArgument = args[++i]; - this->ClearBuildSystem = (atoi(args[++i].c_str()) > 0); - } else if ((i < args.size() - 1) && - cmHasLiteralPrefix(arg, "--check-stamp-file")) { - this->CheckStampFile = args[++i]; - } else if ((i < args.size() - 1) && - cmHasLiteralPrefix(arg, "--check-stamp-list")) { - this->CheckStampList = args[++i]; - } else if (arg == "--regenerate-during-build"_s) { - this->RegenerateDuringBuild = true; + auto BuildArgLambda = [&](std::string const& value, cmake* state) -> bool { + std::string path = cmSystemTools::CollapseFullPath(value); + cmSystemTools::ConvertToUnixSlashes(path); + state->SetHomeOutputDirectory(path); + haveBArg = true; + return true; + }; + + auto PlatformLambda = [&](std::string const& value, cmake* state) -> bool { + if (havePlatform) { + cmSystemTools::Error("Multiple -A options not allowed"); + return false; } -#if defined(CMAKE_HAVE_VS_GENERATORS) - else if ((i < args.size() - 1) && - cmHasLiteralPrefix(arg, "--vs-solution-file")) { - this->VSSolutionFile = args[++i]; + state->SetGeneratorPlatform(value); + havePlatform = true; + return true; + }; + + auto ToolsetLamda = [&](std::string const& value, cmake* state) -> bool { + if (haveToolset) { + cmSystemTools::Error("Multiple -T options not allowed"); + return false; } + state->SetGeneratorToolset(value); + haveToolset = true; + return true; + }; + + std::vector<CommandArgument> arguments = { + CommandArgument{ "-S", "No source directory specified for -S", + CommandArgument::Values::One, SourceArgLambda }, + CommandArgument{ "-H", "No source directory specified for -H", + CommandArgument::Values::One, SourceArgLambda }, + CommandArgument{ "-O", CommandArgument::Values::Zero, + IgnoreAndTrueLambda }, + CommandArgument{ "-B", "No build directory specified for -B", + CommandArgument::Values::One, BuildArgLambda }, + CommandArgument{ "-P", "-P must be followed by a file name.", + CommandArgument::Values::One, + [&](std::string const&, cmake*) -> bool { + scriptMode = true; + return true; + } }, + CommandArgument{ "-D", "-D must be followed with VAR=VALUE.", + CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument{ "-C", "-C must be followed by a file name.", + CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument{ "-U", "-U must be followed with VAR.", + CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument{ "-W", "-W must be followed with [no-]<name>.", + CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument{ "-A", "No platform specified for -A", + CommandArgument::Values::One, PlatformLambda }, + CommandArgument{ "-T", "No toolset specified for -T", + CommandArgument::Values::One, ToolsetLamda }, + + CommandArgument{ "--check-build-system", CommandArgument::Values::Two, + [](std::string const& value, cmake* state) -> bool { + std::vector<std::string> values = cmExpandedList(value); + state->CheckBuildSystemArgument = values[0]; + state->ClearBuildSystem = (atoi(values[1].c_str()) > 0); + return true; + } }, + CommandArgument{ "--check-stamp-file", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + state->CheckStampFile = value; + return true; + } }, + CommandArgument{ "--check-stamp-list", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + state->CheckStampList = value; + return true; + } }, + CommandArgument{ "--regenerate-during-build", + CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + state->RegenerateDuringBuild = true; + return true; + } }, + + CommandArgument{ "--find-package", CommandArgument::Values::Zero, + IgnoreAndTrueLambda }, + + CommandArgument{ "--graphviz", "No file specified for --graphviz", + CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + std::string path = + cmSystemTools::CollapseFullPath(value); + cmSystemTools::ConvertToUnixSlashes(path); + state->GraphVizFile = path; + return true; + } }, + + CommandArgument{ "--debug-trycompile", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "debug trycompile on\n"; + state->DebugTryCompileOn(); + return true; + } }, + CommandArgument{ "--debug-output", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Running with debug output on.\n"; + state->SetDebugOutputOn(true); + return true; + } }, + + CommandArgument{ "--log-level", "Invalid level specified for --log-level", + CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + const auto logLevel = StringToLogLevel(value); + if (logLevel == LogLevel::LOG_UNDEFINED) { + cmSystemTools::Error( + "Invalid level specified for --log-level"); + return false; + } + state->SetLogLevel(logLevel); + state->LogLevelWasSetViaCLI = true; + return true; + } }, + // This is supported for backward compatibility. This option only + // appeared in the 3.15.x release series and was renamed to + // --log-level in 3.16.0 + CommandArgument{ "--loglevel", "Invalid level specified for --loglevel", + CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + const auto logLevel = StringToLogLevel(value); + if (logLevel == LogLevel::LOG_UNDEFINED) { + cmSystemTools::Error( + "Invalid level specified for --loglevel"); + return false; + } + state->SetLogLevel(logLevel); + state->LogLevelWasSetViaCLI = true; + return true; + } }, + + CommandArgument{ "--log-context", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + state->SetShowLogContext(true); + return true; + } }, + CommandArgument{ + "--debug-find", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Running with debug output on for the `find` commands.\n"; + state->SetDebugFindOutputOn(true); + return true; + } }, + CommandArgument{ "--trace-expand", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Running with expanded trace output on.\n"; + state->SetTrace(true); + state->SetTraceExpand(true); + return true; + } }, + CommandArgument{ "--trace-format", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + state->SetTrace(true); + const auto traceFormat = StringToTraceFormat(value); + if (traceFormat == TraceFormat::TRACE_UNDEFINED) { + cmSystemTools::Error( + "Invalid format specified for --trace-format. " + "Valid formats are human, json-v1."); + return false; + } + state->SetTraceFormat(traceFormat); + return true; + } }, + CommandArgument{ "--trace-source", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + std::string file(value); + cmSystemTools::ConvertToUnixSlashes(file); + state->AddTraceSource(file); + state->SetTrace(true); + return true; + } }, + CommandArgument{ "--trace-redirect", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + std::string file(value); + cmSystemTools::ConvertToUnixSlashes(file); + state->SetTraceFile(file); + state->SetTrace(true); + return true; + } }, + CommandArgument{ "--trace", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Running with trace output on.\n"; + state->SetTrace(true); + state->SetTraceExpand(false); + return true; + } }, + CommandArgument{ "--warn-uninitialized", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Warn about uninitialized values.\n"; + state->SetWarnUninitialized(true); + return true; + } }, + CommandArgument{ "--warn-unused-vars", CommandArgument::Values::Zero, + IgnoreAndTrueLambda }, // Option was removed. + CommandArgument{ "--no-warn-unused-cli", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout + << "Not searching for unused variables given on the " + << "command line.\n"; + state->SetWarnUnusedCli(false); + return true; + } }, + CommandArgument{ + "--check-system-vars", CommandArgument::Values::Zero, + [](std::string const&, cmake* state) -> bool { + std::cout << "Also check system files when warning about unused and " + << "uninitialized variables.\n"; + state->SetCheckSystemVars(true); + return true; + } } + }; + +#if defined(CMAKE_HAVE_VS_GENERATORS) + arguments.emplace_back("--vs-solution-file", CommandArgument::Values::One, + [](std::string const& value, cmake* state) -> bool { + state->VSSolutionFile = value; + return true; + }); #endif - else if (cmHasLiteralPrefix(arg, "-D") || cmHasLiteralPrefix(arg, "-U") || - cmHasLiteralPrefix(arg, "-C")) { - // skip for now - // in case '-[DUC] argval' var' is given, also skip the next - // in case '-[DUC]argval' is given, don't skip the next - if (arg.size() == 2) { - ++i; - } - // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165 - // NOLINTNEXTLINE(bugprone-branch-clone) - } else if (cmHasLiteralPrefix(arg, "-P")) { - // skip for now - i++; - } else if (cmHasLiteralPrefix(arg, "--find-package")) { - // skip for now - i++; - } else if (cmHasLiteralPrefix(arg, "-W")) { - // skip for now - } else if (cmHasLiteralPrefix(arg, "--graphviz=")) { - std::string path = arg.substr(strlen("--graphviz=")); - path = cmSystemTools::CollapseFullPath(path); - cmSystemTools::ConvertToUnixSlashes(path); - this->GraphVizFile = path; - if (this->GraphVizFile.empty()) { - cmSystemTools::Error("No file specified for --graphviz"); - return; - } - } else if (cmHasLiteralPrefix(arg, "--debug-trycompile")) { - std::cout << "debug trycompile on\n"; - this->DebugTryCompileOn(); - } else if (cmHasLiteralPrefix(arg, "--debug-output")) { - std::cout << "Running with debug output on.\n"; - this->SetDebugOutputOn(true); - } else if (cmHasLiteralPrefix(arg, "--log-level=")) { - const auto logLevel = - StringToLogLevel(arg.substr(sizeof("--log-level=") - 1)); - if (logLevel == LogLevel::LOG_UNDEFINED) { - cmSystemTools::Error("Invalid level specified for --log-level"); - return; - } - this->SetLogLevel(logLevel); - this->LogLevelWasSetViaCLI = true; - } else if (cmHasLiteralPrefix(arg, "--loglevel=")) { - // This is supported for backward compatibility. This option only - // appeared in the 3.15.x release series and was renamed to - // --log-level in 3.16.0 - const auto logLevel = - StringToLogLevel(arg.substr(sizeof("--loglevel=") - 1)); - if (logLevel == LogLevel::LOG_UNDEFINED) { - cmSystemTools::Error("Invalid level specified for --loglevel"); - return; - } - this->SetLogLevel(logLevel); - this->LogLevelWasSetViaCLI = true; - } else if (arg == "--log-context"_s) { - this->SetShowLogContext(true); - } else if (cmHasLiteralPrefix(arg, "--debug-find")) { - std::cout << "Running with debug output on for the `find` commands.\n"; - this->SetDebugFindOutputOn(true); - } else if (cmHasLiteralPrefix(arg, "--trace-expand")) { - std::cout << "Running with expanded trace output on.\n"; - this->SetTrace(true); - this->SetTraceExpand(true); - } else if (cmHasLiteralPrefix(arg, "--trace-format=")) { - this->SetTrace(true); - const auto traceFormat = - StringToTraceFormat(arg.substr(strlen("--trace-format="))); - if (traceFormat == TraceFormat::TRACE_UNDEFINED) { - cmSystemTools::Error("Invalid format specified for --trace-format. " - "Valid formats are human, json-v1."); - return; - } - this->SetTraceFormat(traceFormat); - } else if (cmHasLiteralPrefix(arg, "--trace-source=")) { - std::string file = arg.substr(strlen("--trace-source=")); - cmSystemTools::ConvertToUnixSlashes(file); - this->AddTraceSource(file); - this->SetTrace(true); - } else if (cmHasLiteralPrefix(arg, "--trace-redirect=")) { - std::string file = arg.substr(strlen("--trace-redirect=")); - cmSystemTools::ConvertToUnixSlashes(file); - this->SetTraceFile(file); - this->SetTrace(true); - } else if (cmHasLiteralPrefix(arg, "--trace")) { - std::cout << "Running with trace output on.\n"; - this->SetTrace(true); - this->SetTraceExpand(false); - } else if (cmHasLiteralPrefix(arg, "--warn-uninitialized")) { - std::cout << "Warn about uninitialized values.\n"; - this->SetWarnUninitialized(true); - } else if (cmHasLiteralPrefix(arg, "--warn-unused-vars")) { - // Option was removed. - } else if (cmHasLiteralPrefix(arg, "--no-warn-unused-cli")) { - std::cout << "Not searching for unused variables given on the " - << "command line.\n"; - this->SetWarnUnusedCli(false); - } else if (cmHasLiteralPrefix(arg, "--check-system-vars")) { - std::cout << "Also check system files when warning about unused and " - << "uninitialized variables.\n"; - this->SetCheckSystemVars(true); - } else if (cmHasLiteralPrefix(arg, "-A")) { - std::string value = arg.substr(2); - if (value.empty()) { - ++i; - if (i >= args.size()) { - cmSystemTools::Error("No platform specified for -A"); - return; - } - value = args[i]; - } - if (havePlatform) { - cmSystemTools::Error("Multiple -A options not allowed"); - return; - } - this->SetGeneratorPlatform(value); - havePlatform = true; - } else if (cmHasLiteralPrefix(arg, "-T")) { - std::string value = arg.substr(2); - if (value.empty()) { - ++i; - if (i >= args.size()) { - cmSystemTools::Error("No toolset specified for -T"); - return; - } - value = args[i]; - } - if (haveToolset) { - cmSystemTools::Error("Multiple -T options not allowed"); - return; - } - this->SetGeneratorToolset(value); - haveToolset = true; - } else if (cmHasLiteralPrefix(arg, "-G")) { - std::string value = arg.substr(2); - if (value.empty()) { - ++i; - if (i >= args.size()) { - cmSystemTools::Error("No generator specified for -G"); - this->PrintGeneratorList(); - return; - } - value = args[i]; - } - if (!this->CreateAndSetGlobalGenerator(value, true)) { - return; - } + #if !defined(CMAKE_BOOTSTRAP) - } else if (cmHasLiteralPrefix(arg, "--profiling-format=")) { - profilingFormat = arg.substr(strlen("--profiling-format=")); - if (profilingFormat.empty()) { - cmSystemTools::Error("No format specified for --profiling-format"); - } - } else if (cmHasLiteralPrefix(arg, "--profiling-output=")) { - profilingOutput = arg.substr(strlen("--profiling-output=")); - profilingOutput = cmSystemTools::CollapseFullPath(profilingOutput); + arguments.emplace_back("--profiling-format", + "No format specified for --profiling-format", + CommandArgument::Values::One, + [&](std::string const& value, cmake*) -> bool { + profilingFormat = value; + return true; + }); + arguments.emplace_back( + "--profiling-output", "No path specified for --profiling-output", + CommandArgument::Values::One, + [&](std::string const& value, cmake*) -> bool { + profilingOutput = cmSystemTools::CollapseFullPath(value); cmSystemTools::ConvertToUnixSlashes(profilingOutput); - if (profilingOutput.empty()) { - cmSystemTools::Error("No path specified for --profiling-output"); + return true; + }); + arguments.emplace_back("--preset", "No preset specified for --preset", + CommandArgument::Values::One, + [&](std::string const& value, cmake*) -> bool { + presetName = value; + return true; + }); + arguments.emplace_back("--list-presets", CommandArgument::Values::Zero, + [&](std::string const&, cmake*) -> bool { + listPresets = true; + return true; + }); + +#endif + + bool badGeneratorName = false; + CommandArgument generatorCommand( + "-G", "No generator specified for -G", CommandArgument::Values::One, + [&](std::string const& value, cmake* state) -> bool { + bool valid = state->CreateAndSetGlobalGenerator(value, true); + badGeneratorName = !valid; + return valid; + }); + + for (decltype(args.size()) i = 1; i < args.size(); ++i) { + // iterate each argument + std::string const& arg = args[i]; + + // Generator flag has special handling for when to print help + // so it becomes the exception + if (generatorCommand.matches(arg)) { + bool parsed = generatorCommand.parse(arg, i, args, this); + if (!parsed && !badGeneratorName) { + this->PrintGeneratorList(); + return; } - } else if (cmHasLiteralPrefix(arg, "--preset=")) { - presetName = arg.substr(strlen("--preset=")); - if (presetName.empty()) { - cmSystemTools::Error("No preset specified for --preset"); + continue; + } + + bool matched = false; + bool parsedCorrectly = true; // needs to be true so we can ignore + // arguments so as -E + for (auto const& m : arguments) { + if (m.matches(arg)) { + matched = true; + parsedCorrectly = m.parse(arg, i, args, this); + break; } - } else if (cmHasLiteralPrefix(arg, "--list-presets")) { - listPresets = true; -#endif } - // no option assume it is the path to the source or an existing build - else { + + // We have an issue where arguments to a "-P" script mode + // can be provided before the "-P" argument. This means + // that we need to lazily check this argument after checking + // all args. + // Additionally it can't be the source/binary tree location + if (!parsedCorrectly) { + cmSystemTools::Error("Run 'cmake --help' for all supported options."); + exit(1); + } else if (!matched && cmHasLiteralPrefix(arg, "-")) { + possibleUnknownArg = arg; + } else if (!matched) { this->SetDirectoriesFromFile(arg); } - // Empty instance, platform and toolset if only a generator is specified - if (this->GlobalGenerator) { - this->GeneratorInstance = ""; - if (!this->GeneratorPlatformSet) { - this->GeneratorPlatform = ""; - } - if (!this->GeneratorToolsetSet) { - this->GeneratorToolset = ""; - } + } + + if (!possibleUnknownArg.empty() && !scriptMode) { + cmSystemTools::Error(cmStrCat("Unknown argument ", possibleUnknownArg)); + cmSystemTools::Error("Run 'cmake --help' for all supported options."); + exit(1); + } + + // Empty instance, platform and toolset if only a generator is specified + if (this->GlobalGenerator) { + this->GeneratorInstance = ""; + if (!this->GeneratorPlatformSet) { + this->GeneratorPlatform = ""; + } + if (!this->GeneratorToolsetSet) { + this->GeneratorToolset = ""; } } @@ -1949,7 +2153,7 @@ int cmake::ActualConfigure() } } - auto& mf = this->GlobalGenerator->GetMakefiles()[0]; + const auto& mf = this->GlobalGenerator->GetMakefiles()[0]; if (mf->IsOn("CTEST_USE_LAUNCHERS") && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) { cmSystemTools::Error( @@ -2113,7 +2317,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) #endif // Add any cache args if (!this->SetCacheArgs(args)) { - cmSystemTools::Error("Problem processing arguments. Aborting.\n"); + cmSystemTools::Error("Run 'cmake --help' for all supported options."); return -1; } #ifndef CMAKE_BOOTSTRAP @@ -2291,12 +2495,12 @@ cmProp cmake::GetCacheDefinition(const std::string& name) const return this->State->GetInitializedCacheValue(name); } -void cmake::AddScriptingCommands() +void cmake::AddScriptingCommands() const { GetScriptingCommands(this->GetState()); } -void cmake::AddProjectCommands() +void cmake::AddProjectCommands() const { GetProjectCommands(this->GetState()); } @@ -2571,8 +2775,7 @@ int cmake::CheckBuildSystem() if (this->ClearBuildSystem) { // Get the generator used for this build system. - const char* genName = - cmToCStr(mf.GetDefinition("CMAKE_DEPENDS_GENERATOR")); + std::string genName = mf.GetSafeDefinition("CMAKE_DEPENDS_GENERATOR"); if (!cmNonempty(genName)) { genName = "Unix Makefiles"; } diff --git a/Source/cmake.h b/Source/cmake.h index 1ecf2c2..d936f28 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -411,7 +411,7 @@ public: WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; } //! Debug the try compile stuff by not deleting the files - bool GetDebugTryCompile() { return this->DebugTryCompile; } + bool GetDebugTryCompile() const { return this->DebugTryCompile; } void DebugTryCompileOn() { this->DebugTryCompile = true; } /** @@ -456,11 +456,11 @@ public: void SetShowLogContext(bool b) { this->LogContext = b; } //! Do we want debug output during the cmake run. - bool GetDebugOutput() { return this->DebugOutput; } + bool GetDebugOutput() const { return this->DebugOutput; } void SetDebugOutputOn(bool b) { this->DebugOutput = b; } //! Do we want debug output from the find commands during the cmake run. - bool GetDebugFindOutput() { return this->DebugFindOutput; } + bool GetDebugFindOutput() const { return this->DebugFindOutput; } void SetDebugFindOutputOn(bool b) { this->DebugFindOutput = b; } //! Do we want trace output during the cmake run. @@ -482,11 +482,11 @@ public: void SetTraceFile(std::string const& file); void PrintTraceFormatVersion(); - bool GetWarnUninitialized() { return this->WarnUninitialized; } + bool GetWarnUninitialized() const { return this->WarnUninitialized; } void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; } - bool GetWarnUnusedCli() { return this->WarnUnusedCli; } + bool GetWarnUnusedCli() const { return this->WarnUnusedCli; } void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; } - bool GetCheckSystemVars() { return this->CheckSystemVars; } + bool GetCheckSystemVars() const { return this->CheckSystemVars; } void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; } void MarkCliAsUsed(const std::string& variable); @@ -591,8 +591,8 @@ protected: using RegisteredExtraGeneratorsVector = std::vector<cmExternalMakefileProjectGeneratorFactory*>; RegisteredExtraGeneratorsVector ExtraGenerators; - void AddScriptingCommands(); - void AddProjectCommands(); + void AddScriptingCommands() const; + void AddProjectCommands() const; void AddDefaultGenerators(); void AddDefaultExtraGenerators(); @@ -811,6 +811,7 @@ private: F(cxx_std_14) \ F(cxx_std_17) \ F(cxx_std_20) \ + F(cxx_std_23) \ FOR_EACH_CXX98_FEATURE(F) \ FOR_EACH_CXX11_FEATURE(F) \ FOR_EACH_CXX14_FEATURE(F) @@ -820,4 +821,5 @@ private: F(cuda_std_11) \ F(cuda_std_14) \ F(cuda_std_17) \ - F(cuda_std_20) + F(cuda_std_20) \ + F(cuda_std_23) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index e2ff8b7..b8464f2 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -20,6 +20,7 @@ #include "cmStateSnapshot.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmTransformDepfile.h" #include "cmUVProcessChain.h" #include "cmUtils.hxx" #include "cmVersion.h" @@ -28,12 +29,17 @@ #if !defined(CMAKE_BOOTSTRAP) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. # include "cmFileTime.h" -# include "cmServer.h" -# include "cmServerConnection.h" # include "bindexplib.h" #endif +#if !defined(CMAKE_BOOTSTRAP) || defined(CMAKE_BOOTSTRAP_MAKEFILES) +# include <algorithm> + +# include "cmCMakePath.h" +# include "cmProcessTools.h" +#endif + #if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__) # include "cmVisualStudioWCEPlatformParser.h" #endif @@ -59,15 +65,15 @@ #include "cmsys/Directory.hxx" #include "cmsys/FStream.hxx" #include "cmsys/Process.h" +#include "cmsys/RegularExpression.hxx" #include "cmsys/Terminal.h" -class cmConnection; - int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, std::vector<std::string>::const_iterator argEnd); int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, std::vector<std::string>::const_iterator argEnd); +namespace { void CMakeCommandUsage(const char* program) { std::ostringstream errorStream; @@ -121,7 +127,6 @@ void CMakeCommandUsage(const char* program) "(on one volume)\n" << " rm [-rRf] <file/dir>... - remove files or directories, use -f to " "force it, r or R to remove directories and their contents recursively\n" - << " server - start cmake in server mode\n" << " sleep <number>... - sleep for given number of seconds\n" << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" @@ -147,8 +152,7 @@ void CMakeCommandUsage(const char* program) cmSystemTools::Error(errorStream.str()); } -static bool cmTarFilesFrom(std::string const& file, - std::vector<std::string>& files) +bool cmTarFilesFrom(std::string const& file, std::vector<std::string>& files) { if (cmSystemTools::FileIsDirectory(file)) { std::ostringstream e; @@ -183,7 +187,7 @@ static bool cmTarFilesFrom(std::string const& file, return true; } -static void cmCatFile(const std::string& fileToAppend) +void cmCatFile(const std::string& fileToAppend) { #ifdef _WIN32 _setmode(fileno(stdout), _O_BINARY); @@ -193,7 +197,7 @@ static void cmCatFile(const std::string& fileToAppend) std::cout << source.rdbuf(); } -static bool cmRemoveDirectory(const std::string& dir, bool recursive = true) +bool cmRemoveDirectory(const std::string& dir, bool recursive = true) { if (cmSystemTools::FileIsSymlink(dir)) { if (!cmSystemTools::RemoveFile(dir)) { @@ -211,9 +215,123 @@ static bool cmRemoveDirectory(const std::string& dir, bool recursive = true) return true; } -static int HandleIWYU(const std::string& runCmd, - const std::string& /* sourceFile */, - const std::vector<std::string>& orig_cmd) +#if !defined(CMAKE_BOOTSTRAP) || defined(CMAKE_BOOTSTRAP_MAKEFILES) +class CLIncludeParser : public cmProcessTools::LineParser +{ +public: + CLIncludeParser(cm::string_view includePrefix, cmsys::ofstream& depFile, + std::ostream& output) + : IncludePrefix(includePrefix) + , DepFile(depFile) + , Output(output) + { + } + +private: + bool ProcessLine() override + { + if (cmHasPrefix(this->Line, this->IncludePrefix)) { + this->DepFile << cmCMakePath( + cmTrimWhitespace(this->Line.c_str() + + this->IncludePrefix.size())) + .GenericString() + << std::endl; + } else { + this->Output << this->Line << std::endl << std::flush; + } + + return true; + } + + cm::string_view IncludePrefix; + cmsys::ofstream& DepFile; + std::ostream& Output; +}; + +class CLOutputLogger : public cmProcessTools::OutputLogger +{ +public: + CLOutputLogger(std::ostream& log) + : cmProcessTools::OutputLogger(log) + { + } + + bool ProcessLine() override + { + *this->Log << std::flush; + return true; + } +}; + +int CLCompileAndDependencies(const std::vector<std::string>& args) +{ + std::string depFile; + std::string currentBinaryDir; + std::string filterPrefix; + std::vector<std::string> command; + for (auto it = args.cbegin() + 2; it != args.cend(); it++) { + if (cmHasLiteralPrefix(*it, "--dep-file=")) { + depFile = it->substr(11); + } else if (cmHasLiteralPrefix(*it, "--working-dir=")) { + currentBinaryDir = it->substr(14); + } else if (cmHasLiteralPrefix(*it, "--filter-prefix=")) { + filterPrefix = it->substr(16); + } else if (*it == "--") { + command.insert(command.begin(), ++it, args.cend()); + break; + } else { + return 1; + } + } + + std::unique_ptr<cmsysProcess, void (*)(cmsysProcess*)> cp( + cmsysProcess_New(), cmsysProcess_Delete); + std::vector<const char*> argv(command.size() + 1); + std::transform(command.begin(), command.end(), argv.begin(), + [](std::string const& s) { return s.c_str(); }); + argv.back() = nullptr; + cmsysProcess_SetCommand(cp.get(), argv.data()); + cmsysProcess_SetWorkingDirectory(cp.get(), currentBinaryDir.c_str()); + + cmsys::ofstream fout(depFile.c_str()); + if (!fout) { + return 3; + } + + CLIncludeParser includeParser(filterPrefix, fout, std::cout); + CLOutputLogger errLogger(std::cerr); + + // Start the process. + cmProcessTools::RunProcess(cp.get(), &includeParser, &errLogger); + + int status = 0; + // handle status of process + switch (cmsysProcess_GetState(cp.get())) { + case cmsysProcess_State_Exited: + status = cmsysProcess_GetExitValue(cp.get()); + break; + case cmsysProcess_State_Exception: + status = 1; + break; + case cmsysProcess_State_Error: + status = 2; + break; + default: + break; + } + + if (status != 0) { + // remove the dependencies file because potentially invalid + fout.close(); + cmSystemTools::RemoveFile(depFile); + } + + return status; +} +#endif + +int HandleIWYU(const std::string& runCmd, const std::string& /* sourceFile */, + const std::vector<std::string>& orig_cmd) { // Construct the iwyu command line by taking what was given // and adding all the arguments we give to the compiler. @@ -238,8 +356,8 @@ static int HandleIWYU(const std::string& runCmd, return 0; } -static int HandleTidy(const std::string& runCmd, const std::string& sourceFile, - const std::vector<std::string>& orig_cmd) +int HandleTidy(const std::string& runCmd, const std::string& sourceFile, + const std::vector<std::string>& orig_cmd) { // Construct the clang-tidy command line by taking what was given // and adding our compiler command line. The clang-tidy tool will @@ -268,9 +386,8 @@ static int HandleTidy(const std::string& runCmd, const std::string& sourceFile, return ret; } -static int HandleLWYU(const std::string& runCmd, - const std::string& /* sourceFile */, - const std::vector<std::string>&) +int HandleLWYU(const std::string& runCmd, const std::string& /* sourceFile */, + const std::vector<std::string>&) { // Construct the ldd -r -u (link what you use lwyu) command line // ldd -u -r lwuy target @@ -301,9 +418,8 @@ static int HandleLWYU(const std::string& runCmd, return 0; } -static int HandleCppLint(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>&) +int HandleCppLint(const std::string& runCmd, const std::string& sourceFile, + const std::vector<std::string>&) { // Construct the cpplint command line. std::vector<std::string> cpplint_cmd = cmExpandedList(runCmd, true); @@ -329,9 +445,8 @@ static int HandleCppLint(const std::string& runCmd, return 0; } -static int HandleCppCheck(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd) +int HandleCppCheck(const std::string& runCmd, const std::string& sourceFile, + const std::vector<std::string>& orig_cmd) { // Construct the cpplint command line. std::vector<std::string> cppcheck_cmd = cmExpandedList(runCmd, true); @@ -394,7 +509,7 @@ struct CoCompiler bool NoOriginalCommand; }; -static const std::array<CoCompiler, 5> CoCompilers = { +const std::array<CoCompiler, 5> CoCompilers = { { // Table of options and handlers. { "--cppcheck=", HandleCppCheck, false }, { "--cpplint=", HandleCppLint, false }, @@ -408,6 +523,7 @@ struct CoCompileJob std::string Command; CoCompileHandler Handler; }; +} // called when args[0] == "__run_co_compile" int cmcmd::HandleCoCompileCommands(std::vector<std::string> const& args) @@ -589,7 +705,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, } else if (args[2] == "--ignore-eol") { filesDiffer = cmsys::SystemTools::TextFilesDiffer(args[3], args[4]); } else { - ::CMakeCommandUsage(args[0].c_str()); + CMakeCommandUsage(args[0].c_str()); return 2; } @@ -624,8 +740,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, } } if (outValid) { - // The def file already exists and all input files are older than the - // existing def file. + // The def file already exists and all input files are older than + // the existing def file. return 0; } } @@ -1165,12 +1281,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, return 1; } +#if !defined(CMAKE_BOOTSTRAP) || defined(CMAKE_BOOTSTRAP_MAKEFILES) + // Internal CMake compiler dependencies filtering + if (args[1] == "cmake_cl_compile_depends") { + return CLCompileAndDependencies(args); + } +#endif + // Internal CMake link script support. if (args[1] == "cmake_link_script" && args.size() >= 3) { return cmcmd::ExecuteLinkScript(args); } -#if !defined(CMAKE_BOOTSTRAP) || defined(CMAKE_BOOTSTRAP_NINJA) +#if !defined(CMAKE_BOOTSTRAP) // Internal CMake ninja dependency scanning support. if (args[1] == "cmake_ninja_depends") { return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end()); @@ -1359,47 +1482,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, } if (args[1] == "server") { - const std::string pipePrefix = "--pipe="; - bool supportExperimental = false; - bool isDebug = false; - std::string pipe; - - for (auto const& arg : cmMakeRange(args).advance(2)) { - if (arg == "--experimental") { - supportExperimental = true; - } else if (arg == "--debug") { - pipe.clear(); - isDebug = true; - } else if (cmHasPrefix(arg, pipePrefix)) { - isDebug = false; - pipe = arg.substr(pipePrefix.size()); - if (pipe.empty()) { - cmSystemTools::Error("No pipe given after --pipe="); - return 2; - } - } else { - cmSystemTools::Error("Unknown argument for server mode"); - return 1; - } - } -#if !defined(CMAKE_BOOTSTRAP) - cmConnection* conn; - if (isDebug) { - conn = new cmServerStdIoConnection; - } else { - conn = new cmServerPipeConnection(pipe); - } - cmServer server(conn, supportExperimental); - std::string errorMessage; - if (server.Serve(&errorMessage)) { - return 0; - } - cmSystemTools::Error(errorMessage); -#else - static_cast<void>(supportExperimental); - static_cast<void>(isDebug); - cmSystemTools::Error("CMake was not built with server mode enabled"); -#endif + cmSystemTools::Error( + "CMake server mode has been removed in favor of the file-api."); return 1; } @@ -1435,9 +1519,26 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, return cmcmd::WindowsCEEnvironment("9.0", args[2]); } #endif + + // Internal depfile transformation + if (args[1] == "cmake_transform_depfile" && args.size() == 6) { + auto format = cmDepfileFormat::GccDepfile; + if (args[2] == "gccdepfile") { + format = cmDepfileFormat::GccDepfile; + } else if (args[2] == "vstlog") { + format = cmDepfileFormat::VsTlog; + } else { + return 1; + } + std::string prefix = args[3]; + if (prefix == "./") { + prefix.clear(); + } + return cmTransformDepfile(format, prefix, args[4], args[5]) ? 0 : 1; + } } - ::CMakeCommandUsage(args[0].c_str()); + CMakeCommandUsage(args[0].c_str()); return 1; } @@ -1737,7 +1838,6 @@ int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name) int cmcmd::RunPreprocessor(const std::vector<std::string>& command, const std::string& intermediate_file) { - cmUVProcessChainBuilder builder; uv_fs_t fs_req; @@ -1769,7 +1869,6 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command, return 1; } - return 0; } @@ -1787,19 +1886,56 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args) std::cerr << "Invalid cmake_llvm_rc arguments"; return 1; } + const std::string& intermediate_file = args[3]; const std::string& source_file = args[2]; std::vector<std::string> preprocess; std::vector<std::string> resource_compile; std::vector<std::string>* pArgTgt = &preprocess; + + static const cmsys::RegularExpression llvm_rc_only_single_arg("^[-/](N|Y)"); + static const cmsys::RegularExpression llvm_rc_only_double_arg( + "^[-/](C|LN|L)(.)?"); + static const cmsys::RegularExpression common_double_arg( + "^[-/](D|U|I|FO|fo|Fo)(.)?"); + bool acceptNextArg = false; + bool skipNextArg = false; for (std::string const& arg : cmMakeRange(args).advance(4)) { - // We use ++ as seperator between the preprocessing step definition and the - // rc compilation step becase we need to prepend a -- to seperate the + if (skipNextArg) { + skipNextArg = false; + continue; + } + // We use ++ as seperator between the preprocessing step definition and + // the rc compilation step becase we need to prepend a -- to seperate the // source file properly from other options when using clang-cl for // preprocessing. if (arg == "++") { pArgTgt = &resource_compile; + skipNextArg = false; + acceptNextArg = true; } else { + cmsys::RegularExpressionMatch match; + if (!acceptNextArg) { + if (common_double_arg.find(arg.c_str(), match)) { + acceptNextArg = match.match(2).empty(); + } else { + if (llvm_rc_only_single_arg.find(arg.c_str(), match)) { + if (pArgTgt == &preprocess) { + continue; + } + } else if (llvm_rc_only_double_arg.find(arg.c_str(), match)) { + if (pArgTgt == &preprocess) { + skipNextArg = match.match(2).empty(); + continue; + } + acceptNextArg = match.match(2).empty(); + } else if (pArgTgt == &resource_compile) { + continue; + } + } + } else { + acceptNextArg = false; + } if (arg.find("SOURCE_DIR") != std::string::npos) { std::string sourceDirArg = arg; cmSystemTools::ReplaceString( @@ -1819,10 +1955,15 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args) std::cerr << "Empty resource compilation command"; return 1; } + // Since we might have skipped the last argument to llvm-rc + // we need to make sure the llvm-rc source file is present in the + // commandline + if (resource_compile.back() != intermediate_file) { + resource_compile.push_back(intermediate_file); + } auto result = RunPreprocessor(preprocess, intermediate_file); if (result != 0) { - cmSystemTools::RemoveFile(intermediate_file); return result; } @@ -1986,7 +2127,7 @@ static bool RunCommand(const char* comment, << NumberFormatter(exitFormat, retCode) << ") with the following output:\n" << output; - } else { + } else if (verbose) { // always print the output of the command, unless // it is the dumb rc command banner if (output.find("Resource Compiler Version") == std::string::npos) { @@ -2109,8 +2250,8 @@ int cmVSLink::LinkIncremental() // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx // 1. Compiler compiles the application and generates the *.obj files. - // 2. An empty manifest file is generated if this is a clean build and if - // not the previous one is reused. + // 2. An empty manifest file is generated if this is a clean build and + // if not the previous one is reused. // 3. The resource compiler (rc.exe) compiles the *.manifest file to a // *.res file. // 4. Linker generates the binary (EXE or DLL) with the /incremental diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index c438e1d..c2576f3 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -102,6 +102,12 @@ target_link_libraries(zot zot_pch) if(NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") target_precompile_headers(zot_pch PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/zot_pch.hxx) endif() +if (CMAKE_CXX_DEPENDS_USE_COMPILER AND + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.4") + # Mixing pre-compile headers and flags to generate dependencies (-M options family) + # causes the compiler to crash + set_property(TARGET zot_pch PROPERTY DISABLE_PRECOMPILE_HEADERS ON) +endif() # Test the #include line macro transformation rule support. set_property( diff --git a/Tests/CMakeLib/testGccDepfileReader.cxx b/Tests/CMakeLib/testGccDepfileReader.cxx index e79f047..d46e8f3 100644 --- a/Tests/CMakeLib/testGccDepfileReader.cxx +++ b/Tests/CMakeLib/testGccDepfileReader.cxx @@ -5,6 +5,8 @@ #include <utility> #include <vector> +#include <cm/optional> + #include "cmsys/FStream.hxx" #include "cmGccDepfileReader.h" @@ -112,17 +114,26 @@ int testGccDepfileReader(int argc, char* argv[]) std::string dataDirPath = argv[1]; dataDirPath += "/testGccDepfileReader_data"; - const int numberOfTestFiles = 3; + const int numberOfTestFiles = 7; // 6th file doesn't exist for (int i = 1; i <= numberOfTestFiles; ++i) { const std::string base = dataDirPath + "/deps" + std::to_string(i); const std::string depfile = base + ".d"; const std::string plainDepfile = base + ".txt"; std::cout << "Comparing " << base << " with " << plainDepfile << std::endl; const auto actual = cmReadGccDepfile(depfile.c_str()); - const auto expected = readPlainDepfile(plainDepfile.c_str()); - if (!compare(actual, expected)) { - dump("actual", actual); - dump("expected", expected); + if (cmSystemTools::FileExists(plainDepfile)) { + if (!actual) { + std::cerr << "Reading " << depfile << " should have succeeded\n"; + return 1; + } + const auto expected = readPlainDepfile(plainDepfile.c_str()); + if (!compare(*actual, expected)) { + dump("actual", *actual); + dump("expected", expected); + return 1; + } + } else if (actual) { + std::cerr << "Reading " << depfile << " should have failed\n"; return 1; } } diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps4.d b/Tests/CMakeLib/testGccDepfileReader_data/deps4.d new file mode 100644 index 0000000..9977a28 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps4.d @@ -0,0 +1 @@ +invalid diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps5.d b/Tests/CMakeLib/testGccDepfileReader_data/deps5.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps5.d diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt new file mode 100644 index 0000000..6c4a75b --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps5.txt @@ -0,0 +1,2 @@ +--RULES-- +--DEPENDENCIES-- diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps7.d b/Tests/CMakeLib/testGccDepfileReader_data/deps7.d new file mode 100644 index 0000000..92280cf --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps7.d @@ -0,0 +1,6 @@ +out1 \ + out2: \ + in1 \ + in2 + +out3: in3 diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt new file mode 100644 index 0000000..86b6600 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps7.txt @@ -0,0 +1,10 @@ +--RULES-- +out1 +out2 +--DEPENDENCIES-- +in1 +in2 +--RULES-- +out3 +--DEPENDENCIES-- +in3 diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index de09c0f..2d7dd7c 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -82,6 +82,18 @@ public: int Value = 0; }; +class NoMoveAssignEventLogger : public EventLogger +{ +public: + using EventLogger::EventLogger; + + NoMoveAssignEventLogger(const NoMoveAssignEventLogger&) = default; + NoMoveAssignEventLogger(NoMoveAssignEventLogger&&) = default; + + NoMoveAssignEventLogger& operator=(const NoMoveAssignEventLogger&) = default; + NoMoveAssignEventLogger& operator=(NoMoveAssignEventLogger&&) = delete; +}; + #define ASSERT_TRUE(x) \ do { \ if (!(x)) { \ @@ -328,12 +340,28 @@ static bool testCopyAssign(std::vector<Event>& expected) o1 = o4; // Intentionally duplicated to test assigning an empty optional to // an empty optional + cm::optional<NoMoveAssignEventLogger> o5{ 1 }; + auto const* v5 = &*o5; + const cm::optional<NoMoveAssignEventLogger> o6{ 2 }; + auto const* v6 = &*o6; + o5 = std::move(o6); + const NoMoveAssignEventLogger e7{ 3 }; + o5 = std::move(e7); + expected = { { Event::VALUE_CONSTRUCT, v2, nullptr, 4 }, { Event::COPY_CONSTRUCT, v1, v2, 4 }, { Event::VALUE_CONSTRUCT, v3, nullptr, 5 }, { Event::COPY_ASSIGN, v1, v3, 5 }, { Event::DESTRUCT, v1, nullptr, 5 }, + { Event::VALUE_CONSTRUCT, v5, nullptr, 1 }, + { Event::VALUE_CONSTRUCT, v6, nullptr, 2 }, + { Event::COPY_ASSIGN, v5, v6, 2 }, + { Event::VALUE_CONSTRUCT, &e7, nullptr, 3 }, + { Event::COPY_ASSIGN, v5, &e7, 3 }, + { Event::DESTRUCT, &e7, nullptr, 3 }, + { Event::DESTRUCT, v6, nullptr, 2 }, + { Event::DESTRUCT, v5, nullptr, 3 }, { Event::DESTRUCT, v3, nullptr, 5 }, { Event::DESTRUCT, v2, nullptr, 4 }, }; diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 61a77cf..a003205 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -181,6 +181,10 @@ bool checkOutput(std::istream& outputStream, std::istream& errorStream) } std::string error = getInput(errorStream); + auto qemu_error_pos = error.find("qemu:"); + if (qemu_error_pos != std::string::npos) { + error.resize(qemu_error_pos); + } if (error.length() != 3 || error.find('1') == std::string::npos || error.find('2') == std::string::npos || error.find('3') == std::string::npos) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 02759d1..14095dd 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -240,8 +240,6 @@ if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeLib) - - add_subdirectory(CMakeServerLib) endif() add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) @@ -1411,6 +1409,7 @@ if(BUILD_TESTING) GTK2 Iconv ICU + Intl JPEG JsonCpp LAPACK @@ -2910,13 +2909,6 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CMakeCommands.link_directories) ADD_TEST_MACRO(CMakeCommands.target_link_directories) - # The cmake server-mode test requires python for a simple client. - find_package(PythonInterp QUIET) - if(PYTHON_EXECUTABLE) - set(Server_BUILD_OPTIONS -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}) - ADD_TEST_MACRO(Server Server) - endif() - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" diff --git a/Tests/CMakeServerLib/CMakeLists.txt b/Tests/CMakeServerLib/CMakeLists.txt deleted file mode 100644 index 2c23c2d..0000000 --- a/Tests/CMakeServerLib/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMake_BINARY_DIR}/Source - ${CMake_SOURCE_DIR}/Source - ) - -set(CMakeServerLib_TESTS - testServerBuffering.cpp - ) - -create_test_sourcelist(CMakeLib_TEST_SRCS CMakeServerLibTests.cxx ${CMakeServerLib_TESTS}) -add_executable(CMakeServerLibTests ${CMakeLib_TEST_SRCS}) -target_link_libraries(CMakeServerLibTests CMakeLib CMakeServerLib) - -SET_PROPERTY(TARGET CMakeServerLibTests PROPERTY C_CLANG_TIDY "") -SET_PROPERTY(TARGET CMakeServerLibTests PROPERTY CXX_CLANG_TIDY "") - -foreach(testfile ${CMakeServerLib_TESTS}) - get_filename_component(test "${testfile}" NAME_WE) - add_test(CMakeServerLib.${test} CMakeServerLibTests ${test} ${${test}_ARGS}) -endforeach() diff --git a/Tests/CMakeServerLib/testServerBuffering.cpp b/Tests/CMakeServerLib/testServerBuffering.cpp deleted file mode 100644 index 6f22940..0000000 --- a/Tests/CMakeServerLib/testServerBuffering.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include <iostream> -#include <memory> -#include <string> -#include <vector> - -#include "cmConnection.h" -#include "cmServerConnection.h" - -void print_error(const std::vector<std::string>& input, - const std::vector<std::string>& output) -{ - std::cerr << "Responses don't equal input messages input." << std::endl; - std::cerr << "Responses: " << std::endl; - - for (auto& msg : output) { - std::cerr << "'" << msg << "'" << std::endl; - } - - std::cerr << "Input messages" << std::endl; - for (auto& msg : input) { - std::cerr << "'" << msg << "'" << std::endl; - } -} - -std::string trim_newline(const std::string& _buffer) -{ - auto buffer = _buffer; - while (!buffer.empty() && (buffer.back() == '\n' || buffer.back() == '\r')) { - buffer.pop_back(); - } - return buffer; -} - -int testServerBuffering(int, char** const) -{ - std::vector<std::string> messages = { - "{ \"test\": 10}", "{ \"test\": { \"test2\": false} }", - "{ \"test\": [1, 2, 3] }", - "{ \"a\": { \"1\": {}, \n\n\n \"2\":[] \t\t\t\t}}" - }; - - std::string fullMessage; - for (auto& msg : messages) { - fullMessage += "[== \"CMake Server\" ==[\n"; - fullMessage += msg; - fullMessage += "\n]== \"CMake Server\" ==]\n"; - } - - // The buffering strategy should cope with any fragmentation, including - // just getting the characters one at a time. - auto bufferingStrategy = - std::unique_ptr<cmConnectionBufferStrategy>(new cmServerBufferStrategy); - std::vector<std::string> response; - std::string rawBuffer; - for (auto& messageChar : fullMessage) { - rawBuffer += messageChar; - std::string packet = bufferingStrategy->BufferMessage(rawBuffer); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(rawBuffer); - } while (!packet.empty()); - } - - if (response != messages) { - print_error(messages, response); - return 1; - } - - // We should also be able to deal with getting a bunch at once - response.clear(); - std::string packet = bufferingStrategy->BufferMessage(fullMessage); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(fullMessage); - } while (!packet.empty()); - - if (response != messages) { - print_error(messages, response); - return 1; - } - - return 0; -} diff --git a/Tests/CMakeTests/EndStuffTestScript.cmake b/Tests/CMakeTests/EndStuffTestScript.cmake index 9f40818..6a6b162 100644 --- a/Tests/CMakeTests/EndStuffTestScript.cmake +++ b/Tests/CMakeTests/EndStuffTestScript.cmake @@ -1,68 +1,40 @@ message(STATUS "testname='${testname}'") -if(testname STREQUAL bad_else) # fail - file(WRITE "${dir}/${testname}.cmake" -"else() -") +function(do_end content) + file(WRITE "${dir}/${testname}.cmake" "${content}") execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" RESULT_VARIABLE rv) if(NOT rv EQUAL 0) message(FATAL_ERROR "${testname} failed") endif() +endfunction() + +if(testname STREQUAL bad_else) # fail + do_end("else()\n") elseif(testname STREQUAL bad_elseif) # fail - file(WRITE "${dir}/${testname}.cmake" -"elseif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() + do_end("elseif()\n") elseif(testname STREQUAL bad_endforeach) # fail - endforeach() + do_end("endforeach()\n") elseif(testname STREQUAL bad_endfunction) # fail - endfunction() + do_end("endfunction()\n") elseif(testname STREQUAL bad_endif) # fail - file(WRITE "${dir}/${testname}.cmake" -"cmake_minimum_required(VERSION 2.8) -endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() + do_end("cmake_minimum_required(VERSION 2.8)\nendif()\n") -elseif(testname STREQUAL endif_low_min_version) # pass - file(WRITE "${dir}/${testname}.cmake" -"cmake_minimum_required(VERSION 1.2) -endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() +elseif(testname STREQUAL endif_low_min_version) # fail + do_end("cmake_minimum_required(VERSION 1.2)\nendif()\n") -elseif(testname STREQUAL endif_no_min_version) # pass - file(WRITE "${dir}/${testname}.cmake" -"endif() -") - execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake" - RESULT_VARIABLE rv) - if(NOT rv EQUAL 0) - message(FATAL_ERROR "${testname} failed") - endif() +elseif(testname STREQUAL endif_no_min_version) # fail + do_end("endif()\n") elseif(testname STREQUAL bad_endmacro) # fail - endmacro() + do_end("endmacro()\n") elseif(testname STREQUAL bad_endwhile) # fail - endwhile() + do_end("endwhile()\n") else() # fail message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 7d0fa0f..a3ef4eb 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -32,6 +32,20 @@ if(UNIX) set(GIT ${TOP}/git.sh) endif() +# Adapt to the system default branch name. +execute_process( + COMMAND ${GIT} config --get init.defaultBranch + RESULT_VARIABLE defaultBranchFailed + OUTPUT_VARIABLE defaultBranch + ERROR_VARIABLE defaultBranchError + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) +if(defaultBranch STREQUAL "") + set(defaultBranch master) +endif() +message("Detected default branch name '${defaultBranch}'") + #----------------------------------------------------------------------------- # Create the repository. message("Creating repository...") @@ -64,7 +78,7 @@ run_child(WORKING_DIRECTORY ${TOP}/module COMMAND ${GIT} commit -m "Initial content" ) run_child(WORKING_DIRECTORY ${TOP}/module - COMMAND ${GIT} push origin master:refs/heads/master + COMMAND ${GIT} push origin ${defaultBranch}:refs/heads/${defaultBranch} ) #----------------------------------------------------------------------------- @@ -80,7 +94,7 @@ file(APPEND ${TOP}/import/.git/config " ${AUTHOR_CONFIG}") create_content(import) file(WRITE ${TOP}/import/HEAD "HEAD\n") -file(WRITE ${TOP}/import/master "master\n") +file(WRITE ${TOP}/import/${defaultBranch} "${defaultBranch}\n") run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} add . ) @@ -94,7 +108,7 @@ run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} commit -m "Initial content" ) run_child(WORKING_DIRECTORY ${TOP}/import - COMMAND ${GIT} push origin master:refs/heads/master + COMMAND ${GIT} push origin ${defaultBranch}:refs/heads/${defaultBranch} ) #----------------------------------------------------------------------------- @@ -107,7 +121,7 @@ run_child(WORKING_DIRECTORY ${TOP}/module COMMAND ${GIT} commit -m "Changed content" ) run_child(WORKING_DIRECTORY ${TOP}/module - COMMAND ${GIT} push origin master:refs/heads/master + COMMAND ${GIT} push origin ${defaultBranch}:refs/heads/${defaultBranch} ) #----------------------------------------------------------------------------- @@ -163,7 +177,7 @@ run_child( COMMAND ${GIT} rm -- ${files_removed} ) run_child(WORKING_DIRECTORY ${TOP}/user-source/module - COMMAND ${GIT} checkout master -- + COMMAND ${GIT} checkout ${defaultBranch} -- ) run_child( WORKING_DIRECTORY ${TOP}/user-source @@ -222,7 +236,7 @@ rewind_source(user-source) # modified files) even if ~/.gitconfig sets "branch.master.rebase". run_child( WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} config branch.master.rebase false + COMMAND ${GIT} config branch.${defaultBranch}.rebase false ) # Create a modified file. @@ -254,7 +268,7 @@ create_build_tree(user-source user-binary-custom) file(APPEND ${TOP}/user-binary-custom/CTestConfiguration.ini "# GIT command configuration UpdateCommand: ${GIT} -GITUpdateCustom: ${GIT};pull;origin;master +GITUpdateCustom: ${GIT};pull;origin;${defaultBranch} ") # Run the dashboard command line interface. @@ -304,7 +318,7 @@ create_dashboard_script(dash-binary-custom "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) -set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) +set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin ${defaultBranch}) ") # Run the dashboard script with CTest. @@ -339,7 +353,7 @@ create_dashboard_script(dash-binary-quiet "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) -set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) +set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin ${defaultBranch}) ") unset(ctest_update_args) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index ef9198d..0838532 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -268,6 +268,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) if (std_flag_idx EQUAL -1) add_executable(default_dialect default_dialect.cpp) target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX23=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},23> DEFAULT_CXX20=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},20> DEFAULT_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17> DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> @@ -349,6 +350,7 @@ else() HAVE_CXX_STD_14=$<COMPILE_FEATURES:cxx_std_14> HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17> HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20> + HAVE_CXX_STD_23=$<COMPILE_FEATURES:cxx_std_23> ) endif() diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index e6b3ff6..bd504ff 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -18,7 +18,11 @@ struct Outputter; # define CXX_STD __cplusplus #endif -#if DEFAULT_CXX20 +#if DEFAULT_CXX23 +# if CXX_STD <= 202002L +Outputter<CXX_STD> o; +# endif +#elif DEFAULT_CXX20 # if CXX_STD <= 201703L Outputter<CXX_STD> o; # endif diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 53dce62..9c3910e 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -21,6 +21,12 @@ # if HAVE_CXX_STD_17 && !defined(ALLOW_LATER_STANDARDS) # error HAVE_CXX_STD_17 is true with CXX_STANDARD == 11 # endif +# if HAVE_CXX_STD_20 && !defined(ALLOW_LATER_STANDARDS) +# error HAVE_CXX_STD_20 is true with CXX_STANDARD == 11 +# endif +# if HAVE_CXX_STD_23 && !defined(ALLOW_LATER_STANDARDS) +# error HAVE_CXX_STD_23 is true with CXX_STANDARD == 11 +# endif #endif #if !HAVE_OVERRIDE_CONTROL diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt index 5e8a8e4..38765ec 100644 --- a/Tests/CudaOnly/CompileFlags/CMakeLists.txt +++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt @@ -8,6 +8,7 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") target_compile_options(CudaOnlyCompileFlags PRIVATE -gencode arch=compute_50,code=compute_50 ) + set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES) else() set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real) endif() diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index ee5f54d..e7e7bc4 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.19) project (ExportPTX CUDA) #Goal for this example: @@ -6,6 +6,10 @@ project (ExportPTX CUDA) # How to reference PTX files for custom commands # How to install PTX files +# PTX can be compiled only for a single virtual architecture at a time +list(SUBLIST CMAKE_CUDA_ARCHITECTURES 0 1 CMAKE_CUDA_ARCHITECTURES) +string(APPEND CMAKE_CUDA_ARCHITECTURES "-virtual") + add_library(CudaPTX OBJECT kernelA.cu kernelB.cu) set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON) diff --git a/Tests/FindIntl/CMakeLists.txt b/Tests/FindIntl/CMakeLists.txt new file mode 100644 index 0000000..0906ede --- /dev/null +++ b/Tests/FindIntl/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindIntl.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindIntl/Test" + "${CMake_BINARY_DIR}/Tests/FindIntl/Test" + ${build_generator_args} + --build-project TestFindIntl + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindIntl/Test/CMakeLists.txt b/Tests/FindIntl/Test/CMakeLists.txt new file mode 100644 index 0000000..5140406 --- /dev/null +++ b/Tests/FindIntl/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindIntl CXX) +include(CTest) + +find_package(Intl REQUIRED) + +add_executable(test_intl_tgt main.cxx) +target_link_libraries(test_intl_tgt Intl::Intl) +add_test(NAME test_intl_tgt COMMAND test_intl_tgt) + +add_executable(test_intl_var main.cxx) +target_include_directories(test_intl_var PRIVATE ${Intl_INCLUDE_DIRS}) +target_link_libraries(test_intl_var PRIVATE ${Intl_LIBRARIES}) +add_test(NAME test_intl_var COMMAND test_intl_var) diff --git a/Tests/FindIntl/Test/main.cxx b/Tests/FindIntl/Test/main.cxx new file mode 100644 index 0000000..d90c095 --- /dev/null +++ b/Tests/FindIntl/Test/main.cxx @@ -0,0 +1,11 @@ +extern "C" { +#include <libintl.h> +} + +int main() +{ + // Check if we include the directory correctly and have no link errors + bindtextdomain("", ""); + gettext(""); + return 0; +} diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 44484c3..520ba9e 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -451,6 +451,18 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endif() + + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_test(NAME FindPython.UnversionedNames COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames" + "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames" + ${build_generator_args} + --build-project UnversionedNames + --build-options ${build_options} + ) + endif() endif() if(CMake_TEST_FindPython_NumPy) diff --git a/Tests/FindPython/UnversionedNames/CMakeLists.txt b/Tests/FindPython/UnversionedNames/CMakeLists.txt new file mode 100644 index 0000000..597bd4e --- /dev/null +++ b/Tests/FindPython/UnversionedNames/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.19...3.20) + +project(UnversionedNames LANGUAGES NONE) + +# check if it is possible to find python with a generic name +find_program(UNVERSIONED_Python3 NAMES python3) + +if (NOT UNVERSIONED_Python3) + # no generic name available + # test cannot be done + return() +endif() + +# search with default configuration +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +if (Python3_EXECUTABLE STREQUAL UNVERSIONED_Python3) + # default configuration pick-up the generic name + # test cannot be completed + return() +endif() + +unset(Python3_EXECUTABLE) +# Force now to search first for generic name +set(Python3_FIND_UNVERSIONED_NAMES FIRST) + +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +if (NOT Python3_EXECUTABLE STREQUAL UNVERSIONED_Python3) + message(SEND_ERROR "Found unexpected interpreter ${Python3_EXECUTABLE} instead of ${UNVERSIONED_Python3}") +endif() + +# To check value 'NEVER", creates directory holding a symlink to the generic name +file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/bin") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") +file(CREATE_LINK "${UNVERSIONED_Python3}" "${CMAKE_CURRENT_BINARY_DIR}/bin/python3" SYMBOLIC) + +unset(Python3_EXECUTABLE) +set(Python3_FIND_UNVERSIONED_NAMES FIRST) +set(Python3_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}") +# First search: generic name must be found +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +if (NOT Python3_EXECUTABLE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/bin/python3") + message(FATAL_ERROR "Found unexpected interpreter ${Python3_EXECUTABLE} instead of ${CMAKE_CURRENT_BINARY_DIR}/bin/python3") +endif() + +unset(Python3_EXECUTABLE) +set(Python3_FIND_UNVERSIONED_NAMES LAST) + +# Second search: generic name must be found +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +if (NOT Python3_EXECUTABLE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/bin/python3") + message(FATAL_ERROR "Found unexpected interpreter ${Python3_EXECUTABLE} instead of ${CMAKE_CURRENT_BINARY_DIR}/bin/python3") +endif() + +unset(Python3_EXECUTABLE) +set(Python3_FIND_UNVERSIONED_NAMES NEVER) + +# Third search: generic name must NOT be found +find_package(Python3 REQUIRED COMPONENTS Interpreter) + +if (Python3_EXECUTABLE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/bin/python3") + message(FATAL_ERROR "Found unexpected interpreter ${Python3_EXECUTABLE}") +endif() diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 1f5b664..d4c19c7 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -67,7 +67,11 @@ else() endif() # Test escaping of special characters in include directory paths. -set(special_chars "~@%&{}()!'") +set(special_chars "~@&{}()!'") +if(NOT CMAKE_GENERATOR MATCHES "(Unix|MinGW|MSYS) Makefiles") + # when compiler is used for dependencies, special characters for make are not escaped + string(APPEND special_chars "%") +endif() if(NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") # Watcom seems to have no way to encode these characters. string(APPEND special_chars "#=[]") diff --git a/Tests/RunCMake/ABI/C-stdout.txt b/Tests/RunCMake/ABI/C-stdout.txt new file mode 100644 index 0000000..5b67b84 --- /dev/null +++ b/Tests/RunCMake/ABI/C-stdout.txt @@ -0,0 +1 @@ +-- Check if the system is big endian diff --git a/Tests/RunCMake/ABI/C.cmake b/Tests/RunCMake/ABI/C.cmake new file mode 100644 index 0000000..92f5da4 --- /dev/null +++ b/Tests/RunCMake/ABI/C.cmake @@ -0,0 +1,22 @@ +enable_language(C) +if(NOT CMAKE_C_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$") + if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;") + return() + endif() + message(FATAL_ERROR "CMAKE_C_BYTE_ORDER has unexpected value '${CMAKE_C_BYTE_ORDER}'") +endif() + +include(TestBigEndian) +test_big_endian(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN AND NOT CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() + +# Test legacy check. +set(byte_order "${CMAKE_C_BYTE_ORDER}") +unset(CMAKE_C_BYTE_ORDER) +include(TestBigEndian) +test_big_endian(IS_BIG) +if(IS_BIG AND NOT byte_order STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() diff --git a/Tests/RunCMake/ABI/CMakeLists.txt b/Tests/RunCMake/ABI/CMakeLists.txt new file mode 100644 index 0000000..ab1a20c --- /dev/null +++ b/Tests/RunCMake/ABI/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ABI/CUDA.cmake b/Tests/RunCMake/ABI/CUDA.cmake new file mode 100644 index 0000000..8ede3a9 --- /dev/null +++ b/Tests/RunCMake/ABI/CUDA.cmake @@ -0,0 +1,13 @@ +enable_language(CUDA) +if(NOT CMAKE_CUDA_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$") + if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;") + return() + endif() + message(FATAL_ERROR "CMAKE_CUDA_BYTE_ORDER has unexpected value '${CMAKE_CUDA_BYTE_ORDER}'") +endif() + +include(TestBigEndian) +test_big_endian(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN AND NOT CMAKE_CUDA_BYTE_ORDER STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() diff --git a/Tests/RunCMake/ABI/CXX-stdout.txt b/Tests/RunCMake/ABI/CXX-stdout.txt new file mode 100644 index 0000000..5b67b84 --- /dev/null +++ b/Tests/RunCMake/ABI/CXX-stdout.txt @@ -0,0 +1 @@ +-- Check if the system is big endian diff --git a/Tests/RunCMake/ABI/CXX.cmake b/Tests/RunCMake/ABI/CXX.cmake new file mode 100644 index 0000000..2310002 --- /dev/null +++ b/Tests/RunCMake/ABI/CXX.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) +if(NOT CMAKE_CXX_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$") + if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;") + return() + endif() + message(FATAL_ERROR "CMAKE_CXX_BYTE_ORDER has unexpected value '${CMAKE_CXX_BYTE_ORDER}'") +endif() + +include(TestBigEndian) +test_big_endian(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN AND NOT CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() + +# Test legacy check. +set(byte_order "${CMAKE_CXX_BYTE_ORDER}") +unset(CMAKE_CXX_BYTE_ORDER) +include(TestBigEndian) +test_big_endian(IS_BIG) +if(IS_BIG AND NOT byte_order STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() diff --git a/Tests/RunCMake/ABI/OBJC.cmake b/Tests/RunCMake/ABI/OBJC.cmake new file mode 100644 index 0000000..ab67459 --- /dev/null +++ b/Tests/RunCMake/ABI/OBJC.cmake @@ -0,0 +1,13 @@ +enable_language(OBJC) +if(NOT CMAKE_OBJC_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$") + if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;") + return() + endif() + message(FATAL_ERROR "CMAKE_OBJC_BYTE_ORDER has unexpected value '${CMAKE_OBJC_BYTE_ORDER}'") +endif() + +include(TestBigEndian) +test_big_endian(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN AND NOT CMAKE_OBJC_BYTE_ORDER STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() diff --git a/Tests/RunCMake/ABI/OBJCXX.cmake b/Tests/RunCMake/ABI/OBJCXX.cmake new file mode 100644 index 0000000..41a719e --- /dev/null +++ b/Tests/RunCMake/ABI/OBJCXX.cmake @@ -0,0 +1,13 @@ +enable_language(OBJCXX) +if(NOT CMAKE_OBJCXX_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$") + if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;") + return() + endif() + message(FATAL_ERROR "CMAKE_OBJCXX_BYTE_ORDER has unexpected value '${CMAKE_OBJCXX_BYTE_ORDER}'") +endif() + +include(TestBigEndian) +test_big_endian(IS_BIG_ENDIAN) +if(IS_BIG_ENDIAN AND NOT CMAKE_OBJCXX_BYTE_ORDER STREQUAL "BIG_ENDIAN") + message(FATAL_ERROR "test_big_endian result does not match ABI result") +endif() diff --git a/Tests/RunCMake/ABI/RunCMakeTest.cmake b/Tests/RunCMake/ABI/RunCMakeTest.cmake new file mode 100644 index 0000000..d9eabb7 --- /dev/null +++ b/Tests/RunCMake/ABI/RunCMakeTest.cmake @@ -0,0 +1,15 @@ +include(RunCMake) + +run_cmake(C) +run_cmake(CXX) + +if(APPLE) + run_cmake(OBJC) + run_cmake(OBJCXX) +endif() + +if(CMake_TEST_CUDA) + run_cmake(CUDA) +endif() + +run_cmake(TestBigEndian-NoLang) diff --git a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt b/Tests/RunCMake/ABI/TestBigEndian-NoLang-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt +++ b/Tests/RunCMake/ABI/TestBigEndian-NoLang-result.txt diff --git a/Tests/RunCMake/ABI/TestBigEndian-NoLang-stderr.txt b/Tests/RunCMake/ABI/TestBigEndian-NoLang-stderr.txt new file mode 100644 index 0000000..d0aa899 --- /dev/null +++ b/Tests/RunCMake/ABI/TestBigEndian-NoLang-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at [^ +]*/Modules/TestBigEndian.cmake:[0-9]+ \(message\): + TEST_BIG_ENDIAN needs either C or CXX language enabled +Call Stack \(most recent call first\): + [^ +]*/Modules/TestBigEndian.cmake:[0-9]+ \(__TEST_BIG_ENDIAN_LEGACY_IMPL\) + TestBigEndian-NoLang.cmake:[0-9]+ \(test_big_endian\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/ABI/TestBigEndian-NoLang.cmake b/Tests/RunCMake/ABI/TestBigEndian-NoLang.cmake new file mode 100644 index 0000000..8c10201 --- /dev/null +++ b/Tests/RunCMake/ABI/TestBigEndian-NoLang.cmake @@ -0,0 +1,2 @@ +include(TestBigEndian) +test_big_endian(var) diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index c4b1a00..aa0cf4d 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -103,6 +103,13 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) set(ndk_arg) endif() + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_FIND_ROOT_PATH=/tmp + ${ndk_arg} + ) + run_cmake(ndk-search-order) + # Test failure cases. message(STATUS "ndk='${ndk}'") if(RunCMake_GENERATOR MATCHES "Visual Studio") diff --git a/Tests/RunCMake/Android/ndk-search-order.cmake b/Tests/RunCMake/Android/ndk-search-order.cmake new file mode 100644 index 0000000..498d775 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-search-order.cmake @@ -0,0 +1,17 @@ +if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) + return() +endif() + +find_library(LIBDL dl) +if(NOT LIBDL) + message(FATAL_ERROR "libdl not found.") +endif() + +if(LIBDL MATCHES ".a$") + message(FATAL_ERROR "found libdl.a") +endif() + +find_program(CLANG clang) +if(NOT CLANG) + message(FATAL_ERROR "clang not found") +endif() diff --git a/Tests/RunCMake/BuildDepends/CompilerDependencies.cmake b/Tests/RunCMake/BuildDepends/CompilerDependencies.cmake new file mode 100644 index 0000000..8a9e600 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CompilerDependencies.cmake @@ -0,0 +1,46 @@ +enable_language(C) + +add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c) + +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.h\" + ) +set(check_exes + \"$<TARGET_FILE:main>\" + ) + +if (check_step EQUAL 2) + include(\"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.cmake\") + if (NOT CMAKE_DEPEND_INFO_FILES) + set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPEND_INFO_FILES not found.\") + else() + include(\"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_DEPEND_INFO_FILES}\") + if (NOT CMAKE_DEPENDS_DEPENDENCY_FILES) + set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPENDS_DEPENDENCY_FILES not found.\") + else() + list(GET CMAKE_DEPENDS_DEPENDENCY_FILES 1 OBJECT_FILE) + list(GET CMAKE_DEPENDS_DEPENDENCY_FILES 3 DEP_FILE) + if (NOT EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/\${DEP_FILE}\") + set(RunCMake_TEST_FAILED \"File \${DEP_FILE} not found.\") + else() + set (TARGET_DEP_FILE \"${CMAKE_CURRENT_BINARY_DIR}/\${DEP_FILE}\") + cmake_path(REPLACE_FILENAME TARGET_DEP_FILE \"compiler_depend.make\") + file(READ \"\${TARGET_DEP_FILE}\" DEPENDS_CONTENT) + if (WIN32) + string (REPLACE \"\\\\\" \"/\" DEPENDS_CONTENT \"\${DEPENDS_CONTENT}\") + string (TOLOWER \"\${DEPENDS_CONTENT}\" DEPENDS_CONTENT) + string (TOLOWER \"\${OBJECT_FILE}\" OBJECT_FILE) + else() + string(REPLACE \"\\\\ \" \" \" DEPENDS_CONTENT \"\${DEPENDS_CONTENT}\") + endif() + if(NOT DEPENDS_CONTENT MATCHES \"\${OBJECT_FILE} *:.+main.c\" + OR NOT DEPENDS_CONTENT MATCHES \"main.h\") + set(RunCMake_TEST_FAILED \"Dependency file '\${TARGET_DEP_FILE}' badly generated.\") + endif() + endif() + endif() + endif() +endif() +") diff --git a/Tests/RunCMake/BuildDepends/CompilerDependencies.step1.cmake b/Tests/RunCMake/BuildDepends/CompilerDependencies.step1.cmake new file mode 100644 index 0000000..1da2593 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CompilerDependencies.step1.cmake @@ -0,0 +1,9 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" [[ +#define COUNT 1 +]]) + +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[ +#include "main.h" + +int main(void) { return COUNT; } +]]) diff --git a/Tests/RunCMake/BuildDepends/CompilerDependencies.step2.cmake b/Tests/RunCMake/BuildDepends/CompilerDependencies.step2.cmake new file mode 100644 index 0000000..e983665 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CompilerDependencies.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" [[ +#define COUNT 2 +]]) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 7a68c4b..23e222a 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -113,3 +113,13 @@ if(CMake_TEST_BuildDepends_GNU_AS) set(ENV{ASM} "${CMake_TEST_BuildDepends_GNU_AS}") run_BuildDepends(GNU-AS) endif() + +if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles" + AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" + OR CMAKE_C_COMPILER_ID STREQUAL "Clang" + OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) + OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles" + AND MSVC_VERSION GREATER 1300 + AND CMAKE_C_COMPILER_ID STREQUAL "MSVC")) + run_BuildDepends(CompilerDependencies) +endif() diff --git a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake index 3d8eb73..ee5ed5b 100644 --- a/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake +++ b/Tests/RunCMake/CMP0026/LOCATION-and-TARGET_OBJECTS.cmake @@ -1,4 +1,4 @@ - +cmake_policy(SET CMP0118 NEW) enable_language(CXX) add_library(foo OBJECT empty.cpp) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake index dd2dd72..9916948 100644 --- a/Tests/RunCMake/CMP0026/clear-cached-information.cmake +++ b/Tests/RunCMake/CMP0026/clear-cached-information.cmake @@ -1,4 +1,4 @@ - +cmake_policy(SET CMP0118 NEW) enable_language(C) cmake_policy(SET CMP0026 OLD) diff --git a/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake index 415eecc..6988447 100644 --- a/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake +++ b/Tests/RunCMake/CMP0104/CMP0104-OLD.cmake @@ -1,3 +1,5 @@ +set(ENV{CUDAARCHS}) + cmake_policy(SET CMP0104 OLD) include(CMP0104-Common.cmake) diff --git a/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt index 7ad774e..8a4d7e4 100644 --- a/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0106/CMP0106-NEW-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*/Modules/Documentation.cmake:15 \(message\): +CMake Error at .*/Modules/Documentation.cmake:[0-9]+ \(message\): Documentation.cmake is VTK-specific code and should not be used in non-VTK projects. This logic in this module is best shipped with the project using it rather than with CMake. This is now an error according to policy diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt index d0d48d0..af6bb05 100644 --- a/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt @@ -8,7 +8,7 @@ Call Stack \(most recent call first\): CMakeLists.txt:7 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at .*/Modules/Documentation.cmake:27 \(message\): +CMake Warning \(dev\) at .*/Modules/Documentation.cmake:[0-9]+ \(message\): Policy CMP0106 is not set: The Documentation module is removed. Run "cmake --help-policy CMP0106" for policy details. Use the cmake_policy command to set the policy and suppress this warning. @@ -22,7 +22,7 @@ Call Stack \(most recent call first\): CMakeLists.txt:7 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -CMake Warning \(dev\) at .*/Modules/Documentation.cmake:27 \(message\): +CMake Warning \(dev\) at .*/Modules/Documentation.cmake:[0-9]+ \(message\): Policy CMP0106 is not set: The Documentation module is removed. Run "cmake --help-policy CMP0106" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/CMP0115/CMP0115-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW-result.txt diff --git a/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt new file mode 100644 index 0000000..b63c53d --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW-stderr.txt @@ -0,0 +1,17 @@ +^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + main +Call Stack \(most recent call first\): + CMP0115-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-NEW\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake b/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-NEW.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-result.txt diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt new file mode 100644 index 0000000..8b90311 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -0,0 +1,22 @@ +^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + noexist + + Tried extensions [^ +]* + [^ +]* +Call Stack \(most recent call first\): + CMP0115-OLD\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-OLD\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake b/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-result.txt diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt new file mode 100644 index 0000000..7b100b6 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt @@ -0,0 +1,36 @@ +^CMake Warning \(dev\) at CMP0115\.cmake:[0-9]+ \(add_executable\): + Policy CMP0115 is not set: Source file extensions must be explicit\. Run + "cmake --help-policy CMP0115" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + File: + + [^ +]*/Tests/RunCMake/CMP0115/main\.c +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + Cannot find source file: + + noexist + + Tried extensions [^ +]* + [^ +]* +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: exe +Call Stack \(most recent call first\): + CMP0115-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake b/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake new file mode 100644 index 0000000..ddf5071 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115-WARN.cmake @@ -0,0 +1 @@ +include(CMP0115.cmake) diff --git a/Tests/RunCMake/CMP0115/CMP0115.cmake b/Tests/RunCMake/CMP0115/CMP0115.cmake new file mode 100644 index 0000000..be910a4 --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMP0115.cmake @@ -0,0 +1,3 @@ +enable_language(C) + +add_executable(exe main noexist) diff --git a/Tests/RunCMake/CMP0115/CMakeLists.txt b/Tests/RunCMake/CMP0115/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/CMP0115/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0115/RunCMakeTest.cmake b/Tests/RunCMake/CMP0115/RunCMakeTest.cmake new file mode 100644 index 0000000..58182ac --- /dev/null +++ b/Tests/RunCMake/CMP0115/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCMake) + +function(run_cmp0115 status) + if(NOT status STREQUAL "WARN") + set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=${status}) + endif() + run_cmake(CMP0115-${status}) +endfunction() + +run_cmp0115(OLD) +run_cmp0115(WARN) +run_cmp0115(NEW) diff --git a/Tests/Server/buildsystem1/foo.cpp b/Tests/RunCMake/CMP0115/main.c index 7f39d71..8488f4e 100644 --- a/Tests/Server/buildsystem1/foo.cpp +++ b/Tests/RunCMake/CMP0115/main.c @@ -1,5 +1,4 @@ - -int foo() +int main(void) { return 0; } diff --git a/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake new file mode 100644 index 0000000..f92fac6 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-NEW-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake new file mode 100644 index 0000000..f92fac6 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-NEW-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt new file mode 100644 index 0000000..843ff1c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN-stderr.txt @@ -0,0 +1,7 @@ +^(CMake Warning \(dev\) at Subdirectory/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\. +*)+$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-NOWARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt new file mode 100644 index 0000000..e29af91 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN-stderr.txt @@ -0,0 +1,16 @@ +^(CMake Warning \(dev\) at Common\.cmake:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +Call Stack \(most recent call first\): + CMP0116-WARN-WARN\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+(CMake Warning \(dev\) at Subdirectory/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + Policy CMP0116 is not set: Ninja generators transform DEPFILEs from + add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\. +*)+$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake new file mode 100644 index 0000000..665f485 --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-WARN-WARN.cmake @@ -0,0 +1,3 @@ +set(depdir Subdirectory/) + +include(Common.cmake) diff --git a/Tests/RunCMake/CMP0116/CMakeLists.txt b/Tests/RunCMake/CMP0116/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0116/Common.cmake b/Tests/RunCMake/CMP0116/Common.cmake new file mode 100644 index 0000000..472b162 --- /dev/null +++ b/Tests/RunCMake/CMP0116/Common.cmake @@ -0,0 +1,8 @@ +add_custom_command( + OUTPUT top.txt + COMMAND ${CMAKE_COMMAND} -DOUTFILE=top.txt -DINFILE=topdep.txt -DDEPFILE=top.txt.d -DSTAMPFILE=topstamp.txt -DDEPDIR= -P ${CMAKE_SOURCE_DIR}/WriteDepfile.cmake + DEPFILE top.txt.d + ) +add_custom_target(top ALL DEPENDS top.txt) + +add_subdirectory(Subdirectory) diff --git a/Tests/RunCMake/CMP0116/RunCMakeTest.cmake b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake new file mode 100644 index 0000000..8a83cc1 --- /dev/null +++ b/Tests/RunCMake/CMP0116/RunCMakeTest.cmake @@ -0,0 +1,49 @@ +include(RunCMake) + +function(run_cmp0116 status warn) + if(warn) + set(name CMP0116-${status}-WARN) + else() + set(name CMP0116-${status}-NOWARN) + endif() + set(RunCMake_TEST_OPTIONS + -DCMAKE_POLICY_WARNING_CMP0116:BOOL=${warn} + ) + if(NOT status STREQUAL "WARN") + list(APPEND RunCMake_TEST_OPTIONS + -DCMAKE_POLICY_DEFAULT_CMP0116:STRING=${status} + ) + endif() + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + run_cmake(${name}) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake-check-file check.cmake) + + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topdep.txt") + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/Subdirectory/subdep.txt") + set(cmp0116_step 1) + run_cmake_command(${name}-build1 ${CMAKE_COMMAND} --build . --config Debug) + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.25) + + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topdep.txt") + file(TOUCH "${RunCMake_TEST_BINARY_DIR}/Subdirectory/subdep.txt") + set(cmp0116_step 2) + run_cmake_command(${name}-build2 ${CMAKE_COMMAND} --build . --config Debug) + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + file(REMOVE "${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.25) + + set(cmp0116_step 3) + run_cmake_command(${name}-build3 ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_cmp0116(WARN OFF) +run_cmp0116(OLD OFF) +run_cmp0116(NEW OFF) +run_cmp0116(WARN ON) +run_cmp0116(OLD ON) +run_cmp0116(NEW ON) diff --git a/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt b/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt new file mode 100644 index 0000000..f0f60b2 --- /dev/null +++ b/Tests/RunCMake/CMP0116/Subdirectory/CMakeLists.txt @@ -0,0 +1,6 @@ +add_custom_command( + OUTPUT sub.txt + COMMAND ${CMAKE_COMMAND} -DOUTFILE=sub.txt -DINFILE=subdep.txt -DDEPFILE=sub.txt.d -DSTAMPFILE=substamp.txt -DDEPDIR=${depdir} -P ${CMAKE_SOURCE_DIR}/WriteDepfile.cmake + DEPFILE ${depdir}sub.txt.d + ) +add_custom_target(sub ALL DEPENDS sub.txt) diff --git a/Tests/RunCMake/CMP0116/WriteDepfile.cmake b/Tests/RunCMake/CMP0116/WriteDepfile.cmake new file mode 100644 index 0000000..1a74d2a --- /dev/null +++ b/Tests/RunCMake/CMP0116/WriteDepfile.cmake @@ -0,0 +1,3 @@ +file(TOUCH "${OUTFILE}") +file(TOUCH "${STAMPFILE}") +file(WRITE "${DEPFILE}" "${DEPDIR}${OUTFILE}: ${DEPDIR}${INFILE}\n") diff --git a/Tests/RunCMake/CMP0116/check.cmake b/Tests/RunCMake/CMP0116/check.cmake new file mode 100644 index 0000000..1b16748 --- /dev/null +++ b/Tests/RunCMake/CMP0116/check.cmake @@ -0,0 +1,18 @@ +function(check_exists file) + if(NOT EXISTS "${file}") + string(APPEND RunCMake_TEST_FAILED "${file} does not exist\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +function(check_not_exists file) + if(EXISTS "${file}") + string(APPEND RunCMake_TEST_FAILED "${file} exists\n") + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +if(cmp0116_step EQUAL 3) + check_not_exists("${RunCMake_TEST_BINARY_DIR}/topstamp.txt") + check_not_exists("${RunCMake_TEST_BINARY_DIR}/Subdirectory/substamp.txt") +endif() diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Helper.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Helper.cmake new file mode 100644 index 0000000..b237b7f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Helper.cmake @@ -0,0 +1,14 @@ +macro(get_and_print_GENERATED_property filename) + get_property(prop SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${filename}" PROPERTY GENERATED) + message(NOTICE "${filename}: # 1a # GENERATED = `${prop}`") + get_source_file_property(prop "${CMAKE_CURRENT_BINARY_DIR}/${filename}" GENERATED) + message(NOTICE "${filename}: # 1b # GENERATED = `${prop}`") + get_property(prop SOURCE "${filename}" PROPERTY GENERATED) + message(NOTICE "${filename}: # 2a # GENERATED = `${prop}`") + get_source_file_property(prop "${filename}" GENERATED) + message(NOTICE "${filename}: # 2b # GENERATED = `${prop}`") + get_property(prop SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${filename}" PROPERTY GENERATED) + message(NOTICE "${filename}: # 3a # GENERATED = `${prop}`") + get_source_file_property(prop "${CMAKE_CURRENT_SOURCE_DIR}/${filename}" GENERATED) + message(NOTICE "${filename}: # 3b # GENERATED = `${prop}`") +endmacro() diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test1.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test1.cmake new file mode 100644 index 0000000..2b66515 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test1.cmake @@ -0,0 +1,9 @@ +add_custom_target(custom) +target_sources(custom PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt" +) + +get_property(prop SOURCE + "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt" + PROPERTY GENERATED) +message(NOTICE "prop: `${prop}`") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test10.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test10.cmake new file mode 100644 index 0000000..d060207 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test10.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test10) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test11.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test11.cmake new file mode 100644 index 0000000..00b204e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test11.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test11) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test12.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test12.cmake new file mode 100644 index 0000000..1182d17 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test12.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_command(TARGET custom0 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_command(TARGET custom1 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_command(TARGET custom2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_command(TARGET custom3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test12) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test13.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test13.cmake new file mode 100644 index 0000000..12f4ac1 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test13.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_command(TARGET custom0 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_command(TARGET custom1 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_command(TARGET custom2 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_command(TARGET custom3 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test13) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test14.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test14.cmake new file mode 100644 index 0000000..30e3edc --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test14.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_target(custom0_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_target(custom1_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test14) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test15.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test15.cmake new file mode 100644 index 0000000..fb05248 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test15.cmake @@ -0,0 +1,65 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +# The sources of custom0 will not be modified by set_property! +add_custom_target(custom0) +target_sources(custom0 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +# The sources of custom[1-6] will (tried to) be modified by set_property! +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +add_custom_target(custom0_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt" +) +add_custom_target(custom1_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) + +add_subdirectory(subdir-Common-Test15) + +get_and_print_GENERATED_property("Generated_source0.txt") +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test2.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2.cmake new file mode 100644 index 0000000..1180b6b --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2.cmake @@ -0,0 +1,12 @@ +add_custom_target(custom) +target_sources(custom PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt" +) + +set_property(SOURCE + "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt" + PROPERTY GENERATED "1") +get_property(prop SOURCE + "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt" + PROPERTY GENERATED) +message(NOTICE "prop: `${prop}`") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake new file mode 100644 index 0000000..27516b7 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake @@ -0,0 +1,66 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "Generated_with_relative_path1.txt" + "Generated_with_relative_path2.txt" + "Generated_with_relative_path3.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path1.txt") + +set_property(SOURCE "Generated_with_full_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path1.txt") + +set_property(SOURCE "Generated_with_relative_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path2.txt") + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path1.txt") + +set_property(SOURCE "Generated_with_full_source_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path3.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake new file mode 100644 index 0000000..3e03a1f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake @@ -0,0 +1,66 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path1.txt") + +set_property(SOURCE "Generated_with_full_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path1.txt") + +set_property(SOURCE "Generated_with_relative_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path2.txt") + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_relative_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path1.txt") + +set_property(SOURCE "Generated_with_full_source_path2.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt" + PROPERTY GENERATED "1") +get_and_print_GENERATED_property("Generated_with_full_source_path3.txt") + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "Generated_with_relative_path1.txt" + "Generated_with_relative_path2.txt" + "Generated_with_relative_path3.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt" +) diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake new file mode 100644 index 0000000..953e26a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake @@ -0,0 +1,66 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "Generated_with_relative_path1.txt" + "Generated_with_relative_path2.txt" + "Generated_with_relative_path3.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path1.txt") + +set_property(SOURCE "Generated_with_full_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path1.txt") + +set_property(SOURCE "Generated_with_relative_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path2.txt") + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path1.txt") + +set_property(SOURCE "Generated_with_full_source_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path3.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake new file mode 100644 index 0000000..025caa8 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake @@ -0,0 +1,66 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path1.txt") + +set_property(SOURCE "Generated_with_full_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path1.txt") + +set_property(SOURCE "Generated_with_relative_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path2.txt") + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_relative_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path1.txt") + +set_property(SOURCE "Generated_with_full_source_path2.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt" + PROPERTY GENERATED "0") +get_and_print_GENERATED_property("Generated_with_full_source_path3.txt") + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "Generated_with_relative_path1.txt" + "Generated_with_relative_path2.txt" + "Generated_with_relative_path3.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt" +) diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake new file mode 100644 index 0000000..5349bff --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake @@ -0,0 +1,78 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "Generated_with_relative_path1.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "Generated_with_relative_path2.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "Generated_with_relative_path3.txt" +) +add_custom_target(custom7) +target_sources(custom7 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt" +) +add_custom_target(custom8) +target_sources(custom8 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" +) +add_custom_target(custom9) +target_sources(custom9 PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt" + PROPERTY GENERATED "tRue") +get_and_print_GENERATED_property("Generated_with_full_path1.txt") + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt" + PROPERTY GENERATED "SomeVar-NOTFOUND") +get_and_print_GENERATED_property("Generated_with_full_path2.txt") + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt" + PROPERTY GENERATED "Junk-value") +get_and_print_GENERATED_property("Generated_with_full_path3.txt") + + +set_property(SOURCE "Generated_with_relative_path1.txt" + PROPERTY GENERATED "tRue") +get_and_print_GENERATED_property("Generated_with_relative_path1.txt") + +set_property(SOURCE "Generated_with_relative_path2.txt" + PROPERTY GENERATED "SomeVar-NOTFOUND") +get_and_print_GENERATED_property("Generated_with_relative_path2.txt") + +set_property(SOURCE "Generated_with_relative_path3.txt" + PROPERTY GENERATED "Junk-value") +get_and_print_GENERATED_property("Generated_with_relative_path3.txt") + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt" + PROPERTY GENERATED "tRue") +get_and_print_GENERATED_property("Generated_with_full_source_path1.txt") + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt" + PROPERTY GENERATED "SomeVar-NOTFOUND") +get_and_print_GENERATED_property("Generated_with_full_source_path2.txt") + +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt" + PROPERTY GENERATED "Junk-value") +get_and_print_GENERATED_property("Generated_with_full_source_path3.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test6.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test6.cmake new file mode 100644 index 0000000..a6f28aa --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test6.cmake @@ -0,0 +1,44 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + PROPERTY GENERATED "1") + +add_subdirectory(subdir-Common-Test6) + +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test7.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test7.cmake new file mode 100644 index 0000000..eed49b8 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test7.cmake @@ -0,0 +1,44 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + PROPERTY GENERATED "1") + +add_subdirectory(subdir-Common-Test7) + +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake new file mode 100644 index 0000000..5cc6e99 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake @@ -0,0 +1,50 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + CONTENT "int func();\nint main(){ return func(); }" +) + +add_subdirectory(subdir-Common-Test8) + +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake new file mode 100644 index 0000000..b7d36ef --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake @@ -0,0 +1,50 @@ +include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake) + + +add_custom_target(custom1) +target_sources(custom1 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" +) +add_custom_target(custom2) +target_sources(custom2 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" +) +add_custom_target(custom3) +target_sources(custom3 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" +) +add_custom_target(custom4) +target_sources(custom4 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" +) +add_custom_target(custom5) +target_sources(custom5 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" +) +add_custom_target(custom6) +target_sources(custom6 PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" +) + + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt" + CONTENT "int func();\nint main(){ return func(); }" +) + +add_subdirectory(subdir-Common-Test9) + +get_and_print_GENERATED_property("Generated_source1.txt") +get_and_print_GENERATED_property("Generated_source2.txt") +get_and_print_GENERATED_property("Generated_source3.txt") +get_and_print_GENERATED_property("Generated_source4.txt") +get_and_print_GENERATED_property("Generated_source5.txt") +get_and_print_GENERATED_property("Generated_source6.txt") diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt new file mode 100644 index 0000000..ec777f7 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-stderr.txt @@ -0,0 +1,10 @@ +^prop: `0` +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test1-build/GeneratedMain\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test1\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1.cmake new file mode 100644 index 0000000..bbbee43 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test1.cmake) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt new file mode 100644 index 0000000..cee4516 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test10-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test10\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10.cmake new file mode 100644 index 0000000..15a7178 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test10.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test10.cmake) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt new file mode 100644 index 0000000..422a3de --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-stderr.txt @@ -0,0 +1,80 @@ +^(CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +(CMake Warning \(dev\) at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11.cmake new file mode 100644 index 0000000..cb87a86 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test11.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test11.cmake) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12-stderr.txt new file mode 100644 index 0000000..e6c429c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12-stderr.txt @@ -0,0 +1,51 @@ +^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12.cmake new file mode 100644 index 0000000..61bf977 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test12.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test12.cmake) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13-stderr.txt new file mode 100644 index 0000000..7802538 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13-stderr.txt @@ -0,0 +1,64 @@ +^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +(CMake Warning \(dev\) at CMP0118-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test13\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13.cmake new file mode 100644 index 0000000..569e4c6 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test13.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test13.cmake) diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt new file mode 100644 index 0000000..2f42f36 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test14-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test14\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14.cmake new file mode 100644 index 0000000..e7d8d77 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test14.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test14.cmake) diff --git a/Tests/RunCMake/CommandLine/E_server-arg-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E_server-arg-result.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-result.txt diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt new file mode 100644 index 0000000..65bd577 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-stderr.txt @@ -0,0 +1,80 @@ +^(CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +(CMake Warning \(dev\) at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15.cmake new file mode 100644 index 0000000..93513ae --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test15.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test15.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2-stderr.txt new file mode 100644 index 0000000..403ce5a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2-stderr.txt @@ -0,0 +1 @@ +^prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2.cmake new file mode 100644 index 0000000..ee8233d --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test2.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt new file mode 100644 index 0000000..f7d9f6b --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3.cmake new file mode 100644 index 0000000..b9533fd --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test3.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt new file mode 100644 index 0000000..a876390 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b.cmake new file mode 100644 index 0000000..79631e7 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test3b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt new file mode 100644 index 0000000..b750ae7 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4-stderr.txt @@ -0,0 +1,167 @@ +^CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4.cmake new file mode 100644 index 0000000..8a7d35a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test4.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt new file mode 100644 index 0000000..580f04f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b-stderr.txt @@ -0,0 +1,167 @@ +^CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b.cmake new file mode 100644 index 0000000..c03a39d --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test4b.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test4b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt new file mode 100644 index 0000000..e268a7a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt @@ -0,0 +1,174 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is set to NEW and the following non-boolean value given for + property 'GENERATED' is therefore not allowed: + + Junk-value + + Replace it with a boolean value! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is set to NEW and the following non-boolean value given for + property 'GENERATED' is therefore not allowed: + + Junk-value + + Replace it with a boolean value! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is set to NEW and the following non-boolean value given for + property 'GENERATED' is therefore not allowed: + + Junk-value + + Replace it with a boolean value! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5.cmake new file mode 100644 index 0000000..691f94a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test5.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt new file mode 100644 index 0000000..17e2b4a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test6-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test6\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6.cmake new file mode 100644 index 0000000..09b87a5 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test6.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test6.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt new file mode 100644 index 0000000..08eb682 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-stderr.txt @@ -0,0 +1,74 @@ +^(CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +(CMake Warning \(dev\) at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test7-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7.cmake new file mode 100644 index 0000000..ceb8beb --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test7.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test7.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt new file mode 100644 index 0000000..7f48bf0 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test8-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test8\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8.cmake new file mode 100644 index 0000000..6878b94 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test8.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt new file mode 100644 index 0000000..b7c496c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-stderr.txt @@ -0,0 +1,74 @@ +^(CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +(CMake Warning \(dev\) at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\): + Unsetting the 'GENERATED' property is not allowed under CMP0118! + +Call Stack \(most recent call first\): + CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `0` +Generated_source2\.txt: # 1b # GENERATED = `0` +Generated_source2\.txt: # 2a # GENERATED = `0` +Generated_source2\.txt: # 2b # GENERATED = `0` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `0` +Generated_source3\.txt: # 1b # GENERATED = `0` +Generated_source3\.txt: # 2a # GENERATED = `0` +Generated_source3\.txt: # 2b # GENERATED = `0` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-NEW-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9.cmake new file mode 100644 index 0000000..00b05fd --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 NEW) +include(CMP0118-Common-Test9.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt new file mode 100644 index 0000000..58144c8 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt @@ -0,0 +1,10 @@ +^prop: `0` +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-build/GeneratedMain\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test1\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1.cmake new file mode 100644 index 0000000..c18dd25 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test1.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt new file mode 100644 index 0000000..1f1bc90 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test10\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10.cmake new file mode 100644 index 0000000..b96973f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test10.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt new file mode 100644 index 0000000..5c15f12 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt @@ -0,0 +1,67 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11.cmake new file mode 100644 index 0000000..d6ad7d2 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test11.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt new file mode 100644 index 0000000..e6c429c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt @@ -0,0 +1,51 @@ +^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12.cmake new file mode 100644 index 0000000..b87b03a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test12.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt new file mode 100644 index 0000000..75dbf23 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt @@ -0,0 +1,51 @@ +^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13.cmake new file mode 100644 index 0000000..17a135b --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test13.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt new file mode 100644 index 0000000..12a913a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test14\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14.cmake new file mode 100644 index 0000000..0702291 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test14.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt new file mode 100644 index 0000000..62db7ee --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt @@ -0,0 +1,67 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15.cmake new file mode 100644 index 0000000..c330d4e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test15.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt new file mode 100644 index 0000000..403ce5a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt @@ -0,0 +1 @@ +^prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2.cmake new file mode 100644 index 0000000..3ea8800 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test2.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt new file mode 100644 index 0000000..7f86d38 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3.cmake new file mode 100644 index 0000000..c8f5a0e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test3.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt new file mode 100644 index 0000000..4104fc0 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b.cmake new file mode 100644 index 0000000..0b046b4 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test3b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt new file mode 100644 index 0000000..7a16d0b --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt @@ -0,0 +1,95 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4.cmake new file mode 100644 index 0000000..2f77397 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test4.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt new file mode 100644 index 0000000..5a5c4ec --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt @@ -0,0 +1,95 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-OLD-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b.cmake new file mode 100644 index 0000000..ce6726d --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test4b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt new file mode 100644 index 0000000..12fa617 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt @@ -0,0 +1,111 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5.cmake new file mode 100644 index 0000000..2de6d89 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test5.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt new file mode 100644 index 0000000..7199f04 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test6\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6.cmake new file mode 100644 index 0000000..b571052 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test6.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt new file mode 100644 index 0000000..233fd8b --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt @@ -0,0 +1,77 @@ +^Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `0` +Generated_source2\.txt: # 1b # GENERATED = `0` +Generated_source2\.txt: # 2a # GENERATED = `0` +Generated_source2\.txt: # 2b # GENERATED = `0` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `0` +Generated_source3\.txt: # 1b # GENERATED = `0` +Generated_source3\.txt: # 2a # GENERATED = `0` +Generated_source3\.txt: # 2b # GENERATED = `0` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7.cmake new file mode 100644 index 0000000..551da23 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test7.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt new file mode 100644 index 0000000..4aed2ed --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test8\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8.cmake new file mode 100644 index 0000000..2d9e3d3 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test8.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt new file mode 100644 index 0000000..cea8c22 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt @@ -0,0 +1,61 @@ +^Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `0` +Generated_source2\.txt: # 1b # GENERATED = `0` +Generated_source2\.txt: # 2a # GENERATED = `0` +Generated_source2\.txt: # 2b # GENERATED = `0` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `0` +Generated_source3\.txt: # 1b # GENERATED = `0` +Generated_source3\.txt: # 2a # GENERATED = `0` +Generated_source3\.txt: # 2b # GENERATED = `0` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-OLD-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9.cmake new file mode 100644 index 0000000..53f73d9 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0118 OLD) +include(CMP0118-Common-Test9.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt new file mode 100644 index 0000000..e2a2cf5 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-stderr.txt @@ -0,0 +1,10 @@ +^prop: `0` +CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test1-build/GeneratedMain\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test1\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1.cmake new file mode 100644 index 0000000..3c82f8e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test1.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt new file mode 100644 index 0000000..bce7681 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test10\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test10-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test10\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10.cmake new file mode 100644 index 0000000..c639c40 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test10.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test10.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt new file mode 100644 index 0000000..00c47e9 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt @@ -0,0 +1,90 @@ +^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+ +(CMake Warning \(dev\) at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test11\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11.cmake new file mode 100644 index 0000000..4c9735d --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test11.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-stderr.txt new file mode 100644 index 0000000..e6c429c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12-stderr.txt @@ -0,0 +1,51 @@ +^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12.cmake new file mode 100644 index 0000000..79fa00a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test12.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test12.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt new file mode 100644 index 0000000..6d59cb4 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt @@ -0,0 +1,74 @@ +^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): + TARGET 'custom[4-6]' was not created in this directory\. ++ +((CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+ +(CMake Warning \(dev\) at CMP0118-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test13\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13.cmake new file mode 100644 index 0000000..27f71c7 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test13.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt new file mode 100644 index 0000000..5b7994c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-stderr.txt @@ -0,0 +1,51 @@ +^Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test14\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test14-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test14\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14.cmake new file mode 100644 index 0000000..056f0ad --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test14.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test14.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt new file mode 100644 index 0000000..c975c23 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt @@ -0,0 +1,90 @@ +^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+ +(CMake Warning \(dev\) at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source0\.txt: # 1a # GENERATED = `1` +Generated_source0\.txt: # 1b # GENERATED = `1` +Generated_source0\.txt: # 2a # GENERATED = `1` +Generated_source0\.txt: # 2b # GENERATED = `1` +Generated_source0\.txt: # 3a # GENERATED = `0` +Generated_source0\.txt: # 3b # GENERATED = `0` +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test15\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15.cmake new file mode 100644 index 0000000..acc8bf6 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test15.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2-stderr.txt new file mode 100644 index 0000000..403ce5a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2-stderr.txt @@ -0,0 +1 @@ +^prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2.cmake new file mode 100644 index 0000000..5a67974 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test2.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt new file mode 100644 index 0000000..142d8a0 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3.cmake new file mode 100644 index 0000000..7cdfacb --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test3.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt new file mode 100644 index 0000000..d4ef667 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt @@ -0,0 +1,87 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `1` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b.cmake new file mode 100644 index 0000000..6dfc16a --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test3b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt new file mode 100644 index 0000000..ceeb570 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt @@ -0,0 +1,212 @@ +^CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4.cmake new file mode 100644 index 0000000..9d432a4 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test4.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt new file mode 100644 index 0000000..f8484d0 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt @@ -0,0 +1,212 @@ +^CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path1\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test4b\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN-Test4b-build/Generated_with_relative_path1\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test4b\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b.cmake new file mode 100644 index 0000000..2e2c2bd --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test4b.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt new file mode 100644 index 0000000..0556391 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt @@ -0,0 +1,213 @@ +^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Attempt to set property 'GENERATED' with the following non-boolean value + \(which will be interpreted as "0"\): + + Junk-value + + That exact value will not be retrievable\. A value of "0" will be returned + instead\. + + This will be an error under policy CMP0118\. + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_path3\.txt: # 3b # GENERATED = `0` +Generated_with_relative_path1\.txt: # 1a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 1b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2a # GENERATED = `1` +Generated_with_relative_path1\.txt: # 2b # GENERATED = `1` +Generated_with_relative_path1\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path2\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Attempt to set property 'GENERATED' with the following non-boolean value + \(which will be interpreted as "0"\): + + Junk-value + + That exact value will not be retrievable\. A value of "0" will be returned + instead\. + + This will be an error under policy CMP0118\. + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_relative_path3\.txt: # 1a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 1b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 2b # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3a # GENERATED = `0` +Generated_with_relative_path3\.txt: # 3b # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1` +Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0` +CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Attempt to set property 'GENERATED' with the following non-boolean value + \(which will be interpreted as "0"\): + + Junk-value + + That exact value will not be retrievable\. A value of "0" will be returned + instead\. + + This will be an error under policy CMP0118\. + +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0` +Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt) +Call Stack \(most recent call first\): + CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5.cmake new file mode 100644 index 0000000..87e965e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test5.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt new file mode 100644 index 0000000..7d588a2 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test6\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test6-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test6\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6.cmake new file mode 100644 index 0000000..6f1edbc --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test6.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test6.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt new file mode 100644 index 0000000..8421061 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt @@ -0,0 +1,100 @@ +^((CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+ +(CMake Warning \(dev\) at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source1\.txt: # 1a # GENERATED = `1` +Generated_source1\.txt: # 1b # GENERATED = `1` +Generated_source1\.txt: # 2a # GENERATED = `1` +Generated_source1\.txt: # 2b # GENERATED = `1` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `0` +Generated_source2\.txt: # 1b # GENERATED = `0` +Generated_source2\.txt: # 2a # GENERATED = `0` +Generated_source2\.txt: # 2b # GENERATED = `0` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `0` +Generated_source3\.txt: # 1b # GENERATED = `0` +Generated_source3\.txt: # 2a # GENERATED = `0` +Generated_source3\.txt: # 2b # GENERATED = `0` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-build/Generated_source[2-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test7\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7.cmake new file mode 100644 index 0000000..86af20d --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test7.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt new file mode 100644 index 0000000..e0f17e6 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-stderr.txt @@ -0,0 +1,45 @@ +^Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `1` +Generated_source2\.txt: # 1b # GENERATED = `1` +Generated_source2\.txt: # 2a # GENERATED = `1` +Generated_source2\.txt: # 2b # GENERATED = `1` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `1` +Generated_source3\.txt: # 1b # GENERATED = `1` +Generated_source3\.txt: # 2a # GENERATED = `1` +Generated_source3\.txt: # 2b # GENERATED = `1` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `1` +Generated_source5\.txt: # 1b # GENERATED = `1` +Generated_source5\.txt: # 2a # GENERATED = `1` +Generated_source5\.txt: # 2b # GENERATED = `1` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `1` +Generated_source6\.txt: # 1b # GENERATED = `1` +Generated_source6\.txt: # 2a # GENERATED = `1` +Generated_source6\.txt: # 2b # GENERATED = `1` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test8\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test8-build/Generated_source4\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test8\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8.cmake new file mode 100644 index 0000000..6a0bb4c --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test8.cmake) diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt new file mode 100644 index 0000000..80f3edf --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt @@ -0,0 +1,84 @@ +^((CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+ +(CMake Warning \(dev\) at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\): + Policy CMP0118 is not set: The GENERATED source file property is now + visible in all directories\. Run "cmake --help-policy CMP0118" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + Unsetting property 'GENERATED' will not be allowed under policy CMP0118! + +Call Stack \(most recent call first\): + CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. ++)+)+ +Generated_source1\.txt: # 1a # GENERATED = `0` +Generated_source1\.txt: # 1b # GENERATED = `0` +Generated_source1\.txt: # 2a # GENERATED = `0` +Generated_source1\.txt: # 2b # GENERATED = `0` +Generated_source1\.txt: # 3a # GENERATED = `0` +Generated_source1\.txt: # 3b # GENERATED = `0` +Generated_source2\.txt: # 1a # GENERATED = `0` +Generated_source2\.txt: # 1b # GENERATED = `0` +Generated_source2\.txt: # 2a # GENERATED = `0` +Generated_source2\.txt: # 2b # GENERATED = `0` +Generated_source2\.txt: # 3a # GENERATED = `0` +Generated_source2\.txt: # 3b # GENERATED = `0` +Generated_source3\.txt: # 1a # GENERATED = `0` +Generated_source3\.txt: # 1b # GENERATED = `0` +Generated_source3\.txt: # 2a # GENERATED = `0` +Generated_source3\.txt: # 2b # GENERATED = `0` +Generated_source3\.txt: # 3a # GENERATED = `0` +Generated_source3\.txt: # 3b # GENERATED = `0` +Generated_source4\.txt: # 1a # GENERATED = `0` +Generated_source4\.txt: # 1b # GENERATED = `0` +Generated_source4\.txt: # 2a # GENERATED = `0` +Generated_source4\.txt: # 2b # GENERATED = `0` +Generated_source4\.txt: # 3a # GENERATED = `0` +Generated_source4\.txt: # 3b # GENERATED = `0` +Generated_source5\.txt: # 1a # GENERATED = `0` +Generated_source5\.txt: # 1b # GENERATED = `0` +Generated_source5\.txt: # 2a # GENERATED = `0` +Generated_source5\.txt: # 2b # GENERATED = `0` +Generated_source5\.txt: # 3a # GENERATED = `0` +Generated_source5\.txt: # 3b # GENERATED = `0` +Generated_source6\.txt: # 1a # GENERATED = `0` +Generated_source6\.txt: # 1b # GENERATED = `0` +Generated_source6\.txt: # 2a # GENERATED = `0` +Generated_source6\.txt: # 2b # GENERATED = `0` +Generated_source6\.txt: # 3a # GENERATED = `0` +Generated_source6\.txt: # 3b # GENERATED = `0` +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_custom_target\): + Cannot find source file: + +[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-build/Generated_source[4-6]\.txt +Call Stack \(most recent call first\): + CMP0118-WARN-Test9\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9.cmake new file mode 100644 index 0000000..c48c64e --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9.cmake @@ -0,0 +1 @@ +include(CMP0118-Common-Test9.cmake) diff --git a/Tests/RunCMake/CMP0118/CMakeLists.txt b/Tests/RunCMake/CMP0118/CMakeLists.txt new file mode 100644 index 0000000..0d30651 --- /dev/null +++ b/Tests/RunCMake/CMP0118/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.19) +cmake_policy(SET CMP0115 NEW) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0118/RunCMakeTest.cmake b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake new file mode 100644 index 0000000..72064bd --- /dev/null +++ b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake @@ -0,0 +1,55 @@ +include(RunCMake) + +run_cmake(CMP0118-OLD-Test1) +run_cmake(CMP0118-OLD-Test2) +run_cmake(CMP0118-OLD-Test3) +run_cmake(CMP0118-OLD-Test3b) +run_cmake(CMP0118-OLD-Test4) +run_cmake(CMP0118-OLD-Test4b) +run_cmake(CMP0118-OLD-Test5) +run_cmake(CMP0118-OLD-Test6) +run_cmake(CMP0118-OLD-Test7) +run_cmake(CMP0118-OLD-Test8) +run_cmake(CMP0118-OLD-Test9) +run_cmake(CMP0118-OLD-Test10) +run_cmake(CMP0118-OLD-Test11) +run_cmake(CMP0118-OLD-Test12) +run_cmake(CMP0118-OLD-Test13) +run_cmake(CMP0118-OLD-Test14) +run_cmake(CMP0118-OLD-Test15) + +run_cmake(CMP0118-WARN-Test1) +run_cmake(CMP0118-WARN-Test2) +run_cmake(CMP0118-WARN-Test3) +run_cmake(CMP0118-WARN-Test3b) +run_cmake(CMP0118-WARN-Test4) +run_cmake(CMP0118-WARN-Test4b) +run_cmake(CMP0118-WARN-Test5) +run_cmake(CMP0118-WARN-Test6) +run_cmake(CMP0118-WARN-Test7) +run_cmake(CMP0118-WARN-Test8) +run_cmake(CMP0118-WARN-Test9) +run_cmake(CMP0118-WARN-Test10) +run_cmake(CMP0118-WARN-Test11) +run_cmake(CMP0118-WARN-Test12) +run_cmake(CMP0118-WARN-Test13) +run_cmake(CMP0118-WARN-Test14) +run_cmake(CMP0118-WARN-Test15) + +run_cmake(CMP0118-NEW-Test1) +run_cmake(CMP0118-NEW-Test2) +run_cmake(CMP0118-NEW-Test3) +run_cmake(CMP0118-NEW-Test3b) +run_cmake(CMP0118-NEW-Test4) +run_cmake(CMP0118-NEW-Test4b) +run_cmake(CMP0118-NEW-Test5) +run_cmake(CMP0118-NEW-Test6) +run_cmake(CMP0118-NEW-Test7) +run_cmake(CMP0118-NEW-Test8) +run_cmake(CMP0118-NEW-Test9) +run_cmake(CMP0118-NEW-Test10) +run_cmake(CMP0118-NEW-Test11) +run_cmake(CMP0118-NEW-Test12) +run_cmake(CMP0118-NEW-Test13) +run_cmake(CMP0118-NEW-Test14) +run_cmake(CMP0118-NEW-Test15) diff --git a/Tests/RunCMake/CMP0118/source.cpp.in b/Tests/RunCMake/CMP0118/source.cpp.in new file mode 100644 index 0000000..678cd7a --- /dev/null +++ b/Tests/RunCMake/CMP0118/source.cpp.in @@ -0,0 +1,5 @@ +int func(); +int main() +{ + return func(); +} diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test10/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test10/CMakeLists.txt new file mode 100644 index 0000000..6bc99cb --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test10/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test11/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test11/CMakeLists.txt new file mode 100644 index 0000000..fbd7e6f --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test11/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test12/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test12/CMakeLists.txt new file mode 100644 index 0000000..916725c --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test12/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_command(TARGET custom4 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_command(TARGET custom5 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_command(TARGET custom6 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt new file mode 100644 index 0000000..f2929aa --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_command(TARGET custom4 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_command(TARGET custom5 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_command(TARGET custom6 PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test14/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test14/CMakeLists.txt new file mode 100644 index 0000000..7397db9 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test14/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_target(custom4_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_target(custom5_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_target(custom6_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test15/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test15/CMakeLists.txt new file mode 100644 index 0000000..314e427 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test15/CMakeLists.txt @@ -0,0 +1,33 @@ +add_custom_target(custom4_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" +) +add_custom_target(custom5_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" +) +add_custom_target(custom6_source_generator ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test6/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test6/CMakeLists.txt new file mode 100644 index 0000000..fa307d1 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test6/CMakeLists.txt @@ -0,0 +1,16 @@ +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test7/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test7/CMakeLists.txt new file mode 100644 index 0000000..6362f78 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test7/CMakeLists.txt @@ -0,0 +1,16 @@ +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt new file mode 100644 index 0000000..55debd1 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt @@ -0,0 +1,30 @@ +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" + CONTENT "int func();\nint main(){ return func(); }" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "1") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "1") diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt new file mode 100644 index 0000000..cdb8884 --- /dev/null +++ b/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt @@ -0,0 +1,30 @@ +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt" + CONTENT "int func();\nint main(){ return func(); }" +) +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt" + CONTENT "int func();\nint main(){ return func(); }" +) + + +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt" + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + PROPERTY GENERATED "0") +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt" + TARGET_DIRECTORY custom1 + PROPERTY GENERATED "0") diff --git a/Tests/RunCMake/CMP0119/AltExtC.zzz b/Tests/RunCMake/CMP0119/AltExtC.zzz new file mode 100644 index 0000000..5b240eb --- /dev/null +++ b/Tests/RunCMake/CMP0119/AltExtC.zzz @@ -0,0 +1,4 @@ +int main(void) { + int class = 0; + return class; +} diff --git a/Tests/RunCMake/CMP0119/AltExtCXX.zzz b/Tests/RunCMake/CMP0119/AltExtCXX.zzz new file mode 100644 index 0000000..3c521ed --- /dev/null +++ b/Tests/RunCMake/CMP0119/AltExtCXX.zzz @@ -0,0 +1,3 @@ +int main() { + return static_cast<int>(0); +} diff --git a/Tests/RunCMake/CMP0119/CMP0119-Common.cmake b/Tests/RunCMake/CMP0119/CMP0119-Common.cmake new file mode 100644 index 0000000..f45895b --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-Common.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_executable(AltExtC AltExtC.zzz) +set_property(SOURCE AltExtC.zzz PROPERTY LANGUAGE C) diff --git a/Tests/RunCMake/CMP0119/CMP0119-NEW.cmake b/Tests/RunCMake/CMP0119/CMP0119-NEW.cmake new file mode 100644 index 0000000..df0ed48 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-NEW.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0119 NEW) +include(CMP0119-Common.cmake) + +enable_language(CXX) +add_executable(AltExtCXX AltExtCXX.zzz) +set_property(SOURCE AltExtCXX.zzz PROPERTY LANGUAGE CXX) diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD-build-result.txt b/Tests/RunCMake/CMP0119/CMP0119-OLD-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD-build-stderr.txt b/Tests/RunCMake/CMP0119/CMP0119-OLD-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD.cmake b/Tests/RunCMake/CMP0119/CMP0119-OLD.cmake new file mode 100644 index 0000000..9eaa200 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0119 OLD) +include(CMP0119-Common.cmake) diff --git a/Tests/RunCMake/CMP0119/CMP0119-WARN-build-result.txt b/Tests/RunCMake/CMP0119/CMP0119-WARN-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-WARN-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CMP0119/CMP0119-WARN-build-stderr.txt b/Tests/RunCMake/CMP0119/CMP0119-WARN-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-WARN-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CMP0119/CMP0119-WARN.cmake b/Tests/RunCMake/CMP0119/CMP0119-WARN.cmake new file mode 100644 index 0000000..00281e9 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0119-Common.cmake) diff --git a/Tests/RunCMake/CMP0119/CMakeLists.txt b/Tests/RunCMake/CMP0119/CMakeLists.txt new file mode 100644 index 0000000..ab1a20c --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake new file mode 100644 index 0000000..e547ef5 --- /dev/null +++ b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_CMP0119 status) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0119-${status}-build) + run_cmake(CMP0119-${status}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(CMP0119-${status}-build "${CMAKE_COMMAND}" --build . --config Debug) +endfunction() + +if(NOT RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND + NOT CMAKE_C_COMPILER_ID MATCHES "(Borland|Embarcadero|Watcom)") + run_CMP0119(WARN) + run_CMP0119(OLD) +endif() +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) + run_CMP0119(NEW) +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 615bf20..7f79982 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -125,6 +125,12 @@ if(CMake_TEST_CUDA) endif() add_RunCMake_test(CMP0106) add_RunCMake_test(CMP0111) +add_RunCMake_test(CMP0115) +if(CMAKE_GENERATOR MATCHES "Ninja") + add_RunCMake_test(CMP0116) +endif() +add_RunCMake_test(CMP0118) +add_RunCMake_test(CMP0119 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -175,6 +181,10 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) ) endif() +add_RunCMake_test(ABI -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) +set_property(TEST RunCMake.ABI APPEND + PROPERTY LABELS "CUDA") + add_RunCMake_test(AndroidTestUtilities) set(autogen_with_qt5 FALSE) if(CMake_TEST_Qt5) @@ -195,7 +205,10 @@ if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS set(CMake_TEST_BuildDepends_GNU_AS "${_gnu_as}") endif() endif() + add_RunCMake_test(BuildDepends + -DMSVC_VERSION=${MSVC_VERSION} + -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMake_TEST_BuildDepends_GNU_AS=${CMake_TEST_BuildDepends_GNU_AS} ) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") @@ -254,6 +267,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|XL|XLClang)$") endif() if(MSVC) add_RunCMake_test(MSVCRuntimeLibrary) + add_RunCMake_test(MSVCRuntimeTypeInfo) add_RunCMake_test(MSVCWarningFlags) endif() add_RunCMake_test(ObjectLibrary) @@ -308,7 +322,7 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) -# add_RunCMake_test(cmake_path) +add_RunCMake_test(cmake_path) add_RunCMake_test(continue) add_executable(color_warning color_warning.c) add_executable(fake_build_command fake_build_command.c) @@ -504,6 +518,7 @@ endif() if(XCODE_VERSION) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) + add_RunCMake_test(XcodeProject-Embed) # This test can take a very long time due to lots of combinations. # Use a long default timeout and provide an option to customize it. @@ -564,7 +579,8 @@ if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" endif() -add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) +add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) +add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -773,6 +789,7 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} add_RunCMake_test("UnityBuild") add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}) +add_RunCMake_test(TransformDepfile) if(WIN32) add_RunCMake_test(Win32GenEx) diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt index aef30d2..a53682d 100644 --- a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt +++ b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt @@ -1 +1,2 @@ -^CMake Error: No preset specified for --preset$ +^CMake Error: No preset specified for --preset +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index cf2e8ac..cf4aa51 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(whitespaces_ "[\t\n\r ]*") -set(EXPECTED_FILES_COUNT "5") +set(EXPECTED_FILES_COUNT "6") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(GENERATOR_TYPE STREQUAL "RPM") @@ -39,3 +39,6 @@ elseif(GENERATOR_TYPE STREQUAL "DEB") set(EXPECTED_FILE_5 "TestDinfo-pkg-libs-dbgsym.ddeb") set(EXPECTED_FILE_CONTENT_5 ".*/usr/lib/debug/.build-id/.*\.debug.*") endif() + +set(EXPECTED_FILE_6 "TestDinfo-pkg*-appheaders.${PKG}") +set(EXPECTED_FILE_CONTENT_6_LIST "/include;/include/test_lib.hpp") diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index 161a36a..d270005 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -23,6 +23,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") target_link_libraries(test_prog test_lib) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" DESTINATION include COMPONENT appheaders) install(TARGETS test_prog DESTINATION foo COMPONENT applications) install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) install(TARGETS test_lib DESTINATION bas COMPONENT libs) @@ -40,6 +41,10 @@ set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) set(CPACK_DEBIAN_PACKAGE_NAME "Debuginfo") set(CPACK_DEBIAN_LIBS_DEBUGINFO_PACKAGE ON) +# Test that a component with debug info requested but without any debug info produces none +set(CPACK_RPM_APPHEADERS_DEBUGINFO_PACKAGE ON) +set(CPACK_DEBIAN_APPHEADERS_DEBUGINFO_PACKAGE ON) + # test debuginfo package rename set(CPACK_RPM_DEBUGINFO_FILE_NAME "@cpack_component@-DebugInfoPackage.rpm") diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index ffc8f78..b81f319 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(BeforeProject) unset(RunCMake_TEST_OPTIONS) run_cmake(NotOn) +run_cmake(Site) function(run_CMakeCTestArguments) run_cmake_with_options(CMakeCTestArguments "-DCMAKE_CTEST_ARGUMENTS=--quiet\\;--output-log\\;output-log.txt") diff --git a/Tests/RunCMake/CTest/Site.cmake b/Tests/RunCMake/CTest/Site.cmake new file mode 100644 index 0000000..2c96f23 --- /dev/null +++ b/Tests/RunCMake/CTest/Site.cmake @@ -0,0 +1,5 @@ +include(CTest) +get_property(site CACHE SITE PROPERTY VALUE) +if(NOT "${site}" STREQUAL "${SITE}") + message(FATAL_ERROR "SITE is not a cache entry") +endif() diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt index 97e2a10..b27da43 100644 --- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\): subdirs called with incorrect number of arguments + -Errors while running CTest$ +Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt index 7593783..a993ac6 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -1 +1,3 @@ -^Errors while running CTest$ +^Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt index 960fe94..97833f5 100644 --- a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt +++ b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt @@ -47,4 +47,15 @@ CMake Warning \(dev\) at [^ Call Stack \(most recent call first\): CMP0075.cmake:41 \(check_include_files\) CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Deprecation Warning at CMP0075.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0075 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ClangTidy/OBJC-Build-stdout.txt b/Tests/RunCMake/ClangTidy/OBJC-Build-stdout.txt new file mode 100644 index 0000000..571ec02 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJC-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.m:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/OBJC-launch-Build-stdout.txt b/Tests/RunCMake/ClangTidy/OBJC-launch-Build-stdout.txt new file mode 100644 index 0000000..571ec02 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJC-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.m:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/OBJC-launch.cmake b/Tests/RunCMake/ClangTidy/OBJC-launch.cmake new file mode 100644 index 0000000..43e8521 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJC-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(OBJC.cmake) diff --git a/Tests/RunCMake/ClangTidy/OBJC.cmake b/Tests/RunCMake/ClangTidy/OBJC.cmake new file mode 100644 index 0000000..43eae30 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJC.cmake @@ -0,0 +1,3 @@ +enable_language(OBJC) +set(CMAKE_OBJC_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +add_executable(main main.m) diff --git a/Tests/RunCMake/ClangTidy/OBJCXX-Build-stdout.txt b/Tests/RunCMake/ClangTidy/OBJCXX-Build-stdout.txt new file mode 100644 index 0000000..cbc7629 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJCXX-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.mm:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/OBJCXX-launch-Build-stdout.txt b/Tests/RunCMake/ClangTidy/OBJCXX-launch-Build-stdout.txt new file mode 100644 index 0000000..cbc7629 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJCXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.mm:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/OBJCXX-launch.cmake b/Tests/RunCMake/ClangTidy/OBJCXX-launch.cmake new file mode 100644 index 0000000..5a54bff --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJCXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(OBJCXX.cmake) diff --git a/Tests/RunCMake/ClangTidy/OBJCXX.cmake b/Tests/RunCMake/ClangTidy/OBJCXX.cmake new file mode 100644 index 0000000..ccc5c2c --- /dev/null +++ b/Tests/RunCMake/ClangTidy/OBJCXX.cmake @@ -0,0 +1,3 @@ +enable_language(OBJCXX) +set(CMAKE_OBJCXX_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +add_executable(main main.mm) diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake index 2f41e50..ee41d94 100644 --- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake +++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake @@ -16,8 +16,16 @@ endfunction() run_tidy(C) run_tidy(CXX) +if (APPLE) + run_tidy(OBJC) + run_tidy(OBJCXX) +endif() if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_tidy(C-launch) run_tidy(CXX-launch) + if (APPLE) + run_tidy(OBJC-launch) + run_tidy(OBJCXX-launch) + endif() endif() run_tidy(C-bad) diff --git a/Tests/Server/buildsystem1/subdir/empty.cpp b/Tests/RunCMake/ClangTidy/main.m index 7f39d71..8488f4e 100644 --- a/Tests/Server/buildsystem1/subdir/empty.cpp +++ b/Tests/RunCMake/ClangTidy/main.m @@ -1,5 +1,4 @@ - -int foo() +int main(void) { return 0; } diff --git a/Tests/Server/buildsystem1/main.cpp b/Tests/RunCMake/ClangTidy/main.mm index 766b775..f8b643a 100644 --- a/Tests/Server/buildsystem1/main.cpp +++ b/Tests/RunCMake/ClangTidy/main.mm @@ -1,4 +1,3 @@ - int main() { return 0; diff --git a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt index 0570d8f..5992dcd 100644 --- a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt @@ -1,2 +1,2 @@ ^CMake Error: -C must be followed by a file name. -CMake Error: Problem processing arguments. Aborting.$ +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt index 5e43bca..8503767 100644 --- a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt @@ -1,2 +1,2 @@ ^CMake Error: -D must be followed with VAR=VALUE. -CMake Error: Problem processing arguments. Aborting.$ +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index e24e131..a8b6584 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt deleted file mode 100644 index 4dcbab9..0000000 --- a/Tests/RunCMake/CommandLine/E_server-arg-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: Unknown argument for server mode$ diff --git a/Tests/RunCMake/CommandLine/E_server-pipe-result.txt b/Tests/RunCMake/CommandLine/E_server-pipe-result.txt deleted file mode 100644 index 0cfbf08..0000000 --- a/Tests/RunCMake/CommandLine/E_server-pipe-result.txt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt b/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt deleted file mode 100644 index 7193ba6..0000000 --- a/Tests/RunCMake/CommandLine/E_server-pipe-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: No pipe given after --pipe=$ diff --git a/Tests/RunCMake/CommandLine/E_server-result.txt b/Tests/RunCMake/CommandLine/E_server-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_server-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_server-stderr.txt b/Tests/RunCMake/CommandLine/E_server-stderr.txt new file mode 100644 index 0000000..0cd0e56 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_server-stderr.txt @@ -0,0 +1 @@ +^CMake Error: CMake server mode has been removed in favor of the file-api\.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-result.txt b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt new file mode 100644 index 0000000..6b825bb --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument -invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-result.txt b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt new file mode 100644 index 0000000..eb1488c --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument --invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index b23c8c2..51754fc 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.1) include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(InvalidArg1 ${CMAKE_COMMAND} -invalid) +run_cmake_command(InvalidArg2 ${CMAKE_COMMAND} --invalid) run_cmake_command(Wizard ${CMAKE_COMMAND} -i) run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C) run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt) @@ -25,8 +27,7 @@ run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E com run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) -run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) -run_cmake_command(E_server-pipe ${CMAKE_COMMAND} -E server --pipe=) +run_cmake_command(E_server ${CMAKE_COMMAND} -E server) run_cmake_command(E_true ${CMAKE_COMMAND} -E true) run_cmake_command(E_true-extraargs ${CMAKE_COMMAND} -E true ignored) run_cmake_command(E_false ${CMAKE_COMMAND} -E false) @@ -202,8 +203,8 @@ function(run_BuildDir) run_cmake_command(BuildDir--build--parallel-large ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --parallel 4294967293) - # No default jobs for Xcode and FreeBSD build command - if(NOT RunCMake_GENERATOR MATCHES "Xcode" AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + # No default jobs for FreeBSD build command + if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") run_cmake_command(BuildDir--build-jobs-no-number ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build -j) run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir .. @@ -672,6 +673,10 @@ set(RunCMake_TEST_OPTIONS -Wno-error=deprecated) run_cmake(Wno-error_deprecated) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Werror=deprecated -Wno-error=deprecated) +run_cmake(Wno-error_deprecated) +unset(RunCMake_TEST_OPTIONS) + # Dev warnings should be on by default run_cmake(Wdev) @@ -790,7 +795,7 @@ function(run_llvm_rc) "test.tmp was not deleted") endif() file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir") - run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result ) + run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${LLVM_RC} -bad /FO SOURCE_DIR/llvmrc.result test.tmp ) if(EXISTS ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/test.tmp) message(SEND_ERROR "${test} - FAILED:\n" "test.tmp was not deleted") diff --git a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt index c34ef94..20715cf 100644 --- a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt @@ -1,2 +1,2 @@ ^CMake Error: -U must be followed with VAR. -CMake Error: Problem processing arguments. Aborting.$ +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt index 0c0f613..139511b 100644 --- a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt +++ b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt @@ -1,2 +1,2 @@ CMake Error: -W must be followed with \[no-\]<name>. -CMake Error: Problem processing arguments. Aborting. +CMake Error: Run 'cmake --help' for all supported options. diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt index cc643df..5d416fc 100644 --- a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt +++ b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt @@ -1,2 +1,2 @@ CMake Error: No warning name provided. -CMake Error: Problem processing arguments. Aborting. +CMake Error: Run 'cmake --help' for all supported options. diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt index cc643df..5d416fc 100644 --- a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt +++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt @@ -1,2 +1,2 @@ CMake Error: No warning name provided. -CMake Error: Problem processing arguments. Aborting. +CMake Error: Run 'cmake --help' for all supported options. diff --git a/Tests/RunCMake/ExternalData/BadArguments-stderr.txt b/Tests/RunCMake/ExternalData/BadArguments-stderr.txt new file mode 100644 index 0000000..44efe7e --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadArguments-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Ignoring unrecognized arguments passed to ExternalData_add_target: + `UNKNOWN_ARGUMENT` +Call Stack \(most recent call first\): + BadArguments.cmake:[0-9]+ \(ExternalData_Add_Target\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalData/BadArguments.cmake b/Tests/RunCMake/ExternalData/BadArguments.cmake new file mode 100644 index 0000000..dad0007 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadArguments.cmake @@ -0,0 +1,5 @@ +include(ExternalData) +set(ExternalData_URL_TEMPLATES + "file:///path/to/%(algo)/%(hash)" + ) +ExternalData_Add_Target(Data UNKNOWN_ARGUMENT) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index b5ab22d..b4cc95e 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(BadAlgoMap1) run_cmake(BadAlgoMap2) +run_cmake(BadArguments) run_cmake(BadCustom1) run_cmake(BadCustom2) run_cmake(BadCustom3) diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 4449ff1..2bb2765 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -50,7 +50,9 @@ run_cmake(ClientStateful) function(run_object object) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${object}-build) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0118=NEW) run_cmake(${object}) + list(POP_BACK RunCMake_TEST_OPTIONS) set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(${object}-SharedStateless ${CMAKE_COMMAND} .) run_cmake_command(${object}-ClientStateless ${CMAKE_COMMAND} .) diff --git a/Tests/RunCMake/GNUInstallDirs/GetAbs-stderr.txt b/Tests/RunCMake/GNUInstallDirs/GetAbs-stderr.txt new file mode 100644 index 0000000..ec9a2dd --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/GetAbs-stderr.txt @@ -0,0 +1,12 @@ +^PROJ1_FULL_BINDIR='/usr/bin' +CMake Warning \(dev\) at [^ +]*/Modules/GNUInstallDirs.cmake:[0-9]+ \(message\): + GNUInstallDirs_get_absolute_install_dir called without third argument. + Using \${dir} from the caller's scope for compatibility with CMake 3.19 and + below. +Call Stack \(most recent call first\): + GetAbs.cmake:10 \(GNUInstallDirs_get_absolute_install_dir\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +PROJ2_FULL_BINDIR='/usr/bin'$ diff --git a/Tests/RunCMake/GNUInstallDirs/GetAbs.cmake b/Tests/RunCMake/GNUInstallDirs/GetAbs.cmake new file mode 100644 index 0000000..7d5bfc8 --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/GetAbs.cmake @@ -0,0 +1,11 @@ +set(CMAKE_SIZEOF_VOID_P 8) +set(CMAKE_LIBRARY_ARCHITECTURE "arch") +set(CMAKE_INSTALL_PREFIX /usr) +include(GNUInstallDirs) + +GNUInstallDirs_get_absolute_install_dir(PROJ1_FULL_BINDIR CMAKE_INSTALL_BINDIR BINDIR) +message("PROJ1_FULL_BINDIR='${PROJ1_FULL_BINDIR}'") + +set(dir BINDIR) +GNUInstallDirs_get_absolute_install_dir(PROJ2_FULL_BINDIR CMAKE_INSTALL_BINDIR) +message("PROJ2_FULL_BINDIR='${PROJ2_FULL_BINDIR}'") diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake index 529e10a..395ff30 100644 --- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -21,4 +21,5 @@ foreach(case unset(RunCMake-stderr-file) endforeach() +run_cmake(GetAbs) run_cmake(NoSystem) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6349112..edeb6bd 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -35,6 +35,9 @@ run_cmake(TARGET_NAME_IF_EXISTS-no-arg) run_cmake(TARGET_NAME_IF_EXISTS-empty-arg) run_cmake(TARGET_NAME_IF_EXISTS) run_cmake(TARGET_NAME_IF_EXISTS-not-a-target) +run_cmake(TARGET_NAME_IF_EXISTS-alias-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-target) +run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target) run_cmake(REMOVE_DUPLICATES-empty) run_cmake(REMOVE_DUPLICATES-1) run_cmake(REMOVE_DUPLICATES-2) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake new file mode 100644 index 0000000..8ae2ecc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-alias.txt" content) + +if(NOT content STREQUAL aliasTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[aliasTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake new file mode 100644 index 0000000..d3ef0f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-alias-target.cmake @@ -0,0 +1,8 @@ +enable_language(CXX) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp" "int main(int,char**) { return 0; }\n") +add_executable(executableTarget "${CMAKE_CURRENT_BINARY_DIR}/dummy_executable.cpp") +add_executable(aliasTarget ALIAS executableTarget) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-alias.txt CONTENT "$<TARGET_NAME_IF_EXISTS:aliasTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake new file mode 100644 index 0000000..b14c9e1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported-global.txt" content) + +if(NOT content STREQUAL importedGlobalTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedGlobalTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake new file mode 100644 index 0000000..b685558 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-global-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedGlobalTarget IMPORTED GLOBAL) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported-global.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedGlobalTarget>") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake new file mode 100644 index 0000000..9615893 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated-imported.txt" content) + +if(NOT content STREQUAL importedTarget) + set(RunCMake_TEST_FAILED "actual content:\n ${content}\nbut expected [[importedTarget]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake new file mode 100644 index 0000000..2008907 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-imported-target.cmake @@ -0,0 +1,4 @@ +add_executable(importedTarget IMPORTED) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated-imported.txt CONTENT "$<TARGET_NAME_IF_EXISTS:importedTarget>") diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 7fb3919..2a53c5b 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -1,31 +1,35 @@ Test project .* Start 1: TEST:basic\.case_foo!1 - 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + 1/13 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec Start 2: TEST:basic\.case_bar!1 - 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + 2/13 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec Start 3: TEST:basic\.disabled_case!1 - 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 - 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 - 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 - 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 - 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 - 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec - Start 9: TEST:param/special\.case/"semicolon;"!1 - 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec - Start 10: TEST:param/special\.case/"backslash\\"!1 -10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec - Start 11: TEST:param/special\.case/"\$\{var\}"!1 -11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec + 3/13 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:basic\.DISABLEDnot_really_case!1 + 4/13 Test #4: TEST:basic\.DISABLEDnot_really_case!1 \.+ +Passed +[0-9.]+ sec + Start 5: TEST:disabled\.case!1 + 5/13 Test #5: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 6: TEST:DISABLEDnotreally\.case!1 + 6/13 Test #6: TEST:DISABLEDnotreally\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:typed/short\.case!1 + 7/13 Test #7: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:typed/float\.case!1 + 8/13 Test #8: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 9: TEST:value/test\.case/1!1 + 9/13 Test #9: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:value/test\.case/"foo"!1 +10/13 Test #10: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:param/special\.case/"semicolon;"!1 +11/13 Test #11: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + Start 12: TEST:param/special\.case/"backslash\\"!1 +12/13 Test #12: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + Start 13: TEST:param/special\.case/"\$\{var\}"!1 +13/13 Test #13: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 9 +100% tests passed, 0 tests failed out of 11 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: .*3 - TEST:basic\.disabled_case!1 \(Disabled\) -.*4 - TEST:disabled\.case!1 \(Disabled\) +.*5 - TEST:disabled\.case!1 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 58c4d10..5b68e10 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -1,31 +1,35 @@ Test project .* - Start 12: TEST:basic\.case_foo!2 - 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec - Start 13: TEST:basic\.case_bar!2 - 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec - Start 14: TEST:basic\.disabled_case!2 - 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 15: TEST:disabled\.case!2 - 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 16: TEST:typed/short\.case!2 - 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - Start 17: TEST:typed/float\.case!2 - 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - Start 18: TEST:value/test\.case/1!2 - 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec - Start 19: TEST:value/test\.case/"foo"!2 - 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec - Start 20: TEST:param/special\.case/"semicolon;"!2 - 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec - Start 21: TEST:param/special\.case/"backslash\\"!2 -10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec - Start 22: TEST:param/special\.case/"\$\{var\}"!2 -11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:basic\.case_foo!2 + 1/13 Test #14: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:basic\.case_bar!2 + 2/13 Test #15: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:basic\.disabled_case!2 + 3/13 Test #16: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 17: TEST:basic\.DISABLEDnot_really_case!2 + 4/13 Test #17: TEST:basic\.DISABLEDnot_really_case!2 \.+ +Passed +[0-9.]+ sec + Start 18: TEST:disabled\.case!2 + 5/13 Test #18: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 19: TEST:DISABLEDnotreally\.case!2 + 6/13 Test #19: TEST:DISABLEDnotreally\.case!2 \.+ +Passed +[0-9.]+ sec + Start 20: TEST:typed/short\.case!2 + 7/13 Test #20: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 21: TEST:typed/float\.case!2 + 8/13 Test #21: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 22: TEST:value/test\.case/1!2 + 9/13 Test #22: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 23: TEST:value/test\.case/"foo"!2 +10/13 Test #23: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 24: TEST:param/special\.case/"semicolon;"!2 +11/13 Test #24: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + Start 25: TEST:param/special\.case/"backslash\\"!2 +12/13 Test #25: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + Start 26: TEST:param/special\.case/"\$\{var\}"!2 +13/13 Test #26: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 9 +100% tests passed, 0 tests failed out of 11 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: -.*14 - TEST:basic\.disabled_case!2 \(Disabled\) -.*15 - TEST:disabled\.case!2 \(Disabled\) +.*16 - TEST:basic\.disabled_case!2 \(Disabled\) +.*18 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index a8127bf..1956c37 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -12,8 +12,11 @@ int main(int argc, char** argv) std::cout << " case_foo" << std::endl; std::cout << " case_bar" << std::endl; std::cout << " DISABLED_disabled_case" << std::endl; + std::cout << " DISABLEDnot_really_case" << std::endl; std::cout << "DISABLED_disabled." << std::endl; std::cout << " case" << std::endl; + std::cout << "DISABLEDnotreally." << std::endl; + std::cout << " case" << std::endl; std::cout << "typed/0. # TypeParam = short" << std::endl; std::cout << " case" << std::endl; std::cout << "typed/1. # TypeParam = float" << std::endl; diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-NEW.cmake b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-NEW.cmake new file mode 100644 index 0000000..c8b0a91 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0117 NEW) +include(CMP0117-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD.cmake b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD.cmake new file mode 100644 index 0000000..c0a61d0 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0117 OLD) +include(CMP0117-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-WARN.cmake b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-WARN.cmake new file mode 100644 index 0000000..37d1b64 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0117-common.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-common.cmake b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-common.cmake new file mode 100644 index 0000000..5dda623 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-common.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) + +cmake_policy(GET CMP0117 cmp0117) +if(cmp0117 STREQUAL "NEW") + if(" ${CMAKE_CXX_FLAGS} " MATCHES " ([/-]GR) ") + message(SEND_ERROR "CMAKE_CXX_FLAGS has '${CMAKE_MATCH_1}' under NEW behavior") + endif() +else() + if(NOT " ${CMAKE_CXX_FLAGS} " MATCHES " /GR ") + message(SEND_ERROR "CMAKE_CXX_FLAGS does not have '/GR' under OLD behavior") + endif() +endif() diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMakeLists.txt b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMakeLists.txt new file mode 100644 index 0000000..3e470a2 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.14) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/RunCMakeTest.cmake b/Tests/RunCMake/MSVCRuntimeTypeInfo/RunCMakeTest.cmake new file mode 100644 index 0000000..c870f59 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0117-WARN) +run_cmake(CMP0117-OLD) +run_cmake(CMP0117-NEW) diff --git a/Tests/RunCMake/Make/MakefileConflict.cmake b/Tests/RunCMake/Make/MakefileConflict.cmake new file mode 100644 index 0000000..6a8406f --- /dev/null +++ b/Tests/RunCMake/Make/MakefileConflict.cmake @@ -0,0 +1,5 @@ +add_custom_target(Custom) + +# Write a file that GNU make will prefer over "Makefile" +# if 'cmake --build' does not explicitly specify it. +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/GNUmakefile" "") diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 5562aca..b66e30e 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -42,6 +42,14 @@ run_VerboseBuild() run_cmake(CustomCommandDepfile-ERROR) run_cmake(IncludeRegexSubdir) +function(run_MakefileConflict) + run_cmake(MakefileConflict) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MakefileConflict-build) + run_cmake_command(MakefileConflict-build ${CMAKE_COMMAND} --build . --target Custom) +endfunction() +run_MakefileConflict() + function(run_CMP0113 val) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build) run_cmake(CMP0113-${val}) diff --git a/Tests/RunCMake/Make/TargetMessages-OFF-build-check.cmake b/Tests/RunCMake/Make/TargetMessages-OFF-build-check.cmake new file mode 100644 index 0000000..74a0564 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-OFF-build-check.cmake @@ -0,0 +1,3 @@ + +set (CHECK_TARGET_MESSAGES OFF) +include ("${CMAKE_CURRENT_LIST_DIR}/TargetMessages-validation.cmake") diff --git a/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt index 77a582a..8d98f9d 100644 --- a/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt +++ b/Tests/RunCMake/Make/TargetMessages-OFF-build-stdout.txt @@ -1,5 +1 @@ -^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]* -)*Scanning dependencies of target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)*$ +.* diff --git a/Tests/RunCMake/Make/TargetMessages-ON-build-check.cmake b/Tests/RunCMake/Make/TargetMessages-ON-build-check.cmake new file mode 100644 index 0000000..afd8efb --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-ON-build-check.cmake @@ -0,0 +1,3 @@ + +set (CHECK_TARGET_MESSAGES ON) +include ("${CMAKE_CURRENT_LIST_DIR}/TargetMessages-validation.cmake") diff --git a/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt index a827624..8d98f9d 100644 --- a/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt +++ b/Tests/RunCMake/Make/TargetMessages-ON-build-stdout.txt @@ -1,8 +1 @@ -^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]* -)*Scanning dependencies of target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)* -Built target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)*$ +.* diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-check.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-check.cmake new file mode 100644 index 0000000..74a0564 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-check.cmake @@ -0,0 +1,3 @@ + +set (CHECK_TARGET_MESSAGES OFF) +include ("${CMAKE_CURRENT_LIST_DIR}/TargetMessages-validation.cmake") diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt index 77a582a..8d98f9d 100644 --- a/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt +++ b/Tests/RunCMake/Make/TargetMessages-VAR-OFF-build-stdout.txt @@ -1,5 +1 @@ -^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]* -)*Scanning dependencies of target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)*$ +.* diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-check.cmake b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-check.cmake new file mode 100644 index 0000000..afd8efb --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-check.cmake @@ -0,0 +1,3 @@ + +set (CHECK_TARGET_MESSAGES ON) +include ("${CMAKE_CURRENT_LIST_DIR}/TargetMessages-validation.cmake") diff --git a/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt index a827624..8d98f9d 100644 --- a/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt +++ b/Tests/RunCMake/Make/TargetMessages-VAR-ON-build-stdout.txt @@ -1,8 +1 @@ -^(([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]* -)*Scanning dependencies of target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)* -Built target CustomTarget( -([^B]|B[^u]|Bu[^i]|Bui[^l]|Buil[^t]|Built[^ ])[^ -]*)*$ +.* diff --git a/Tests/RunCMake/Make/TargetMessages-validation.cmake b/Tests/RunCMake/Make/TargetMessages-validation.cmake new file mode 100644 index 0000000..f3d7af1 --- /dev/null +++ b/Tests/RunCMake/Make/TargetMessages-validation.cmake @@ -0,0 +1,10 @@ + +if (CHECK_TARGET_MESSAGES) + if (NOT actual_stdout MATCHES "Built target CustomTarget") + set (RunCMake_TEST_FAILED "Not found expected 'Built target' message.") + endif() +else() + if (actual_stdout MATCHES "Built target CustomTarget") + set (RunCMake_TEST_FAILED "Found unexpected 'Built target' message.") + endif() +endif() diff --git a/Tests/RunCMake/Ninja/AssumedSources.cmake b/Tests/RunCMake/Ninja/AssumedSources.cmake index 5fb0219..d5364f0 100644 --- a/Tests/RunCMake/Ninja/AssumedSources.cmake +++ b/Tests/RunCMake/Ninja/AssumedSources.cmake @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.8) +cmake_policy(SET CMP0118 NEW) project(AssumedSources) set_source_files_properties( diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake index d69a119..d314ff3 100644 --- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake +++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake @@ -7,3 +7,6 @@ set(CMAKE_AUTOMOC ON) add_library(simple_lib SHARED simple_lib.cpp) add_executable(app_with_qt app.cpp app_qt.cpp) target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core) + +add_subdirectory(QtSubDir1) +add_subdirectory(QtSubDir2) diff --git a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt new file mode 100644 index 0000000..64016b6 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0116 OLD) + +add_executable(sub_exe_1 ../app.cpp) +target_link_libraries(sub_exe_1 PRIVATE Qt5::Core) diff --git a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt new file mode 100644 index 0000000..3176426 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0116 NEW) + +add_executable(sub_exe_2 ../app.cpp) +target_link_libraries(sub_exe_2 PRIVATE Qt5::Core) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index e6f86a1..b91ab00 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -338,8 +338,17 @@ function(run_Qt5AutoMocDeps) # Build and assert that AUTOMOC was not run for app_with_qt. run_ninja("${RunCMake_TEST_BINARY_DIR}") if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt") - message(FATAL_ERROR - "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}") + endif() + # Assert that the subdir executables were not rebuilt. + if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_1") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'sub_exe_1' target:\nstdout:\n${ninja_stdout}") + endif() + if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_2") + message(FATAL_ERROR + "AUTOMOC should not have executed for 'sub_exe_2' target:\nstdout:\n${ninja_stdout}") endif() endif() endfunction() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-again-ninja-check.cmake index 1e4cbe1..1e4cbe1 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-clean-again-ninja-check.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 6699a09..2411114 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -215,7 +215,7 @@ run_ninja(CustomCommandGenerator debug-clean build-Debug.ninja clean) run_cmake_build(CustomCommandGenerator release-clean Release clean) run_cmake_build(CustomCommandGenerator debug-in-release-graph Release generated:Debug) run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TARGET_FILE_generated_Debug}") -run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) +run_ninja(CustomCommandGenerator debug-clean-again build-Debug.ninja clean:Debug) run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt index 306c255..87fa746 100644 --- a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt +++ b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in FunctionUnmatched.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/FunctionUnmatched.cmake:[0-9]+ \(function\) - - is not closed. +^CMake Error at FunctionUnmatched\.cmake:[0-9]+ \(function\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt index f4ff709..7904b87 100644 --- a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error at FunctionUnmatchedForeach.cmake:[0-9]+ \(f\): - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake:[0-9]+ \(foreach\) - - is not closed. +^CMake Error at FunctionUnmatchedForeach\.cmake:[0-9]+ \(endfunction\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/ImproperNesting-result.txt b/Tests/RunCMake/Syntax/ImproperNesting-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt b/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt new file mode 100644 index 0000000..a209ef6 --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ImproperNesting\.cmake:[0-9]+ \(endforeach\): + Flow control statements are not properly nested\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/ImproperNesting.cmake b/Tests/RunCMake/Syntax/ImproperNesting.cmake new file mode 100644 index 0000000..47ff9f9 --- /dev/null +++ b/Tests/RunCMake/Syntax/ImproperNesting.cmake @@ -0,0 +1,7 @@ +message(FATAL_ERROR "This should not happen") + +foreach(i 1 2) + if(1) +endforeach() +endif() +endif() diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt index 440d863..a7af590 100644 --- a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt +++ b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in MacroUnmatched.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/MacroUnmatched.cmake:[0-9]+ \(macro\) - - is not closed. +^CMake Error at MacroUnmatched\.cmake:[0-9]+ \(macro\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt index 820cd2e..30c4a4c 100644 --- a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error at MacroUnmatchedForeach.cmake:[0-9]+ \(m\): - A logical block opening on the line - - .*/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake:[0-9]+ \(foreach\) - - is not closed. +^CMake Error at MacroUnmatchedForeach\.cmake:[0-9]+ \(endmacro\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/Override.cmake b/Tests/RunCMake/Syntax/Override.cmake new file mode 100644 index 0000000..af62db1 --- /dev/null +++ b/Tests/RunCMake/Syntax/Override.cmake @@ -0,0 +1,6 @@ +function(override) + function(${FUNCTION_NAME}) + endfunction() +endfunction() +override() +message(FATAL_ERROR "This shouldn't happen") diff --git a/Tests/RunCMake/Syntax/OverrideBreak-result.txt b/Tests/RunCMake/Syntax/OverrideBreak-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideBreak-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideContinue-result.txt b/Tests/RunCMake/Syntax/OverrideContinue-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideContinue-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideElse-result.txt b/Tests/RunCMake/Syntax/OverrideElse-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideElse-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideElseIf-result.txt b/Tests/RunCMake/Syntax/OverrideElseIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideElseIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt b/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt b/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndFunction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndIf-result.txt b/Tests/RunCMake/Syntax/OverrideEndIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt b/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt b/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideEndWhile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideForeach-result.txt b/Tests/RunCMake/Syntax/OverrideForeach-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideFunction-result.txt b/Tests/RunCMake/Syntax/OverrideFunction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideFunction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideIf-result.txt b/Tests/RunCMake/Syntax/OverrideIf-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideIf-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideMacro-result.txt b/Tests/RunCMake/Syntax/OverrideMacro-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideMacro-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideReturn-result.txt b/Tests/RunCMake/Syntax/OverrideReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/OverrideWhile-result.txt b/Tests/RunCMake/Syntax/OverrideWhile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/OverrideWhile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 8d74dc1..4d24657 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -72,6 +72,7 @@ run_cmake(UnterminatedBrace2) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) +run_cmake(ImproperNesting) # Variable expansion tests run_cmake(ExpandInAt) @@ -122,3 +123,30 @@ run_cmake(FunctionUnmatched) run_cmake(FunctionUnmatchedForeach) run_cmake(MacroUnmatched) run_cmake(MacroUnmatchedForeach) + +function(run_override name) + string(TOLOWER "${name}" lname) + set(RunCMake_DEFAULT_stderr "^CMake Error at [^ +]*/Tests/RunCMake/Syntax/Override\\.cmake:[0-9]+ \\(function\\): + Built-in flow control command \"${lname}\" cannot be overridden\\. +Call Stack \\(most recent call first\\): + [^ +]*/Tests/RunCMake/Syntax/Override\\.cmake:[0-9]+ \\(override\\)$") + run_cmake_command(Override${name} "${CMAKE_COMMAND}" -DFUNCTION_NAME=${name} -P "${RunCMake_SOURCE_DIR}/Override.cmake") +endfunction() + +run_override(Break) +run_override(Continue) +run_override(Else) +run_override(ElseIf) +run_override(EndForeach) +run_override(EndFunction) +run_override(EndIf) +run_override(EndMacro) +run_override(EndWhile) +run_override(Foreach) +run_override(Function) +run_override(If) +run_override(Macro) +run_override(Return) +run_override(While) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index b3f3a5e..3846d7c 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -34,6 +34,7 @@ \* CMP0108 \* CMP0112 \* CMP0113 + \* CMP0119 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake new file mode 100644 index 0000000..1787e87 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetCheckProperty.cmake @@ -0,0 +1,16 @@ +add_custom_target(target1 ALL) +target_sources(target1 PRIVATE main.cpp) +get_property(actualProp1 TARGET target1 PROPERTY SOURCES) +set(desiredProp1 main.cpp) +if(NOT desiredProp1 STREQUAL actualProp1) + message("source property not set. desired: \"${desiredProp1}\" actual: \"${actualProp1}\"") +endif() + +add_custom_target(target2 ALL SOURCES main.cpp) +target_sources(target2 PRIVATE empty_1.cpp empty_2.cpp) +target_sources(target2 PRIVATE empty_3.cpp) +get_property(actualProp2 TARGET target2 PROPERTY SOURCES) +set(desiredProp2 main.cpp empty_1.cpp empty_2.cpp empty_3.cpp) +if (NOT desiredProp2 STREQUAL actualProp2) + message("source property not set. desired: \"${desiredProp2}\" actual: \"${actualProp2}\"") +endif() diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake new file mode 100644 index 0000000..0078eab --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetGenx.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE $<IF:1,${CMAKE_CURRENT_LIST_DIR}/main.cpp,${CMAKE_CURRENT_LIST_DIR}/empty_1.cpp>) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt new file mode 100644 index 0000000..9334bf6 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetInterfaceSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake new file mode 100644 index 0000000..42a8ca2 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetInterfaceSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target INTERFACE main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake new file mode 100644 index 0000000..11f0258 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPrivateSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PRIVATE main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt new file mode 100644 index 0000000..afba4be --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetPublicSources.cmake:2 \(target_sources\): + target_sources may only set PRIVATE properties on custom targets +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake new file mode 100644 index 0000000..d9e82c0 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetPublicSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target PUBLIC main.cpp) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt b/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt b/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt new file mode 100644 index 0000000..4a153e9 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AddCustomTargetSources.cmake:2 \(target_sources\): + target_sources called with invalid arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake b/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake new file mode 100644 index 0000000..dd688d3 --- /dev/null +++ b/Tests/RunCMake/TargetSources/AddCustomTargetSources.cmake @@ -0,0 +1,2 @@ +add_custom_target(target ALL) +target_sources(target main.cpp) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 0d462ba..b56ee44 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -14,3 +14,9 @@ run_cmake(RelativePathInSubdirInterface) run_cmake(RelativePathInSubdirPrivate) run_cmake(RelativePathInSubdirInclude) run_cmake(ExportBuild) +run_cmake(AddCustomTargetPublicSources) +run_cmake(AddCustomTargetPrivateSources) +run_cmake(AddCustomTargetInterfaceSources) +run_cmake(AddCustomTargetSources) +run_cmake(AddCustomTargetCheckProperty) +run_cmake(AddCustomTargetGenx) diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt b/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt new file mode 100644 index 0000000..b96eee6 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage-stdout.txt @@ -0,0 +1 @@ +-- Looking for a C compiler - NOTFOUND diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake b/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake new file mode 100644 index 0000000..081f905 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage-toolchain.cmake @@ -0,0 +1,4 @@ +get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) +if(in_try_compile) + message(FATAL_ERROR "Toolchain file included") +endif() diff --git a/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake b/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake new file mode 100644 index 0000000..854b3d4 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/CheckLanguage.cmake @@ -0,0 +1,2 @@ +include(CheckLanguage) +check_language(C) diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake index 7eb4485..659523c 100644 --- a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -7,6 +7,7 @@ endfunction() run_cmake_toolchain(CallEnableLanguage) run_cmake_toolchain(CallProject) +run_cmake_toolchain(CheckLanguage) run_cmake_toolchain(FlagsInit) run_cmake_toolchain(LinkFlagsInit) diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake new file mode 100644 index 0000000..cb75eb0 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +function(run_transform_depfile name) + set(RunCMake-check-file gccdepfile.cmake) + run_cmake_command(${name}-gcc + ${CMAKE_COMMAND} -E cmake_transform_depfile gccdepfile ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.d + ) + set(RunCMake-check-file vstlog.cmake) + run_cmake_command(${name}-tlog + ${CMAKE_COMMAND} -E cmake_transform_depfile vstlog ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.tlog + ) +endfunction() + +if(WIN32) + run_transform_depfile(deps-windows) +else() + run_transform_depfile(deps-unix) +endif() +run_transform_depfile(noexist) +run_transform_depfile(empty) +run_transform_depfile(invalid) diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d b/Tests/RunCMake/TransformDepfile/deps-unix.d new file mode 100644 index 0000000..5da5be8 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.d @@ -0,0 +1,6 @@ +out1 /home/build/out2: in1 /home/build/in2 + +out3 \ + /home/build/out4: \ + in3 \ + /home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt new file mode 100644 index 0000000..58770f2 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt @@ -0,0 +1,8 @@ +../out1 \ + /home/build/out2: \ + ../in1 \ + /home/build/in2 +../out3 \ + /home/build/out4: \ + ../in3 \ + /home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt new file mode 100644 index 0000000..2a26edf --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt @@ -0,0 +1,6 @@ +^../out1|/home/build/out2 +../in1 +/home/build/in2 +^../out3|/home/build/out4 +../in3 +/home/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d b/Tests/RunCMake/TransformDepfile/deps-windows.d new file mode 100644 index 0000000..c926670 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.d @@ -0,0 +1,6 @@ +out1 C:/build/out2: in1 C:/build/in2 + +out3 \ + C:/build/out4: \ + in3 \ + C:/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt new file mode 100644 index 0000000..47b3ebf --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt @@ -0,0 +1,8 @@ +../out1 \ + C:/build/out2: \ + ../in1 \ + C:/build/in2 +../out3 \ + C:/build/out4: \ + ../in3 \ + C:/build/in4 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt new file mode 100644 index 0000000..1e6024d --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt @@ -0,0 +1,6 @@ +^..\out1|C:\build\out2 +..\in1 +C:\build\in2 +^..\out3|C:\build\out4 +..\in3 +C:\build\in4 diff --git a/Tests/RunCMake/TransformDepfile/empty.d b/Tests/RunCMake/TransformDepfile/empty.d new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.d diff --git a/Tests/RunCMake/TransformDepfile/empty.d.txt b/Tests/RunCMake/TransformDepfile/empty.d.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.d.txt diff --git a/Tests/RunCMake/TransformDepfile/empty.tlog.txt b/Tests/RunCMake/TransformDepfile/empty.tlog.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/empty.tlog.txt diff --git a/Tests/RunCMake/TransformDepfile/gccdepfile.cmake b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake new file mode 100644 index 0000000..be1e210 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake @@ -0,0 +1,16 @@ +if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.d.txt") + file(READ "${RunCMake_SOURCE_DIR}/${name}.d.txt" expected_contents) + + if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d") + file(READ "${RunCMake_TEST_BINARY_DIR}/out.d" actual_contents) + if(NOT actual_contents STREQUAL expected_contents) + string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}") + string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.d:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should exist\n") + endif() +elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should not exist\n") +endif() diff --git a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TransformDepfile/invalid.d b/Tests/RunCMake/TransformDepfile/invalid.d new file mode 100644 index 0000000..9977a28 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/invalid.d @@ -0,0 +1 @@ +invalid diff --git a/Tests/RunCMake/TransformDepfile/noexist.d.txt b/Tests/RunCMake/TransformDepfile/noexist.d.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/noexist.d.txt diff --git a/Tests/RunCMake/TransformDepfile/noexist.tlog.txt b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt diff --git a/Tests/RunCMake/TransformDepfile/vstlog.cmake b/Tests/RunCMake/TransformDepfile/vstlog.cmake new file mode 100644 index 0000000..afa78d0 --- /dev/null +++ b/Tests/RunCMake/TransformDepfile/vstlog.cmake @@ -0,0 +1,16 @@ +if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.tlog.txt") + file(READ "${RunCMake_SOURCE_DIR}/${name}.tlog.txt" expected_contents) + + if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog") + file(READ "${RunCMake_TEST_BINARY_DIR}/out.tlog" actual_contents) + if(NOT actual_contents STREQUAL expected_contents) + string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}") + string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}") + string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.tlog:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should exist\n") + endif() +elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog") + string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should not exist\n") +endif() diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-stderr.txt new file mode 100644 index 0000000..4e0d756 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The WriteCompilerDetectionHeader module has been removed by policy CMP0120. +Call Stack \(most recent call first\): + CMP0120-NEW-Direct.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct.cmake new file mode 100644 index 0000000..4cd2c56 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-Direct.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0120 NEW) +include(${CMAKE_ROOT}/Modules/WriteCompilerDetectionHeader.cmake) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-stderr.txt new file mode 100644 index 0000000..2f7ad70 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0120-NEW.cmake:[0-9]+ \(include\): + include could not find requested file: + + WriteCompilerDetectionHeader +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW.cmake new file mode 100644 index 0000000..3d39a97 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0120 NEW) +include(WriteCompilerDetectionHeader) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct.cmake new file mode 100644 index 0000000..48517e6 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0120 OLD) +include(${CMAKE_ROOT}/Modules/WriteCompilerDetectionHeader.cmake) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD.cmake new file mode 100644 index 0000000..c513186 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0120 OLD) +include(WriteCompilerDetectionHeader) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct-stderr.txt new file mode 100644 index 0000000..88cd8f7 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct-stderr.txt @@ -0,0 +1,9 @@ +^CMake Warning \(dev\) at [^ +]*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The WriteCompilerDetectionHeader module will be removed by policy CMP0120. + Projects should be ported away from the module, perhaps by bundling a copy + of the generated header or using a third-party alternative. +Call Stack \(most recent call first\): + CMP0120-WARN-Direct.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct.cmake new file mode 100644 index 0000000..d3c7f77 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-Direct.cmake @@ -0,0 +1,2 @@ + +include(${CMAKE_ROOT}/Modules/WriteCompilerDetectionHeader.cmake) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-stderr.txt new file mode 100644 index 0000000..315b4b1 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN-stderr.txt @@ -0,0 +1,18 @@ +^CMake Warning \(dev\) at CMP0120-WARN.cmake:[0-9]+ \(include\): + Policy CMP0120 is not set: The WriteCompilerDetectionHeader module is + removed. Run "cmake --help-policy CMP0120" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at [^ +]*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): + The WriteCompilerDetectionHeader module will be removed by policy CMP0120. + Projects should be ported away from the module, perhaps by bundling a copy + of the generated header or using a third-party alternative. +Call Stack \(most recent call first\): + CMP0120-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN.cmake new file mode 100644 index 0000000..1f95e3e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-WARN.cmake @@ -0,0 +1,2 @@ + +include(WriteCompilerDetectionHeader) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake index a834e6d..7589f74 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake @@ -1,5 +1,12 @@ include(RunCMake) +run_cmake(CMP0120-WARN) +run_cmake(CMP0120-OLD) +run_cmake(CMP0120-NEW) +run_cmake(CMP0120-WARN-Direct) +run_cmake(CMP0120-OLD-Direct) +run_cmake(CMP0120-NEW-Direct) + run_cmake(InvalidArgs) run_cmake(NoCompiler) run_cmake(NoFeature) diff --git a/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt b/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt new file mode 100644 index 0000000..0400d1a --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project(${RunCMake_TEST} LANGUAGES C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake new file mode 100644 index 0000000..9cc03b9 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake @@ -0,0 +1,14 @@ +function(findAttribute project attr) + execute_process( + COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj + OUTPUT_VARIABLE output_var + RESULT_VARIABLE result_var + ) + + if(NOT result_var) + set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE) + endif() +endfunction() + +findAttribute(${test} "RemoveHeadersOnCopy") +findAttribute(${test} "CodeSignOnCopy") diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake new file mode 100644 index 0000000..f4fe07f --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake @@ -0,0 +1,7 @@ +add_executable(app MACOSX_BUNDLE main.m) + +set_target_properties(app PROPERTIES + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY OFF + XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY OFF +) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake new file mode 100644 index 0000000..e4ea55d --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/sharedFrameworkExt.framework) + set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location") +endif() diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake new file mode 100644 index 0000000..3f62640 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake @@ -0,0 +1,14 @@ +function(findAttribute project attr) + execute_process( + COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj + OUTPUT_VARIABLE output_var + RESULT_VARIABLE result_var + ) + + if(result_var) + set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE) + endif() +endfunction() + +findAttribute(${test} "RemoveHeadersOnCopy") +findAttribute(${test} "CodeSignOnCopy") diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake new file mode 100644 index 0000000..79d8d77 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake @@ -0,0 +1,7 @@ +add_executable(app MACOSX_BUNDLE main.m) + +set_target_properties(app PROPERTIES + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON + XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON +) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake new file mode 100644 index 0000000..57c79ea --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/subdir/sharedFrameworkExt.framework) + set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location") +endif() diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake new file mode 100644 index 0000000..3f62640 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake @@ -0,0 +1,14 @@ +function(findAttribute project attr) + execute_process( + COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj + OUTPUT_VARIABLE output_var + RESULT_VARIABLE result_var + ) + + if(result_var) + set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE) + endif() +endfunction() + +findAttribute(${test} "RemoveHeadersOnCopy") +findAttribute(${test} "CodeSignOnCopy") diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake new file mode 100644 index 0000000..4c78199 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake @@ -0,0 +1,8 @@ +add_executable(app MACOSX_BUNDLE main.m) + +set_target_properties(app PROPERTIES + XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}" + XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON + XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON + XCODE_EMBED_FRAMEWORKS_PATH "subdir" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake b/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake new file mode 100644 index 0000000..64e2f95 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake @@ -0,0 +1,2 @@ +add_library(sharedFrameworkExt SHARED func.m) +set_target_properties(sharedFrameworkExt PROPERTIES FRAMEWORK TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake new file mode 100644 index 0000000..0dc1cf3 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -0,0 +1,43 @@ +include(RunCMake) + +# Build a framework that the other tests will use and treat as external. +# Always build in the Debug configuration so that the path to the framework +# is predictable. +function(ExternalFramework) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalFramework-build) + set(externalFramework ${RunCMake_TEST_BINARY_DIR}/Debug/sharedFrameworkExt.framework PARENT_SCOPE) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(ExternalFramework) + run_cmake_command(ExternalFramework-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target sharedFrameworkExt + ) +endfunction() +ExternalFramework() + +set(RunCMake_TEST_OPTIONS -DEXTERNAL_FWK=${externalFramework}) + +run_cmake(EmbedFrameworksFlagsOff) + +function(TestFlagsOn testName) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + +TestFlagsOn(EmbedFrameworksFlagsOnNoSubdir) +TestFlagsOn(EmbedFrameworksFlagsOnWithSubdir) diff --git a/Tests/RunCMake/XcodeProject-Embed/func.m b/Tests/RunCMake/XcodeProject-Embed/func.m new file mode 100644 index 0000000..29c6689 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/func.m @@ -0,0 +1,6 @@ +#import <CoreFoundation/CoreFoundation.h> + +int func() +{ + return 1; +} diff --git a/Tests/RunCMake/XcodeProject-Embed/main.m b/Tests/RunCMake/XcodeProject-Embed/main.m new file mode 100644 index 0000000..72e425d --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/main.m @@ -0,0 +1,6 @@ +#import <CoreFoundation/CoreFoundation.h> + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 62163ac..abba741 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -51,6 +51,35 @@ run_cmake(PerConfigPerSourceOptions) run_cmake(PerConfigPerSourceDefinitions) run_cmake(PerConfigPerSourceIncludeDirs) +if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + + function(XcodeObjectLibsInTwoProjectsiOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-ios) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS") + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-ios ${CMAKE_COMMAND} --build . --target shared_lib -- -sdk iphonesimulator) + endfunction() + + XcodeObjectLibsInTwoProjectsiOS() + + function(XcodeObjectLibsInTwoProjectsMacOS) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeObjectLibsInTwoProjects-build-macos) + + run_cmake(XcodeObjectLibsInTwoProjects) + + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake_command(XcodeObjectLibsInTwoProjects-build-macos ${CMAKE_COMMAND} --build . --target shared_lib) + endfunction() + + XcodeObjectLibsInTwoProjectsMacOS() + +endif() + function(XcodeSchemaGeneration) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeSchemaGeneration-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake new file mode 100644 index 0000000..3ca24af --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectLibsInTwoProjects.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required (VERSION 3.19) + +project (test_xcode_fail NONE) + +add_subdirectory(subproject_two_object_libs) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt new file mode 100644 index 0000000..e55836d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 3.16) + +enable_language(CXX) + +project (subproject_two_object_libs) + +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + +if(IOS) + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") +endif() + +# Hierarchy of libraries looks like: +# +# OBJECT-1 ---> STATIC--\ +# |---> SHARED +# OBJECT-2 -------------/ + +add_library(object_lib_dependency1 OBJECT dummy.cpp) + +add_library(static_lib_dependency STATIC dummy.cpp $<TARGET_OBJECTS:object_lib_dependency1>) + +add_library(object_lib_dependency2 OBJECT dummy.cpp) +target_link_libraries(object_lib_dependency2 PRIVATE static_lib_dependency) + +add_library(shared_lib SHARED dummy.cpp) +target_link_libraries(shared_lib PRIVATE static_lib_dependency) +target_sources(shared_lib PRIVATE $<TARGET_OBJECTS:object_lib_dependency2>) diff --git a/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp new file mode 100644 index 0000000..8082abc --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_two_object_libs/dummy.cpp @@ -0,0 +1,5 @@ +namespace { +void foo() +{ +} +} diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt index b7ee23a..9324302 100644 --- a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -1,5 +1,5 @@ CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): - add_custom_command given APPEND option with output + Attempt to APPEND to custom command with output .*RunCMake/add_custom_command/AppendNotOutput-build/out diff --git a/Tests/RunCMake/add_library/CMP0073-stderr.txt b/Tests/RunCMake/add_library/CMP0073-stderr.txt new file mode 100644 index 0000000..7f43fd7 --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0073.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0073 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND_STRING-OUTPUT_VARIABLE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/APPEND_STRING-wrong-path-result.txt b/Tests/RunCMake/cmake_path/APPEND_STRING-wrong-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/APPEND_STRING-wrong-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CONCAT.cmake b/Tests/RunCMake/cmake_path/APPEND_STRING.cmake index 62b5eb0..ea5f2dd 100644 --- a/Tests/RunCMake/cmake_path/CONCAT.cmake +++ b/Tests/RunCMake/cmake_path/APPEND_STRING.cmake @@ -3,13 +3,13 @@ include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") unset (errors) set (path "/a/b") -cmake_path (CONCAT path "cd") +cmake_path (APPEND_STRING path "cd") if (NOT path STREQUAL "/a/bcd") list (APPEND errors "'${path}' instead of 'a/bcd'") endif() set (path "/a/b") -cmake_path (CONCAT path "cd" "ef" OUTPUT_VARIABLE output) +cmake_path (APPEND_STRING path "cd" "ef" OUTPUT_VARIABLE output) if (NOT path STREQUAL "/a/b") list (APPEND errors "input changed unexpectedly") endif() @@ -17,4 +17,4 @@ if (NOT output STREQUAL "/a/bcdef") list (APPEND errors "'${output}' instead of 'a/bcdef'") endif() -check_errors (CONCAT ${errors}) +check_errors (APPEND_STRING ${errors}) diff --git a/Tests/RunCMake/cmake_path/COMPARE.cmake b/Tests/RunCMake/cmake_path/COMPARE.cmake index bc6b9b4..ecf7c82 100644 --- a/Tests/RunCMake/cmake_path/COMPARE.cmake +++ b/Tests/RunCMake/cmake_path/COMPARE.cmake @@ -2,19 +2,19 @@ include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") unset (errors) -set (path "a///b/c") -cmake_path(COMPARE path EQUAL "a/b/c" output) +set(path "a///b/c") +cmake_path(COMPARE "${path}" EQUAL "a/b/c" output) if (NOT output) list (APPEND errors "'${path}' not equal to 'a/b/c'") endif() set (path "a/b/d/../c") -cmake_path(COMPARE path NOT_EQUAL "a/b/c" output) +cmake_path(COMPARE "${path}" NOT_EQUAL "a/b/c" output) if (NOT output) list (APPEND errors "'${path}' equal to 'a/b/c'") endif() cmake_path(NORMAL_PATH path) -cmake_path(COMPARE path EQUAL "a/b/c" output) +cmake_path(COMPARE "${path}" EQUAL "a/b/c" output) if (NOT output) list (APPEND errors "'${path}' not equal to 'a/b/c'") endif() diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake deleted file mode 100644 index ad23377..0000000 --- a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake +++ /dev/null @@ -1,41 +0,0 @@ - -include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") -unset (errors) - -if (WIN32) - set (path "c:/a/d") - cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") - if (NOT path STREQUAL "c:/a/d") - list (APPEND errors "'${path}' instead of 'c:/a/d'") - endif() -else() - set (path "/a/d") - cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c") - if (NOT path STREQUAL "/a/d") - list (APPEND errors "'${path}' instead of '/a/d'") - endif() -endif() - -set (path "/a/d") -cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "/a/b/c" OUTPUT_VARIABLE output) -if (NOT path STREQUAL "/a/d") - list (APPEND errors "input changed unexpectedly") -endif() -if (NOT output STREQUAL "../../d") - list (APPEND errors "'${output}' instead of '../../d'") -endif() - -set (path "${CMAKE_CURRENT_SOURCE_DIR}/a/d") -cmake_path(PROXIMATE_PATH path) -if (NOT path STREQUAL "a/d") - list (APPEND errors "'${path}' instead of 'a/d'") -endif() - -set (path "a/b/c") -cmake_path(PROXIMATE_PATH path) -if (NOT path STREQUAL "a/b/c") - list (APPEND errors "'${path}' instead of 'a/b/c'") -endif() - - -check_errors (PROXIMATE_PATH ${errors}) diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake index ca9cba6..4edfb1a 100644 --- a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake @@ -11,14 +11,9 @@ foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSI run_cmake_command (GET-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET wrong_path ${subcommand} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() -### COMPARE sub-command -foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) - run_cmake_command (COMPARE-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE wrong_path ${subcommand} path2 output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") -endforeach() - -foreach (command IN ITEMS CONCAT REMOVE_FILENAME REPLACE_FILENAME +foreach (command IN ITEMS APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH - RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + RELATIVE_PATH ABSOLUTE_PATH) run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() @@ -55,7 +50,7 @@ foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) run_cmake_command (COMPARE-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() -foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH +foreach (command IN ITEMS SET NATIVE_PATH HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH HAS_FILENAME HAS_EXTENSION HAS_STEM HAS_RELATIVE_PATH HAS_PARENT_PATH @@ -72,9 +67,9 @@ endforeach() ## OUTPUT_VARIABLE without argument set (RunCMake-stderr-file "OUTPUT_VARIABLE-no-arg-stderr.txt") -foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME +foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH - RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + RELATIVE_PATH ABSOLUTE_PATH) run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() @@ -98,7 +93,7 @@ foreach (subcommand IN ITEMS EQUAL NOT_EQUAL) run_cmake_command (COMPARE-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() -foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH +foreach (command IN ITEMS NATIVE_PATH HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH HAS_FILENAME HAS_EXTENSION HAS_STEM HAS_RELATIVE_PATH HAS_PARENT_PATH @@ -111,9 +106,9 @@ foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() -foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME +foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH - RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + RELATIVE_PATH ABSOLUTE_PATH) run_cmake_command (${command}-OUTPUT_VARIABLE-invalid-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() @@ -139,7 +134,7 @@ endforeach() foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH - RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH) + RELATIVE_PATH ABSOLUTE_PATH) if (command STREQUAL "REPLACE_FILENAME" OR command STREQUAL "REPLACE_EXTENSION") set (extra_args input) else() @@ -148,7 +143,7 @@ foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake") endforeach() -foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH +foreach (command IN ITEMS SET NATIVE_PATH HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH HAS_FILENAME HAS_EXTENSION HAS_STEM HAS_RELATIVE_PATH HAS_PARENT_PATH @@ -170,17 +165,16 @@ run_cmake(COMPARE-wrong-operator) set (RunCMake_TEST_OPTIONS "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}") run_cmake(GET) +run_cmake(SET) run_cmake(APPEND) -run_cmake(CONCAT) +run_cmake(APPEND_STRING) run_cmake(REMOVE_FILENAME) run_cmake(REPLACE_FILENAME) run_cmake(REMOVE_EXTENSION) run_cmake(REPLACE_EXTENSION) run_cmake(NORMAL_PATH) run_cmake(RELATIVE_PATH) -run_cmake(PROXIMATE_PATH) run_cmake(ABSOLUTE_PATH) -run_cmake(CMAKE_PATH) run_cmake(NATIVE_PATH) run_cmake(CONVERT) run_cmake(COMPARE) diff --git a/Tests/RunCMake/cmake_path/SET-missing-output-result.txt b/Tests/RunCMake/cmake_path/SET-missing-output-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/SET-missing-output-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/SET-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/SET-unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_path/SET-unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake b/Tests/RunCMake/cmake_path/SET.cmake index b9320f3..445783e 100644 --- a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake +++ b/Tests/RunCMake/cmake_path/SET.cmake @@ -2,42 +2,42 @@ include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") unset (errors) -cmake_path(CMAKE_PATH path "/x/y/z/../../a/d") +cmake_path(SET path "/x/y/z/../../a/d") if (NOT path STREQUAL "/x/y/z/../../a/d") list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") endif() -cmake_path(CMAKE_PATH path NORMALIZE "/x/y/z/../../a/d") +cmake_path(SET path NORMALIZE "/x/y/z/../../a/d") if (NOT path STREQUAL "/x/a/d") list (APPEND errors "'${path}' instead of '/x/a/d'") endif() if (WIN32) - cmake_path(CMAKE_PATH path "/x\\y/z\\..\\../a/d") + cmake_path(SET path "/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "/x/y/z/../../a/d") list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'") endif() - cmake_path(CMAKE_PATH path NORMALIZE "/x\\y/z\\..\\../a/d") + cmake_path(SET path NORMALIZE "/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "/x/a/d") list (APPEND errors "'${path}' instead of '/x/a/d'") endif() - cmake_path(CMAKE_PATH path "//?/c:/x\\y/z\\..\\../a/d") + cmake_path(SET path "//?/c:/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "c:/x/y/z/../../a/d") list (APPEND errors "'${path}' instead of 'c:/x/y/z/../../a/d'") endif() - cmake_path(CMAKE_PATH path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d") + cmake_path(SET path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "c:/x/a/d") list (APPEND errors "'${path}' instead of 'c:/x/a/d'") endif() - cmake_path(CMAKE_PATH path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d") + cmake_path(SET path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "//host/x/y/z/../../a/d") list (APPEND errors "'${path}' instead of '//host/x/y/z/../../a/d'") endif() - cmake_path(CMAKE_PATH path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d") + cmake_path(SET path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d") if (NOT path STREQUAL "//host/x/a/d") list (APPEND errors "'${path}' instead of '//host/x/a/d'") endif() endif() -check_errors (CMAKE_PATH ${errors}) +check_errors (SET ${errors}) diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index 71694fb..0a2e3f9 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -16,6 +16,13 @@ run_cmake(NewLineStyle-WrongArg) run_cmake(NewLineStyle-ValidArg) run_cmake(NewLineStyle-COPYONLY) run_cmake(NoSourcePermissions) +run_cmake(SourcePermissionsInvalidArg-1) +run_cmake(SourcePermissionsInvalidArg-2) +run_cmake(SourcePermissionsInvalidArg-3) +run_cmake(SourcePermissionsInvalidArg-4) +run_cmake(SourcePermissionsInvalidArg-5) +run_cmake(UseSourcePermissions) +run_cmake(SourcePermissions) if(RunCMake_GENERATOR MATCHES "Make") # Use a single build tree for a few tests without cleaning. diff --git a/Tests/RunCMake/configure_file/SourcePermissions-result.txt b/Tests/RunCMake/configure_file/SourcePermissions-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions-result.txt diff --git a/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions-stderr.txt diff --git a/Tests/RunCMake/configure_file/SourcePermissions.cmake b/Tests/RunCMake/configure_file/SourcePermissions.cmake new file mode 100644 index 0000000..50330fc --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissions.cmake @@ -0,0 +1,34 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt + FILE_PERMISSIONS + OWNER_READ OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ +) + +if (UNIX) + find_program(STAT_EXECUTABLE NAMES stat) + if(NOT STAT_EXECUTABLE) + return() + endif() + + if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + else() + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt" + OUTPUT_VARIABLE output + ) + endif() + + if (NOT output EQUAL "554") + message(FATAL_ERROR "configure file has different permissions than " + "desired, generated permissions: ${output}") + endif() + +endif() diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt new file mode 100644 index 0000000..d483d34 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-1.cmake:1 \(configure_file\): + configure_file given both USE_SOURCE_PERMISSIONS and NO_SOURCE_PERMISSIONS. + Only one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake new file mode 100644 index 0000000..4969880 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-1.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + NO_SOURCE_PERMISSIONS + USE_SOURCE_PERMISSIONS +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt new file mode 100644 index 0000000..2fcfe58 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-2.cmake:1 \(configure_file\): + configure_file given both FILE_PERMISSIONS and NO_SOURCE_PERMISSIONS. Only + one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake new file mode 100644 index 0000000..8a3fb87 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-2.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + NO_SOURCE_PERMISSIONS + FILE_PERMISSIONS OWNER_READ +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt new file mode 100644 index 0000000..29fae1b --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at SourcePermissionsInvalidArg-3.cmake:1 \(configure_file\): + configure_file given both FILE_PERMISSIONS and USE_SOURCE_PERMISSIONS. + Only one option allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake new file mode 100644 index 0000000..78ecb0f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-3.cmake @@ -0,0 +1,5 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + USE_SOURCE_PERMISSIONS + FILE_PERMISSIONS OWNER_READ +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt new file mode 100644 index 0000000..7d477cb --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourcePermissionsInvalidArg-4.cmake:1 \(configure_file\): + configure_file given FILE_PERMISSIONS without any options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake new file mode 100644 index 0000000..308b455 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-4.cmake @@ -0,0 +1,4 @@ +configure_file(sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile.txt + FILE_PERMISSIONS +) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt new file mode 100644 index 0000000..7cab120 --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourcePermissionsInvalidArg-5.cmake:1 \(configure_file\): + configure_file given invalid permission "OWNER_RX","GROUP_RWX". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake new file mode 100644 index 0000000..15c6f9a --- /dev/null +++ b/Tests/RunCMake/configure_file/SourcePermissionsInvalidArg-5.cmake @@ -0,0 +1,6 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-source-permissions.txt + FILE_PERMISSIONS + OWNER_READ OWNER_RX + GROUP_RWX +) diff --git a/Tests/RunCMake/configure_file/UseSourcePermissions.cmake b/Tests/RunCMake/configure_file/UseSourcePermissions.cmake new file mode 100644 index 0000000..f7aedd1 --- /dev/null +++ b/Tests/RunCMake/configure_file/UseSourcePermissions.cmake @@ -0,0 +1,40 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt + ${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt + USE_SOURCE_PERMISSIONS +) + +if (UNIX) + find_program(STAT_EXECUTABLE NAMES stat) + if(NOT STAT_EXECUTABLE) + return() + endif() + + if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + else() + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt" + OUTPUT_VARIABLE output1 + ) + execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${CMAKE_CURRENT_BINARY_DIR}/sourcefile-use-source-permissions.txt" + OUTPUT_VARIABLE output2 + ) + endif() + + if (NOT output1 EQUAL output2) + message(FATAL_ERROR "configure file has different permissions source " + "permissions: ${output1} generated permissions: ${output2}") + endif() + +endif() diff --git a/Tests/RunCMake/configure_file/sourcefile.txt b/Tests/RunCMake/configure_file/sourcefile.txt new file mode 100644 index 0000000..2296808 --- /dev/null +++ b/Tests/RunCMake/configure_file/sourcefile.txt @@ -0,0 +1 @@ +an empty file diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index c4ee53d..2143fa2 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -2,6 +2,9 @@ include(RunCMake) run_cmake(cache_properties) run_cmake(directory_properties) +run_cmake(get_directory_property_empty) +run_cmake(get_directory_property_missing) +run_cmake(get_directory_property_missingWithDir) run_cmake(global_properties) run_cmake(install_properties) run_cmake(source_properties) diff --git a/Tests/RunCMake/get_property/get_directory_property_empty-result.txt b/Tests/RunCMake/get_property/get_directory_property_empty-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_empty-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/get_directory_property_empty-stderr.txt b/Tests/RunCMake/get_property/get_directory_property_empty-stderr.txt new file mode 100644 index 0000000..baa73f3 --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_empty-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at get_directory_property_empty.cmake:1 \(get_directory_property\): + get_directory_property given empty string for the property name to get +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/get_property/get_directory_property_empty.cmake b/Tests/RunCMake/get_property/get_directory_property_empty.cmake new file mode 100644 index 0000000..b49be1c --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_empty.cmake @@ -0,0 +1 @@ +get_directory_property(outVar "") diff --git a/Tests/RunCMake/get_property/get_directory_property_missing-result.txt b/Tests/RunCMake/get_property/get_directory_property_missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/get_directory_property_missing-stderr.txt b/Tests/RunCMake/get_property/get_directory_property_missing-stderr.txt new file mode 100644 index 0000000..e101c76 --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missing-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at get_directory_property_missing.cmake:1 \(get_directory_property\): + get_directory_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/get_property/get_directory_property_missing.cmake b/Tests/RunCMake/get_property/get_directory_property_missing.cmake new file mode 100644 index 0000000..c28157e --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missing.cmake @@ -0,0 +1 @@ +get_directory_property(outVar) diff --git a/Tests/RunCMake/get_property/get_directory_property_missingWithDir-result.txt b/Tests/RunCMake/get_property/get_directory_property_missingWithDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missingWithDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/get_property/get_directory_property_missingWithDir-stderr.txt b/Tests/RunCMake/get_property/get_directory_property_missingWithDir-stderr.txt new file mode 100644 index 0000000..66deabb --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missingWithDir-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at get_directory_property_missingWithDir.cmake:1 \(get_directory_property\): + get_directory_property called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/get_property/get_directory_property_missingWithDir.cmake b/Tests/RunCMake/get_property/get_directory_property_missingWithDir.cmake new file mode 100644 index 0000000..573e14a --- /dev/null +++ b/Tests/RunCMake/get_property/get_directory_property_missingWithDir.cmake @@ -0,0 +1 @@ +get_directory_property(outVar DIRECTORY .) diff --git a/Tests/RunCMake/if/duplicate-deep-else-stderr.txt b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt index ac2335c..ee886e0 100644 --- a/Tests/RunCMake/if/duplicate-deep-else-stderr.txt +++ b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-deep-else.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-deep-else\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt index ba6765c..60c8484 100644 --- a/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt +++ b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-else-after-elseif.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-else-after-elseif\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/duplicate-else-stderr.txt b/Tests/RunCMake/if/duplicate-else-stderr.txt index e0dd01f..518c43f 100644 --- a/Tests/RunCMake/if/duplicate-else-stderr.txt +++ b/Tests/RunCMake/if/duplicate-else-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at duplicate-else.cmake:[0-9]+ \(else\): - A duplicate ELSE command was found inside an IF block. +CMake Error at duplicate-else\.cmake:[0-9]+ \(else\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/if/misplaced-elseif-stderr.txt b/Tests/RunCMake/if/misplaced-elseif-stderr.txt index c4b0266..5138f11 100644 --- a/Tests/RunCMake/if/misplaced-elseif-stderr.txt +++ b/Tests/RunCMake/if/misplaced-elseif-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at misplaced-elseif.cmake:[0-9]+ \(elseif\): - An ELSEIF command was found after an ELSE command. +CMake Error at misplaced-elseif\.cmake:[0-9]+ \(elseif\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/include/ExportExportInclude-stderr.txt b/Tests/RunCMake/include/ExportExportInclude-stderr.txt index 70d013c..6d5c02f 100644 --- a/Tests/RunCMake/include/ExportExportInclude-stderr.txt +++ b/Tests/RunCMake/include/ExportExportInclude-stderr.txt @@ -1,5 +1,5 @@ CMake Error at ExportExportInclude.cmake:6 \(include\): - include could not find load file: + include could not find requested file: .*/Tests/RunCMake/include/ExportExportInclude-build/theTargets.cmake Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/include/IncludeIsDirectory-result.txt b/Tests/RunCMake/include/IncludeIsDirectory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt new file mode 100644 index 0000000..5735c29 --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at IncludeIsDirectory.cmake:1 \(include\): + include requested file is a directory: + + .*/Tests/RunCMake/include/IncludeIsDirectory-build +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/IncludeIsDirectory.cmake b/Tests/RunCMake/include/IncludeIsDirectory.cmake new file mode 100644 index 0000000..74189e3 --- /dev/null +++ b/Tests/RunCMake/include/IncludeIsDirectory.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Tests/RunCMake/include/IncludeMalformed-result.txt b/Tests/RunCMake/include/IncludeMalformed-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include/IncludeMalformed-stderr.txt b/Tests/RunCMake/include/IncludeMalformed-stderr.txt new file mode 100644 index 0000000..fc75549 --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at malformedInclude.cmake:1: + Parse error. Function missing ending "\)". End of file reached. +Call Stack \(most recent call first\): + IncludeMalformed.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) + + +CMake Error at IncludeMalformed.cmake:1 \(include\): + include could not load requested file: + + malformedInclude.cmake +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/IncludeMalformed.cmake b/Tests/RunCMake/include/IncludeMalformed.cmake new file mode 100644 index 0000000..9560142 --- /dev/null +++ b/Tests/RunCMake/include/IncludeMalformed.cmake @@ -0,0 +1 @@ +include("malformedInclude.cmake") diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake index bea7d5c..8fb7201 100644 --- a/Tests/RunCMake/include/RunCMakeTest.cmake +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -5,3 +5,5 @@ run_cmake(EmptyStringOptional) run_cmake(CMP0024-WARN) run_cmake(CMP0024-NEW) run_cmake(ExportExportInclude) +run_cmake(IncludeIsDirectory) +run_cmake(IncludeMalformed) diff --git a/Tests/RunCMake/include/malformedInclude.cmake b/Tests/RunCMake/include/malformedInclude.cmake new file mode 100644 index 0000000..3cec3ad --- /dev/null +++ b/Tests/RunCMake/include/malformedInclude.cmake @@ -0,0 +1 @@ +if( diff --git a/Tests/RunCMake/pseudo_llvm-rc.c b/Tests/RunCMake/pseudo_llvm-rc.c new file mode 100644 index 0000000..7acb2a3 --- /dev/null +++ b/Tests/RunCMake/pseudo_llvm-rc.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <string.h> + +int main(int argc, char* argv[]) +{ + FILE* source; + FILE* target; + int i; + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } + } + source = fopen(argv[argc - 1], "rb"); + if (source == NULL) { + return 1; + } + target = fopen(argv[argc - 2], "wb"); + if (target != NULL) { + char buffer[500]; + size_t n = fread(buffer, 1, sizeof(buffer), source); + fwrite(buffer, 1, n, target); + fclose(source); + fclose(target); + return 0; + } + return 1; +} diff --git a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake index 8325def..bdf5810 100644 --- a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake +++ b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake @@ -7,7 +7,7 @@ endif() set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") file(MAKE_DIRECTORY "${TEST_EXE_DIR}") file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") -get_filename_component (cmake_exe "${CMAKE_COMMAND}" NAME) +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) set (ENV{PATH} "${TEST_EXE_DIR}") diff --git a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake index 07572ba..2826cc9 100644 --- a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake +++ b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake @@ -7,7 +7,7 @@ endif() set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") file(MAKE_DIRECTORY "${TEST_EXE_DIR}") file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") -get_filename_component (cmake_exe "${CMAKE_COMMAND}" NAME) +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) set (ENV{PATH} "${TEST_EXE_DIR}") diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt index 5fe6655..3195fa0 100644 --- a/Tests/RunCMake/while/EndAlone-stderr.txt +++ b/Tests/RunCMake/while/EndAlone-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at EndAlone.cmake:1 \(endwhile\): - endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE - structure. Or its arguments did not match the opening WHILE command. +^CMake Error at EndAlone\.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/EndAloneArgs-stderr.txt b/Tests/RunCMake/while/EndAloneArgs-stderr.txt index a8c043d..1634e3b 100644 --- a/Tests/RunCMake/while/EndAloneArgs-stderr.txt +++ b/Tests/RunCMake/while/EndAloneArgs-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at EndAloneArgs.cmake:1 \(endwhile\): - endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE - structure. Or its arguments did not match the opening WHILE command. +^CMake Error at EndAloneArgs\.cmake:[0-9]+ \(endwhile\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/EndMissing-stderr.txt b/Tests/RunCMake/while/EndMissing-stderr.txt index 964792f..1e3be4d 100644 --- a/Tests/RunCMake/while/EndMissing-stderr.txt +++ b/Tests/RunCMake/while/EndMissing-stderr.txt @@ -1,8 +1,4 @@ -^CMake Error in EndMissing.cmake: - A logical block opening on the line - - .*/Tests/RunCMake/while/EndMissing.cmake:1 \(while\) - - is not closed. +^CMake Error at EndMissing\.cmake:[0-9]+ \(while\): + Flow control statements are not properly nested\. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/MissingArgument-stderr.txt b/Tests/RunCMake/while/MissingArgument-stderr.txt index 7ff0971..59e8ee3 100644 --- a/Tests/RunCMake/while/MissingArgument-stderr.txt +++ b/Tests/RunCMake/while/MissingArgument-stderr.txt @@ -1,4 +1,11 @@ -^CMake Error at MissingArgument.cmake:1 \(while\): +^CMake Error at MissingArgument\.cmake:[0-9]+ \(while\): while called with incorrect number of arguments Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at MissingArgument\.cmake:[0-9]+ \(endwhile\): + endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE + structure\. Or its arguments did not match the opening WHILE command\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/while/MissingArgument.cmake b/Tests/RunCMake/while/MissingArgument.cmake index 32eaa26..3fe2d97 100644 --- a/Tests/RunCMake/while/MissingArgument.cmake +++ b/Tests/RunCMake/while/MissingArgument.cmake @@ -1 +1,2 @@ while() +endwhile() diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt deleted file mode 100644 index 8321edb..0000000 --- a/Tests/Server/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(Server CXX) - -find_package(Python REQUIRED) - -macro(do_test bsname file type) - execute_process(COMMAND ${Python_EXECUTABLE} - -B # no .pyc files - "${CMAKE_SOURCE_DIR}/${type}-test.py" - "${CMAKE_COMMAND}" - "${CMAKE_SOURCE_DIR}/${file}" - "${CMAKE_SOURCE_DIR}" - "${CMAKE_BINARY_DIR}" - "${CMAKE_GENERATOR}" - RESULT_VARIABLE test_result - ) - - if (NOT test_result EQUAL 0) - message(SEND_ERROR "TEST FAILED: ${test_result}") - endif() -endmacro() - -do_test("test_cache" "tc_cache.json" "server") -do_test("test_handshake" "tc_handshake.json" "server") -do_test("test_globalSettings" "tc_globalSettings.json" "server") -do_test("test_buildsystem1" "tc_buildsystem1.json" "server") - -add_executable(Server empty.cpp) diff --git a/Tests/Server/buildsystem1/CMakeLists.txt b/Tests/Server/buildsystem1/CMakeLists.txt deleted file mode 100644 index d690472..0000000 --- a/Tests/Server/buildsystem1/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.4) - -project(buildsystem2) - -set(var1 123) - -set(var2 345) - -add_executable(main main.cpp) - -add_executable(m_other main.cpp) - -add_library(foo foo.cpp) - -function(f1) -endfunction() - -set(var3 345) - -add_library(someImportedLib UNKNOWN IMPORTED) - -add_subdirectory(subdir) diff --git a/Tests/Server/buildsystem1/subdir/CMakeLists.txt b/Tests/Server/buildsystem1/subdir/CMakeLists.txt deleted file mode 100644 index 9157312..0000000 --- a/Tests/Server/buildsystem1/subdir/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(bar4 something) - -set(bar5 more) - -add_executable(ooo empty.cpp) diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py deleted file mode 100644 index 546ae4c..0000000 --- a/Tests/Server/cmakelib.py +++ /dev/null @@ -1,380 +0,0 @@ -from __future__ import print_function -import sys, subprocess, json, os, select, shutil, time, socket - -termwidth = 150 - -print_communication = True - -def ordered(obj): - if isinstance(obj, dict): - return sorted((k, ordered(v)) for k, v in obj.items()) - if isinstance(obj, list): - return sorted(ordered(x) for x in obj) - else: - return obj - -def col_print(title, array): - print() - print() - print(title) - - indentwidth = 4 - indent = " " * indentwidth - - if not array: - print(indent + "<None>") - return - - padwidth = 2 - - maxitemwidth = len(max(array, key=len)) - - numCols = max(1, int((termwidth - indentwidth + padwidth) / (maxitemwidth + padwidth))) - - numRows = len(array) // numCols + 1 - - pad = " " * padwidth - - for index in range(numRows): - print(indent + pad.join(item.ljust(maxitemwidth) for item in array[index::numRows])) - -filterPacket = lambda x: x - -STDIN = 0 -PIPE = 1 - -communicationMethods = [STDIN] - -if hasattr(socket, 'AF_UNIX'): - communicationMethods.append(PIPE) - -def defaultExitWithError(proc): - data = "" - try: - while select.select([proc.outPipe], [], [], 3.)[0]: - data = data + proc.outPipe.read(1) - if len(data): - print("Rest of raw buffer from server:") - printServer(data) - except: - pass - proc.outPipe.close() - proc.inPipe.close() - proc.kill() - sys.exit(1) - -exitWithError = lambda proc: defaultExitWithError(proc) - -serverTag = "SERVER" - -def printServer(*args): - print(serverTag + ">", *args) - print() - sys.stdout.flush() - -def printClient(*args): - print("CLIENT>", *args) - print() - sys.stdout.flush() - -def waitForRawMessage(cmakeCommand): - stdoutdata = "" - payload = "" - while not cmakeCommand.poll(): - stdoutdataLine = cmakeCommand.outPipe.readline() - if stdoutdataLine: - stdoutdata += stdoutdataLine.decode('utf-8') - else: - break - begin = stdoutdata.find('[== "CMake Server" ==[\n') - end = stdoutdata.find(']== "CMake Server" ==]') - - if begin != -1 and end != -1: - begin += len('[== "CMake Server" ==[\n') - payload = stdoutdata[begin:end] - jsonPayload = json.loads(payload) - filteredPayload = filterPacket(jsonPayload) - if print_communication and filteredPayload: - printServer(filteredPayload) - if filteredPayload is not None or jsonPayload is None: - return jsonPayload - stdoutdata = stdoutdata[(end+len(']== "CMake Server" ==]')):] - -# Python2 has no problem writing the output of encodes directly, -# but Python3 returns only 'int's for encode and so must be turned -# into bytes. We use the existence of 'to_bytes' on an int to -# determine which behavior is appropriate. It might be more clear -# to do this in the code which uses the flag, but introducing -# this lookup cost at every byte sent isn't ideal. -has_to_bytes = "to_bytes" in dir(10) - -def writeRawData(cmakeCommand, content): - writeRawData.counter += 1 - payload = """ -[== "CMake Server" ==[ -%s -]== "CMake Server" ==] -""" % content - - rn = ( writeRawData.counter % 2 ) == 0 - - if rn: - payload = payload.replace('\n', '\r\n') - - if print_communication: - printClient(content, "(Use \\r\\n:", rn, ")") - - # To stress test how cmake deals with fragmentation in the - # communication channel, we send only one byte at a time. - # Certain communication methods / platforms might still buffer - # it all into one message since its so close together, but in - # general this will catch places where we assume full buffers - # come in all at once. - encoded_payload = payload.encode('utf-8') - - # Python version 3+ can't write ints directly; but 'to_bytes' - # for int was only added in python 3.2. If this is a 3+ version - # of python without that conversion function; just write the whole - # thing out at once. - if sys.version_info[0] > 2 and not has_to_bytes: - cmakeCommand.write(encoded_payload) - else: - for c in encoded_payload: - if has_to_bytes: - c = c.to_bytes(1, byteorder='big') - cmakeCommand.write(c) - -writeRawData.counter = 0 - -def writePayload(cmakeCommand, obj): - writeRawData(cmakeCommand, json.dumps(obj)) - -def getPipeName(): - return "/tmp/server-test-socket" - -def attachPipe(cmakeCommand, pipeName): - time.sleep(1) - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(pipeName) - global serverTag - serverTag = "SERVER(PIPE)" - cmakeCommand.outPipe = sock.makefile() - cmakeCommand.inPipe = sock - cmakeCommand.write = cmakeCommand.inPipe.sendall - -def writeAndFlush(pipe, val): - pipe.write(val) - pipe.flush() - -def initServerProc(cmakeCommand, comm): - if comm == PIPE: - pipeName = getPipeName() - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--pipe=" + pipeName]) - attachPipe(cmakeCommand, pipeName) - else: - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--debug"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - cmakeCommand.outPipe = cmakeCommand.stdout - cmakeCommand.inPipe = cmakeCommand.stdin - cmakeCommand.write = lambda val: writeAndFlush(cmakeCommand.inPipe, val) - - packet = waitForRawMessage(cmakeCommand) - if packet == None: - print("Not in server mode") - sys.exit(2) - - if packet['type'] != 'hello': - print("No hello message") - sys.exit(3) - - return cmakeCommand - -def exitProc(cmakeCommand): - # Tell the server to exit. - cmakeCommand.stdin.close() - cmakeCommand.stdout.close() - - # Wait for the server to exit. - # If this version of python supports it, terminate the server after a timeout. - try: - cmakeCommand.wait(timeout=5) - except TypeError: - cmakeCommand.wait() - except: - cmakeCommand.terminate() - raise - -def waitForMessage(cmakeCommand, expected): - data = ordered(expected) - packet = ordered(waitForRawMessage(cmakeCommand)) - - if packet != data: - print ("Received unexpected message; test failed") - exitWithError(cmakeCommand) - return packet - -def waitForReply(cmakeCommand, originalType, cookie, skipProgress): - gotResult = False - while True: - packet = waitForRawMessage(cmakeCommand) - t = packet['type'] - if packet['cookie'] != cookie or packet['inReplyTo'] != originalType: - print("cookie or inReplyTo mismatch") - sys.exit(4) - if t == 'message' or t == 'progress': - if skipProgress: - continue - if t == 'reply': - break - print("Unrecognized message", packet) - sys.exit(5) - - return packet - -def waitForError(cmakeCommand, originalType, cookie, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'error' or packet['inReplyTo'] != originalType or packet['errorMessage'] != message: - sys.exit(6) - -def waitForProgress(cmakeCommand, originalType, cookie, current, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'progress' or packet['inReplyTo'] != originalType or packet['progressCurrent'] != current or packet['progressMessage'] != message: - sys.exit(7) - -def handshake(cmakeCommand, major, minor, source, build, generator, extraGenerator): - version = { 'major': major } - if minor >= 0: - version['minor'] = minor - - writePayload(cmakeCommand, { 'type': 'handshake', 'protocolVersion': version, - 'cookie': 'TEST_HANDSHAKE', 'sourceDirectory': source, 'buildDirectory': build, - 'generator': generator, 'extraGenerator': extraGenerator }) - waitForReply(cmakeCommand, 'handshake', 'TEST_HANDSHAKE', False) - -def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data): - packet = waitForReply(cmakeCommand, 'globalSettings', '', False) - - capabilities = packet['capabilities'] - - # validate version: - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--version" ], universal_newlines=True) - cmakeVersion = cmakeoutput.splitlines()[0][14:] - - version = capabilities['version'] - versionString = version['string'] - vs = str(version['major']) + '.' + str(version['minor']) + '.' + str(version['patch']) - if (versionString != vs and not versionString.startswith(vs + '-')): - sys.exit(8) - if (versionString != cmakeVersion): - sys.exit(9) - - # validate generators: - generatorObjects = capabilities['generators'] - - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--help" ], universal_newlines=True) - index = cmakeoutput.index('\nGenerators\n\n') - cmakeGenerators = [] - for line in cmakeoutput[index + 12:].splitlines(): - if not line: - continue - if line[0] == '*': # default generator marker - line = ' ' + line[1:] - if not line.startswith(' '): - continue - if line.startswith(' '): - continue - equalPos = line.find('=') - tmp = '' - if (equalPos > 0): - tmp = line[2:equalPos].strip() - else: - tmp = line.strip() - if tmp.endswith(" [arch]"): - tmp = tmp[0:len(tmp) - 7] - if (len(tmp) > 0) and (" - " not in tmp): - cmakeGenerators.append(tmp) - - generators = [] - for genObj in generatorObjects: - generators.append(genObj['name']) - - generators.sort() - cmakeGenerators.sort() - - for gen in cmakeGenerators: - if (not gen in generators): - sys.exit(10) - - gen = packet['generator'] - if (gen != '' and not (gen in generators)): - sys.exit(11) - - for i in data: - print("Validating", i) - if (packet[i] != data[i]): - sys.exit(12) - -def validateCache(cmakeCommand, data): - packet = waitForReply(cmakeCommand, 'cache', '', False) - - cache = packet['cache'] - - if (data['isEmpty']): - if (cache != []): - print('Expected empty cache, but got data.\n') - sys.exit(1) - return; - - if (cache == []): - print('Expected cache contents, but got none.\n') - sys.exit(1) - - hadHomeDir = False - for value in cache: - if (value['key'] == 'CMAKE_HOME_DIRECTORY'): - hadHomeDir = True - - if (not hadHomeDir): - print('No CMAKE_HOME_DIRECTORY found in cache.') - sys.exit(1) - -def handleBasicMessage(proc, obj, debug): - if 'sendRaw' in obj: - data = obj['sendRaw'] - if debug: print("Sending raw:", data) - writeRawData(proc, data) - return True - elif 'send' in obj: - data = obj['send'] - if debug: print("Sending:", json.dumps(data)) - writePayload(proc, data) - return True - elif 'recv' in obj: - data = obj['recv'] - if debug: print("Waiting for:", json.dumps(data)) - waitForMessage(proc, data) - return True - elif 'message' in obj: - print("MESSAGE:", obj["message"]) - sys.stdout.flush() - return True - return False - -def shutdownProc(proc): - # Tell the server to exit. - proc.inPipe.close() - proc.outPipe.close() - - # Wait for the server to exit. - # If this version of python supports it, terminate the server after a timeout. - try: - proc.wait(timeout=5) - except TypeError: - proc.wait() - except: - proc.terminate() - raise - - print('cmake-server exited: %d' % proc.returncode) - sys.exit(proc.returncode) diff --git a/Tests/Server/empty.cpp b/Tests/Server/empty.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/Server/empty.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py deleted file mode 100644 index 701c6e9..0000000 --- a/Tests/Server/server-test.py +++ /dev/null @@ -1,105 +0,0 @@ -from __future__ import print_function -import sys, cmakelib, json, os, shutil - -debug = True - -cmakeCommand = sys.argv[1] -testFile = sys.argv[2] -sourceDir = sys.argv[3] -buildDir = sys.argv[4] + "/" + os.path.splitext(os.path.basename(testFile))[0] -cmakeGenerator = sys.argv[5] - -print("Server Test:", testFile, - "\n-- SourceDir:", sourceDir, - "\n-- BuildDir:", buildDir, - "\n-- Generator:", cmakeGenerator) - -if os.path.exists(buildDir): - shutil.rmtree(buildDir) - -cmakelib.filterBase = sourceDir - -with open(testFile) as f: - testData = json.loads(f.read()) - -for communicationMethod in cmakelib.communicationMethods: - proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) - if proc is None: - continue - - for obj in testData: - if cmakelib.handleBasicMessage(proc, obj, debug): - pass - elif 'reply' in obj: - data = obj['reply'] - if debug: print("Waiting for reply:", json.dumps(data)) - originalType = "" - cookie = "" - skipProgress = False; - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'skipProgress' in data: skipProgress = data['skipProgress'] - cmakelib.waitForReply(proc, originalType, cookie, skipProgress) - elif 'error' in obj: - data = obj['error'] - if debug: print("Waiting for error:", json.dumps(data)) - originalType = "" - cookie = "" - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'message' in data: message = data['message'] - cmakelib.waitForError(proc, originalType, cookie, message) - elif 'progress' in obj: - data = obj['progress'] - if debug: print("Waiting for progress:", json.dumps(data)) - originalType = '' - cookie = "" - current = 0 - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'current' in data: current = data['current'] - if 'message' in data: message = data['message'] - cmakelib.waitForProgress(proc, originalType, cookie, current, message) - elif 'handshake' in obj: - data = obj['handshake'] - if debug: print("Doing handshake:", json.dumps(data)) - major = -1 - minor = -1 - generator = cmakeGenerator - extraGenerator = '' - sourceDirectory = sourceDir - buildDirectory = buildDir - if 'major' in data: major = data['major'] - if 'minor' in data: minor = data['minor'] - if 'buildDirectory' in data: buildDirectory = data['buildDirectory'] - if 'sourceDirectory' in data: sourceDirectory = data['sourceDirectory'] - if 'generator' in data: generator = data['generator'] - if 'extraGenerator' in data: extraGenerator = data['extraGenerator'] - - if not os.path.isabs(buildDirectory): - buildDirectory = buildDir + "/" + buildDirectory - if sourceDirectory != '' and not os.path.isabs(sourceDirectory): - sourceDirectory = sourceDir + "/" + sourceDirectory - cmakelib.handshake(proc, major, minor, sourceDirectory, buildDirectory, - generator, extraGenerator) - elif 'validateGlobalSettings' in obj: - data = obj['validateGlobalSettings'] - if not 'buildDirectory' in data: data['buildDirectory'] = buildDir - if not 'sourceDirectory' in data: data['sourceDirectory'] = sourceDir - if not 'generator' in data: data['generator'] = cmakeGenerator - if not 'extraGenerator' in data: data['extraGenerator'] = '' - cmakelib.validateGlobalSettings(proc, cmakeCommand, data) - elif 'validateCache' in obj: - data = obj['validateCache'] - if not 'isEmpty' in data: data['isEmpty'] = false - cmakelib.validateCache(proc, data) - elif 'reconnect' in obj: - cmakelib.exitProc(proc) - proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) - else: - print("Unknown command:", json.dumps(obj)) - sys.exit(2) - cmakelib.shutdownProc(proc) - print("Completed") diff --git a/Tests/Server/tc_buildsystem1.json b/Tests/Server/tc_buildsystem1.json deleted file mode 100644 index 08831b7..0000000 --- a/Tests/Server/tc_buildsystem1.json +++ /dev/null @@ -1,27 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1, "sourceDirectory":"buildsystem1","buildDirectory":"buildsystem1"} }, - -{ "message": "Configure:" }, -{ "send": { "type": "configure", "cookie":"CONFIG" } }, -{ "reply": { "type": "configure", "cookie":"CONFIG", "skipProgress":true } }, - -{ "message": "Compute:" }, -{ "send": { "type": "compute", "cookie":"COMPUTE" } }, -{ "reply": { "type": "compute", "cookie":"COMPUTE", "skipProgress":true } }, - -{ "message": "Codemodel:" }, -{ "send": { "type": "codemodel", "cookie":"CODEMODEL" } }, -{ "reply": { "type": "codemodel", "cookie":"CODEMODEL" } }, - -{ "message": "CMake Inputs:"}, -{ "send": { "type": "cmakeInputs", "cookie":"INPUTS" } }, -{ "reply": { "type": "cmakeInputs", "cookie":"INPUTS" } }, - -{ "message": "Cache:"}, -{ "send": { "type": "cache", "cookie":"CACHE" } }, -{ "reply": { "type": "cache", "cookie":"CACHE" } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_cache.json b/Tests/Server/tc_cache.json deleted file mode 100644 index 74af6d9..0000000 --- a/Tests/Server/tc_cache.json +++ /dev/null @@ -1,24 +0,0 @@ -[ -{ "message": "Testing cache" }, - -{ "message": "Cache after first handshake is empty:" }, -{ "handshake": {"major": 1, "sourceDirectory": "buildsystem1", "buildDirectory": "buildsystem1"} }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": true } }, - -{ "message": "Cache after configure is populated:" }, -{ "send": { "type": "configure" } }, -{ "reply": { "type": "configure", "skipProgress":true } }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Handshake for existing cache requires buildDirectory only:" }, -{ "reconnect": {} }, -{ "handshake": {"major": 1, "sourceDirectory": "", "buildDirectory": "buildsystem1"} }, - -{ "message": "Cache after reconnect is again populated:" }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_globalSettings.json b/Tests/Server/tc_globalSettings.json deleted file mode 100644 index d72fb41..0000000 --- a/Tests/Server/tc_globalSettings.json +++ /dev/null @@ -1,140 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1} }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "message": "Change settings:" }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": true, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": true, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": true, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "send": { "type": "setGlobalSettings", "trace": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": true, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "trace": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": false, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": true } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Ignore unknown/readonly" }, - -{ "send": { "type": "setGlobalSettings", "unknownKey": "unknownValue", "extraGenerator": "XXX", "generator": "YYY", "sourceDirectory": "/tmp/source", "buildDirectory": "/tmp/build" } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Error paths:" }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "warnUnused": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnused\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"debugOutput\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": 1, "warnUnused": true, "debugOutput": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUninitialized\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "traceExpand": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"traceExpand\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "trace": 1, "warnUnused": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"trace\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUnusedCli": 1.0 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnusedCli\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "checkSystemVars": "some string" } }, -{ "error": { "type": "setGlobalSettings", "message": "\"checkSystemVars\" must be unset or a bool value." } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_handshake.json b/Tests/Server/tc_handshake.json deleted file mode 100644 index 4bb7fa7..0000000 --- a/Tests/Server/tc_handshake.json +++ /dev/null @@ -1,75 +0,0 @@ -[ -{ "message": "Testing basic message handling:" }, - -{ "sendRaw": "Sometext"}, -{ "recv": {"cookie":"","errorMessage":"Failed to parse JSON input.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing invalid json input"}, -{ "send": { "test": "sometext" } }, -{ "recv": {"cookie":"","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "send": {"test": "sometext","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing commands before handshake" }, -{ "send": {"type": "cache","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"cache","type":"error"} }, - -{ "message": "Testing handshake" }, -{ "send": {"type": "sometype","cookie":"monster2"} }, -{ "recv": {"cookie":"monster2","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"sometype","type":"error"} }, - -{ "send": {"type": "handshake"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","foo":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" must be a JSON object.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be unset or an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":-1, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be >= 0.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be >= 0 when set.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1}} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "message": "Testing protocol version specific options (1.0):" }, -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src","buildDirectory":"/tmp/build"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"sourceDirectory\" is not a directory."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"generator\" is unset but required."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"XXXX","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Generator \"XXXX\" not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"XXXX"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: The combination of generator \"Ninja\" and extra generator \"XXXX\" is not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} }, - -{ "message": "Everything ok." } -] diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index 9de4fc6..3eb9185 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -15,3 +15,11 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU add_library(stay stay_c.c stay_cxx.cxx) set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP") endif() + +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) + cmake_policy(SET CMP0119 NEW) + add_library(zoom zoom.zzz) + set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX) + target_link_libraries(SetLang zoom) + target_compile_definitions(SetLang PRIVATE WITH_ZOOM) +endif() diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index b934356..515e8c2 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -1,10 +1,22 @@ #include <stdio.h> int foo(); + +#ifdef WITH_ZOOM +int zoom(); +#endif + class A { public: - A() { this->i = foo(); } + A() + { + this->i = foo(); +#ifdef WITH_ZOOM + i += zoom(); + i -= zoom(); +#endif + } int i; }; diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz new file mode 100644 index 0000000..a0c8899 --- /dev/null +++ b/Tests/SetLang/zoom.zzz @@ -0,0 +1,7 @@ +int zoom() +{ + int r = 10; + r++; + int ret = r + 10; + return ret; +} diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index 5bf13f3..a880f7a 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeDeveloperReference_STANDALONE 1) - cmake_minimum_required(VERSION 3.1...3.15 FATAL_ERROR) + cmake_minimum_required(VERSION 3.1...3.18 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index e5be43a..f989907 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeHelp_STANDALONE 1) - cmake_minimum_required(VERSION 3.1...3.15 FATAL_ERROR) + cmake_minimum_required(VERSION 3.1...3.18 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/Sphinx/static/cmake.css b/Utilities/Sphinx/static/cmake.css index b082ede..029eb1b 100644 --- a/Utilities/Sphinx/static/cmake.css +++ b/Utilities/Sphinx/static/cmake.css @@ -16,3 +16,9 @@ div.sphinxsidebarwrapper { .literal-block a.reference.internal { background-color: #dfdfdf; } + +/* Remove unwanted margin in case list item contains a div-wrapping + directive like `.. versionadded` or `.. deprecated`. */ +dd > :first-child > p { + margin-top: 0px; +} diff --git a/Utilities/std/cm/optional b/Utilities/std/cm/optional index 9a5d840..0defae1 100644 --- a/Utilities/std/cm/optional +++ b/Utilities/std/cm/optional @@ -68,16 +68,22 @@ public: optional& operator=(nullopt_t) noexcept; optional& operator=(const optional& other); - optional& operator=(optional&& other) noexcept; - template < - typename U = T, - typename = typename std::enable_if< - !std::is_same<typename std::decay<U>::type, cm::optional<T>>::value && - std::is_constructible<T, U>::value && std::is_assignable<T&, U>::value && + template <typename U = T> + typename std::enable_if<std::is_constructible<T, U&&>::value && + std::is_assignable<T&, U&&>::value, + optional&>::type + operator=(optional<U>&& other) noexcept; + + template <typename U = T> + typename std::enable_if< + !std::is_same<typename std::decay<U>::type, cm::optional<T>>::value && + std::is_constructible<T, U&&>::value && + std::is_assignable<T&, U&&>::value && (!std::is_scalar<T>::value || - !std::is_same<typename std::decay<U>::type, T>::value)>::type> - optional& operator=(U&& v); + !std::is_same<typename std::decay<U>::type, T>::value), + optional&>::type + operator=(U&& v); const T* operator->() const; T* operator->(); @@ -134,19 +140,24 @@ optional<T> make_optional(Args&&... args) template <typename T> optional<T>::optional(nullopt_t) noexcept + : optional() { } template <typename T> optional<T>::optional(const optional& other) { - *this = other; + if (other.has_value()) { + this->emplace(*other); + } } template <typename T> optional<T>::optional(optional&& other) noexcept { - *this = std::move(other); + if (other.has_value()) { + this->emplace(std::move(*other)); + } } template <typename T> @@ -192,7 +203,11 @@ optional<T>& optional<T>::operator=(const optional& other) } template <typename T> -optional<T>& optional<T>::operator=(optional&& other) noexcept +template <typename U> +typename std::enable_if<std::is_constructible<T, U&&>::value && + std::is_assignable<T&, U&&>::value, + optional<T>&>::type +optional<T>::operator=(optional<U>&& other) noexcept { if (other.has_value()) { if (this->has_value()) { @@ -207,8 +222,15 @@ optional<T>& optional<T>::operator=(optional&& other) noexcept } template <typename T> -template <typename U, typename> -optional<T>& optional<T>::operator=(U&& v) +template <typename U> +typename std::enable_if< + !std::is_same<typename std::decay<U>::type, cm::optional<T>>::value && + std::is_constructible<T, U&&>::value && + std::is_assignable<T&, U&&>::value && + (!std::is_scalar<T>::value || + !std::is_same<typename std::decay<U>::type, T>::value), + optional<T>&>::type +optional<T>::operator=(U&& v) { if (this->has_value()) { this->value() = v; @@ -289,6 +289,7 @@ CMAKE_CXX_SOURCES="\ cmBuildCommand \ cmCMakeMinimumRequired \ cmCMakePath \ + cmCMakePathCommand \ cmCMakePolicyCommand \ cmCPackPropertiesGenerator \ cmCacheManager \ @@ -307,6 +308,7 @@ CMAKE_CXX_SOURCES="\ cmContinueCommand \ cmCoreTryCompile \ cmCreateTestSourceList \ + cmCryptoHash \ cmCustomCommand \ cmCustomCommandGenerator \ cmCustomCommandLines \ @@ -412,6 +414,8 @@ CMAKE_CXX_SOURCES="\ cmProjectCommand \ cmPropertyDefinition \ cmPropertyMap \ + cmGccDepfileLexerHelper \ + cmGccDepfileReader \ cmReturnCommand \ cmRulePlaceholderExpander \ cmRuntimeDependencyArchive \ @@ -452,6 +456,7 @@ CMAKE_CXX_SOURCES="\ cmTest \ cmTestGenerator \ cmTimestamp \ + cmTransformDepfile \ cmTryCompileCommand \ cmTryRunCommand \ cmUnsetCommand \ @@ -491,6 +496,7 @@ LexerParser_CXX_SOURCES="\ cmCommandArgumentParser \ cmExprLexer \ cmExprParser \ + cmGccDepfileLexer \ " LexerParser_C_SOURCES="\ @@ -535,6 +541,18 @@ KWSYS_FILES="\ SystemTools.hxx \ Terminal.h" +LIBRHASH_C_SOURCES="\ + librhash/algorithms.c \ + librhash/byte_order.c \ + librhash/hex.c \ + librhash/md5.c \ + librhash/rhash.c \ + librhash/sha1.c \ + librhash/sha256.c \ + librhash/sha3.c \ + librhash/sha512.c \ + " + if ${cmake_system_mingw}; then LIBUV_C_SOURCES="\ src/fs-poll.c \ @@ -1012,7 +1030,6 @@ cmake_ld_flags=${LDFLAGS} # Add generator-specific files if test "${cmake_bootstrap_generator}" = "Ninja"; then CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES} \ - cmCryptoHash \ cmFortranParserImpl \ cmGlobalNinjaGenerator \ cmLocalNinjaGenerator \ @@ -1033,32 +1050,21 @@ if test "${cmake_bootstrap_generator}" = "Ninja"; then src/lib_json/json_value.cpp \ src/lib_json/json_writer.cpp \ " - - LIBRHASH_C_SOURCES="\ - librhash/algorithms.c \ - librhash/byte_order.c \ - librhash/hex.c \ - librhash/md5.c \ - librhash/rhash.c \ - librhash/sha1.c \ - librhash/sha256.c \ - librhash/sha3.c \ - librhash/sha512.c \ - " else CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES} \ cmDepends \ cmDependsC \ + cmDependsCompiler \ cmGlobalUnixMakefileGenerator3 \ cmLocalUnixMakefileGenerator3 \ cmMakefileExecutableTargetGenerator \ cmMakefileLibraryTargetGenerator \ cmMakefileTargetGenerator \ cmMakefileUtilityTargetGenerator \ + cmProcessTools \ " JSONCPP_CXX_SOURCES= - LIBRHASH_C_SOURCES= fi # Add Cygwin-specific flags @@ -1628,17 +1634,17 @@ if test "x${bootstrap_system_libuv}" = "x"; then objs="${objs} uv-`cmake_obj ${a}`" done fi +if test "x${bootstrap_system_librhash}" = "x"; then + for a in ${LIBRHASH_C_SOURCES}; do + objs="${objs} rhash-`cmake_obj ${a}`" + done +fi if test "${cmake_bootstrap_generator}" = "Ninja"; then if test "x${bootstrap_system_jsoncpp}" = "x"; then for a in ${JSONCPP_CXX_SOURCES}; do objs="${objs} jsoncpp-`cmake_obj ${a}`" done fi - if test "x${bootstrap_system_librhash}" = "x"; then - for a in ${LIBRHASH_C_SOURCES}; do - objs="${objs} rhash-`cmake_obj ${a}`" - done - fi fi libs="" @@ -1698,6 +1704,15 @@ else libs="${libs} -luv" fi +if test "x${bootstrap_system_librhash}" != "x"; then + if test `which pkg-config`; then + use_librhash_flags="`pkg-config --cflags librhash`" + cmake_c_flags="${cmake_c_flags} ${use_librhash_flags}" + cmake_cxx_flags="${cmake_cxx_flags} ${use_librhash_flags}" + fi + libs="${libs} -lrhash" +fi + if test "${cmake_bootstrap_generator}" = "Ninja"; then jsoncpp_cxx_flags= if test "x${bootstrap_system_jsoncpp}" = "x"; then @@ -1709,15 +1724,6 @@ if test "${cmake_bootstrap_generator}" = "Ninja"; then fi libs="${libs} -ljsoncpp" fi - - if test "x${bootstrap_system_librhash}" != "x"; then - if test `which pkg-config`; then - use_librhash_flags="`pkg-config --cflags librhash`" - cmake_c_flags="${cmake_c_flags} ${use_librhash_flags}" - cmake_cxx_flags="${cmake_cxx_flags} ${use_librhash_flags}" - fi - libs="${libs} -lrhash" - fi fi if test "x${cmake_ansi_cxx_flags}" != "x"; then @@ -1841,6 +1847,12 @@ if test "x${bootstrap_system_libuv}" = "x"; then write_source_rule "c" "uv-`cmake_obj ${a}`" "${src}" "${uv_c_flags}" done fi +if test "x${bootstrap_system_librhash}" = "x"; then + for a in ${LIBRHASH_C_SOURCES}; do + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmlibrhash/${a}"` + write_source_rule "c" "rhash-`cmake_obj ${a}`" "${src}" "" + done +fi if test "${cmake_bootstrap_generator}" = "Ninja"; then if test "x${bootstrap_system_jsoncpp}" = "x"; then for a in ${JSONCPP_CXX_SOURCES}; do @@ -1848,12 +1860,6 @@ if test "${cmake_bootstrap_generator}" = "Ninja"; then write_source_rule "cxx" "jsoncpp-`cmake_obj ${a}`" "${src}" "${jsoncpp_cxx_flags}" done fi - if test "x${bootstrap_system_librhash}" = "x"; then - for a in ${LIBRHASH_C_SOURCES}; do - src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmlibrhash/${a}"` - write_source_rule "c" "rhash-`cmake_obj ${a}`" "${src}" "" - done - fi fi if test "${cmake_bootstrap_generator}" = "Ninja"; then echo " |