diff options
115 files changed, 960 insertions, 576 deletions
diff --git a/.clang-tidy b/.clang-tidy index a6e2597..8d79b0c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,11 +10,13 @@ modernize-*,\ -modernize-deprecated-headers,\ -modernize-pass-by-value,\ -modernize-raw-string-literal,\ +-modernize-return-braced-init-list,\ -modernize-use-auto,\ -modernize-use-default-member-init,\ -modernize-use-emplace,\ -modernize-use-equals-default,\ -modernize-use-equals-delete,\ +-modernize-use-noexcept,\ -modernize-use-transparent-functors,\ -modernize-use-using,\ performance-*,\ diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index f6a73c3..5f9af05 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -38,7 +38,7 @@ syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeCommand,cmakeCo syn case match syn keyword cmakeProperty contained - \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST + \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_SHADER_OUTPUT_HEADER_FILE VS_SHADER_VARIABLE_NAME VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST syn keyword cmakeVariable contained \ ANDROID APPLE BORLAND BUILD_SHARED_LIBS CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ARCH_ABI CMAKE_ANDROID_ARM_MODE CMAKE_ANDROID_ARM_NEON CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_DEPRECATED_HEADERS CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STANDALONE_TOOLCHAIN CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_DEPEND_FILTERS CMAKE_AUTOMOC_MACRO_NAMES CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_AUTOUIC_SEARCH_PATHS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_RPATH CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_NAME_DIR CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_CODELITE_USE_TARGETS CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNUCC CMAKE_COMPILER_IS_GNUCXX CMAKE_COMPILER_IS_GNUG77 CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CUDA_EXTENSIONS CMAKE_CUDA_STANDARD CMAKE_CUDA_STANDARD_REQUIRED CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DEPENDS_IN_PROJECT_ONLY CMAKE_DIRECTORY_LABELS CMAKE_DL_LIBS CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT CMAKE_ECLIPSE_MAKE_ARGUMENTS CMAKE_ECLIPSE_VERSION CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_INIT CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_SORT_DIRECTION CMAKE_FIND_PACKAGE_SORT_ORDER CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SOLARIS CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_LINK_WHAT_YOU_USE CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_INIT CMAKE_MODULE_PATH CMAKE_MSVCIDE_RUN_PATH CMAKE_NINJA_OUTPUT_PATH_PREFIX CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_DESCRIPTION CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_INIT CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_INIT CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE CMAKE_SYSROOT CMAKE_SYSROOT_COMPILE CMAKE_SYSROOT_LINK CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_Swift_LANGUAGE_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_TRY_COMPILE_TARGET_TYPE CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_CUDA CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_GENERATE_SCHEME CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_INIT_SUBMODULES CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_LABELS_FOR_SUBPROJECTS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_DESCRIPTION PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE XCODE_VERSION diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index a0aacb4..dc9f0ba 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -245,5 +245,23 @@ configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in" "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake") +set(CPACK_SOURCE_IGNORE_FILES + # Files specific to version control. + "/\\\\.git/" + "/\\\\.gitattributes$" + "/\\\\.github/" + "/\\\\.gitignore$" + "/\\\\.hooks-config$" + + # Cygwin package build. + "/\\\\.build/" + + # Temporary files. + "\\\\.swp$" + "\\\\.#" + "/#" + "~$" + ) + # include CPack model once all variables are set include(CPack) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index ad0c245..a08c97d 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -208,12 +208,6 @@ if(CPACK_GENERATOR MATCHES "IFW") endif() -if(CPACK_GENERATOR MATCHES "CygwinSource") - # when packaging source make sure the .build directory is not included - set(CPACK_SOURCE_IGNORE_FILES - "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$") -endif() - if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") if(CMAKE_PACKAGE_QTGUI) set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications") diff --git a/CMakeLists.txt b/CMakeLists.txt index c578ec3..f14f62f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,6 +250,12 @@ if(CMake_RUN_CLANG_TIDY) message(FATAL_ERROR "CMake_RUN_CLANG_TIDY is ON but clang-tidy is not found!") endif() set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") + + # provide definitions for targets that require a rebuild once .clang-tidy changes + file(SHA1 ${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy clang_tidy_sha1) + set(CLANG_TIDY_DEFINITIONS "CLANG_TIDY_SHA1=${clang_tidy_sha1}") + unset(clang_tidy_sha1) + endif() configure_file(.clang-tidy .clang-tidy COPYONLY) diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 96fc4a7..d0c19eb 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -30,14 +30,6 @@ building on older toolchains some constructs need to be handled with care: The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``. -* Use ``CM_EQ_DELETE;`` instead of ``= delete;``. - - Older C++11 compilers do not support deleting functions. Using - ``CM_EQ_DELETE`` will delete the functions if the compiler supports it and - give them no implementation otherwise. Calling such a function will lead - to compiler errors if the compiler supports *deleted* functions and linker - errors otherwise. - * Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable. The ``CM_DISABLE_COPY`` macro should be used in the private section of a diff --git a/Help/envvar/ASM_DIALECT.rst b/Help/envvar/ASM_DIALECT.rst new file mode 100644 index 0000000..ec48f71 --- /dev/null +++ b/Help/envvar/ASM_DIALECT.rst @@ -0,0 +1,11 @@ +ASM<DIALECT> +------------ + +Preferred executable for compiling a specific dialect of assembly language +files. ``ASM<DIALECT>`` can be ``ASM``, ``ASM_NASM``, ``ASM_MASM`` or +``ASM-ATT``. Will only be used by CMake on the first configuration to determine +``ASM<DIALECT>`` compiler, after which the value for ``ASM<DIALECT>`` is stored +in the cache as +:variable:`CMAKE_ASM<DIALECT>_COMPILER <CMAKE_<LANG>_COMPILER>`. For subsequent +configuration runs, the environment variable will be ignored in favor of +:variable:`CMAKE_ASM<DIALECT>_COMPILER <CMAKE_<LANG>_COMPILER>`. diff --git a/Help/envvar/ASM_DIALECTFLAGS.rst b/Help/envvar/ASM_DIALECTFLAGS.rst new file mode 100644 index 0000000..4ed02fe --- /dev/null +++ b/Help/envvar/ASM_DIALECTFLAGS.rst @@ -0,0 +1,11 @@ +ASM<DIALECT>FLAGS +----------------- + +Default compilation flags to be used when compiling a specific dialect of an +assembly language. ``ASM<DIALECT>FLAGS`` can be ``ASMFLAGS``, ``ASM_NASMFLAGS``, +``ASM_MASMFLAGS`` or ``ASM-ATTFLAGS``. Will only be used by CMake on the +first configuration to determine ``ASM<DIALECT>`` default compilation flags, after +which the value for ``ASM<DIALECT>FLAGS`` is stored in the cache as +:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration +run (including the first), the environment variable will be ignored if the +:variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/CC.rst b/Help/envvar/CC.rst new file mode 100644 index 0000000..7e68110 --- /dev/null +++ b/Help/envvar/CC.rst @@ -0,0 +1,9 @@ +CC +-- + +Preferred executable for compiling ``C`` language files. Will only be used by +CMake on the first configuration to determine ``C`` compiler, after which the +value for ``CC`` is stored in the cache as +:variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration run +(including the first), the environment variable will be ignored if the +:variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined. diff --git a/Help/envvar/CFLAGS.rst b/Help/envvar/CFLAGS.rst new file mode 100644 index 0000000..60b2cd3 --- /dev/null +++ b/Help/envvar/CFLAGS.rst @@ -0,0 +1,9 @@ +CFLAGS +------ + +Default compilation flags to be used when compiling ``C`` files. Will only be +used by CMake on the first configuration to determine ``CC`` default compilation +flags, after which the value for ``CFLAGS`` is stored in the cache +as :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run +(including the first), the environment variable will be ignored if the +:variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/CMAKE_CONFIG_TYPE.rst b/Help/envvar/CMAKE_CONFIG_TYPE.rst new file mode 100644 index 0000000..1306b47 --- /dev/null +++ b/Help/envvar/CMAKE_CONFIG_TYPE.rst @@ -0,0 +1,5 @@ +CMAKE_CONFIG_TYPE +----------------- + +The default build configuration for :ref:`Build Tool Mode` and +``ctest`` build handler when there is no explicit configuration given. diff --git a/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst b/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst new file mode 100644 index 0000000..54d5f9e --- /dev/null +++ b/Help/envvar/CMAKE_MSVCIDE_RUN_PATH.rst @@ -0,0 +1,8 @@ +CMAKE_MSVCIDE_RUN_PATH +---------------------- + +Extra PATH locations for custom commands when using +:generator:`Visual Studio 9 2008` (or above) generators. + +The ``CMAKE_MSVCIDE_RUN_PATH`` environment variable sets the default value for +the :variable:`CMAKE_MSVCIDE_RUN_PATH` variable if not already explicitly set. diff --git a/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst b/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst new file mode 100644 index 0000000..8bbf993 --- /dev/null +++ b/Help/envvar/CMAKE_OSX_ARCHITECTURES.rst @@ -0,0 +1,8 @@ +CMAKE_OSX_ARCHITECTURES +----------------------- + +Target specific architectures for OS X. + +The ``CMAKE_OSX_ARCHITECTURES`` environment variable sets the default value for +the :variable:`CMAKE_OSX_ARCHITECTURES` variable. See +:prop_tgt:`OSX_ARCHITECTURES` for more information. diff --git a/Help/envvar/CSFLAGS.rst b/Help/envvar/CSFLAGS.rst new file mode 100644 index 0000000..251ddc5 --- /dev/null +++ b/Help/envvar/CSFLAGS.rst @@ -0,0 +1,9 @@ +CSFLAGS +------- + +Preferred executable for compiling ``CSharp`` language files. Will only be +used by CMake on the first configuration to determine ``CSharp`` default +compilation flags, after which the value for ``CSFLAGS`` is stored in the cache +as :variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration +run (including the first), the environment variable will be ignored if the +:variable:`CMAKE_CSharp_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst new file mode 100644 index 0000000..25ed14f --- /dev/null +++ b/Help/envvar/CTEST_INTERACTIVE_DEBUG_MODE.rst @@ -0,0 +1,5 @@ +CTEST_INTERACTIVE_DEBUG_MODE +---------------------------- + +Environment variable that will exist and be set to ``1`` when a test executed +by CTest is run in interactive mode. diff --git a/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst new file mode 100644 index 0000000..1fcf42b --- /dev/null +++ b/Help/envvar/CTEST_OUTPUT_ON_FAILURE.rst @@ -0,0 +1,7 @@ +CTEST_OUTPUT_ON_FAILURE +----------------------- + +Boolean environment variable that controls if the output should be logged for +failed tests. Set the value to 1, True, or ON to enable output on failure. +See :manual:`ctest(1)` for more information on controlling output of failed +tests. diff --git a/Help/envvar/CTEST_PARALLEL_LEVEL.rst b/Help/envvar/CTEST_PARALLEL_LEVEL.rst new file mode 100644 index 0000000..c767a01 --- /dev/null +++ b/Help/envvar/CTEST_PARALLEL_LEVEL.rst @@ -0,0 +1,5 @@ +CTEST_PARALLEL_LEVEL +-------------------- + +Specify the number of tests for CTest to run in parallel. See :manual:`ctest(1)` +for more information on parallel test execution. diff --git a/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst b/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst new file mode 100644 index 0000000..8d8eea5 --- /dev/null +++ b/Help/envvar/CTEST_USE_LAUNCHERS_DEFAULT.rst @@ -0,0 +1,4 @@ +CTEST_USE_LAUNCHERS_DEFAULT +--------------------------- + +Initializes the :variable:`CTEST_USE_LAUNCHERS` variable if not already defined. diff --git a/Help/envvar/CUDACXX.rst b/Help/envvar/CUDACXX.rst new file mode 100644 index 0000000..8a5fd4b --- /dev/null +++ b/Help/envvar/CUDACXX.rst @@ -0,0 +1,9 @@ +CUDACXX +------- + +Preferred executable for compiling ``CUDA`` language files. Will only be used by +CMake on the first configuration to determine ``CUDA`` compiler, after which the +value for ``CUDA`` is stored in the cache as +:variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration +run (including the first), the environment variable will be ignored if the +:variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined. diff --git a/Help/envvar/CUDAFLAGS.rst b/Help/envvar/CUDAFLAGS.rst new file mode 100644 index 0000000..3dff49f --- /dev/null +++ b/Help/envvar/CUDAFLAGS.rst @@ -0,0 +1,9 @@ +CUDAFLAGS +--------- + +Default compilation flags to be used when compiling ``CUDA`` files. Will only be +used by CMake on the first configuration to determine ``CUDA`` default +compilation flags, after which the value for ``CUDAFLAGS`` is stored in the +cache as :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration +run (including the first), the environment variable will be ignored if +the :variable:`CMAKE_CUDA_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/CUDAHOSTCXX.rst b/Help/envvar/CUDAHOSTCXX.rst new file mode 100644 index 0000000..f0f94f6 --- /dev/null +++ b/Help/envvar/CUDAHOSTCXX.rst @@ -0,0 +1,9 @@ +CUDAHOSTCXX +----------- + +Preferred executable for compiling host code when compiling ``CUDA`` +language files. Will only be used by CMake on the first configuration to +determine ``CUDA`` host compiler, after which the value for ``CUDAHOSTCXX`` is +stored in the cache as :variable:`CMAKE_CUDA_HOST_COMPILER`. For any +configuration run (including the first), the environment variable will be +ignored if the :variable:`CMAKE_CUDA_HOST_COMPILER` variable is defined. diff --git a/Help/envvar/CXX.rst b/Help/envvar/CXX.rst new file mode 100644 index 0000000..3b1e445 --- /dev/null +++ b/Help/envvar/CXX.rst @@ -0,0 +1,9 @@ +CXX +--- + +Preferred executable for compiling ``CXX`` language files. Will only be used by +CMake on the first configuration to determine ``CXX`` compiler, after which the +value for ``CXX`` is stored in the cache as +:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration +run (including the first), the environment variable will be ignored if the +:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined. diff --git a/Help/envvar/CXXFLAGS.rst b/Help/envvar/CXXFLAGS.rst new file mode 100644 index 0000000..8b58abd --- /dev/null +++ b/Help/envvar/CXXFLAGS.rst @@ -0,0 +1,9 @@ +CXXFLAGS +-------- + +Default compilation flags to be used when compiling ``CXX`` (C++) files. Will +only be used by CMake on the first configuration to determine ``CXX`` default +compilation flags, after which the value for ``CXXFLAGS`` is stored in the cache +as :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration run ( +including the first), the environment variable will be ignored if +the :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst new file mode 100644 index 0000000..fab1c0c --- /dev/null +++ b/Help/envvar/DASHBOARD_TEST_FROM_CTEST.rst @@ -0,0 +1,5 @@ +DASHBOARD_TEST_FROM_CTEST +------------------------- + +Environment variable that will exist when a test executed by CTest is run +in non-interactive mode. The value will be equal to :variable:`CMAKE_VERSION`. diff --git a/Help/envvar/FC.rst b/Help/envvar/FC.rst new file mode 100644 index 0000000..7d293fd --- /dev/null +++ b/Help/envvar/FC.rst @@ -0,0 +1,10 @@ +FC +-- + +Preferred executable for compiling ``Fortran`` language files. Will only be used +by CMake on the first configuration to determine ``Fortran`` compiler, after +which the value for ``Fortran`` is stored in the cache as +:variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>`. For any +configuration run (including the first), the environment variable will be +ignored if the :variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>` +variable is defined. diff --git a/Help/envvar/FFLAGS.rst b/Help/envvar/FFLAGS.rst new file mode 100644 index 0000000..19d6169 --- /dev/null +++ b/Help/envvar/FFLAGS.rst @@ -0,0 +1,9 @@ +FFLAGS +------ + +Default compilation flags to be used when compiling ``Fortran`` files. Will only +be used by CMake on the first configuration to determine ``Fortran`` default +compilation flags, after which the value for ``FFLAGS`` is stored in the cache +as :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration +run (including the first), the environment variable will be ignored if +the :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/envvar/LDFLAGS.rst b/Help/envvar/LDFLAGS.rst new file mode 100644 index 0000000..52da99c --- /dev/null +++ b/Help/envvar/LDFLAGS.rst @@ -0,0 +1,10 @@ +LDFLAGS +------- + +Will only be used by CMake on the first configuration to determine the default +linker flags, after which the value for ``LDFLAGS`` is stored in the cache +as :variable:`CMAKE_EXE_LINKER_FLAGS_INIT`, +:variable:`CMAKE_SHARED_LINKER_FLAGS_INIT`, and +:variable:`CMAKE_MODULE_LINKER_FLAGS_INIT`. For any configuration run +(including the first), the environment variable will be ignored if the +equivalent ``CMAKE_<TYPE>_LINKER_FLAGS_INIT`` variable is defined. diff --git a/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst b/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst new file mode 100644 index 0000000..e6051b4 --- /dev/null +++ b/Help/envvar/MACOSX_DEPLOYMENT_TARGET.rst @@ -0,0 +1,8 @@ +MACOSX_DEPLOYMENT_TARGET +------------------------ + +Specify the minimum version of OS X on which the target binaries are +to be deployed. + +The ``MACOSX_DEPLOYMENT_TARGET`` environment variable sets the default value for +the :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` variable. diff --git a/Help/envvar/RC.rst b/Help/envvar/RC.rst new file mode 100644 index 0000000..6c2db19 --- /dev/null +++ b/Help/envvar/RC.rst @@ -0,0 +1,9 @@ +RC +-- + +Preferred executable for compiling ``resource`` files. Will only be used by CMake +on the first configuration to determine ``resource`` compiler, after which the +value for ``RC`` is stored in the cache as +:variable:`CMAKE_RC_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration run +(including the first), the environment variable will be ignored if the +:variable:`CMAKE_RC_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined. diff --git a/Help/envvar/RCFLAGS.rst b/Help/envvar/RCFLAGS.rst new file mode 100644 index 0000000..4f2f31c --- /dev/null +++ b/Help/envvar/RCFLAGS.rst @@ -0,0 +1,9 @@ +RCFLAGS +------- + +Default compilation flags to be used when compiling ``resource`` files. Will +only be used by CMake on the first configuration to determine ``resource`` +default compilation flags, after which the value for ``RCFLAGS`` is stored in +the cache as :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>`. For any +configuration run (including the first), the environment variable will be ignored +if the :variable:`CMAKE_RC_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined. diff --git a/Help/index.rst b/Help/index.rst index 97cd107..3dccdda 100644 --- a/Help/index.rst +++ b/Help/index.rst @@ -40,6 +40,7 @@ Reference Manuals /manual/cmake-qt.7 /manual/cmake-toolchains.7 /manual/cmake-variables.7 + /manual/cmake-env-variables.7 .. only:: html or text diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst new file mode 100644 index 0000000..fed129e --- /dev/null +++ b/Help/manual/cmake-env-variables.7.rst @@ -0,0 +1,54 @@ +.. cmake-manual-description: CMake Environment Variables Reference + +cmake-env-variables(7) +********************** + +.. only:: html + + .. contents:: + +Environment Variables that Control the Build +============================================ + +.. toctree:: + :maxdepth: 1 + + /envvar/CMAKE_CONFIG_TYPE + /envvar/CMAKE_MSVCIDE_RUN_PATH + /envvar/CMAKE_OSX_ARCHITECTURES + /envvar/LDFLAGS + /envvar/MACOSX_DEPLOYMENT_TARGET + +Environment Variables for Languages +=================================== + +.. toctree:: + :maxdepth: 1 + + /envvar/ASM_DIALECT + /envvar/ASM_DIALECTFLAGS + /envvar/CC + /envvar/CFLAGS + /envvar/CSFLAGS + /envvar/CUDACXX + /envvar/CUDAFLAGS + /envvar/CUDAHOSTCXX + /envvar/CXX + /envvar/CXXFLAGS + /envvar/FC + /envvar/FFLAGS + /envvar/RC + /envvar/RCFLAGS + +Environment Variables for CTest +=============================== + +.. toctree:: + :maxdepth: 1 + + /envvar/CMAKE_CONFIG_TYPE + /envvar/CTEST_INTERACTIVE_DEBUG_MODE + /envvar/CTEST_OUTPUT_ON_FAILURE + /envvar/CTEST_PARALLEL_LEVEL + /envvar/CTEST_USE_LAUNCHERS_DEFAULT + /envvar/DASHBOARD_TEST_FROM_CTEST diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index eadd00d..0adfff6 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -392,7 +392,9 @@ Properties on Source Files /prop_sf/VS_SHADER_ENTRYPOINT /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL + /prop_sf/VS_SHADER_OUTPUT_HEADER_FILE /prop_sf/VS_SHADER_TYPE + /prop_sf/VS_SHADER_VARIABLE_NAME /prop_sf/VS_TOOL_OVERRIDE.rst /prop_sf/VS_XAML_TYPE /prop_sf/WRAP_EXCLUDE diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index 79e7e79..cafeae1 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -59,9 +59,10 @@ The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)` inspects the C++ files in the target to determine if they require ``moc`` to be run, and to create rules to execute ``moc`` at the appropriate time. -If a ``Q_OBJECT`` or ``Q_GADGET`` macro is found in a header file, ``moc`` -will be run on the file. The result will be put into a file named according -to ``moc_<basename>.cpp``. If the macro is found in a C++ implementation +If a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is found in a header file, +``moc`` will be run on the file. The result will be put into a file named +according to ``moc_<basename>.cpp``. +If the macro is found in a C++ implementation file, the moc output will be put into a file named according to ``<basename>.moc``, following the Qt conventions. The ``<basename>.moc`` must be included by the user in the C++ implementation file with a preprocessor @@ -95,9 +96,7 @@ following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS` variable may be populated to pre-set the options for all following targets. -The appearance of the strings ``Q_OBJECT`` or ``Q_GADGET`` in a source file -determines if it needs to be ``moc`` processed. To search for additional -strings, list them in :prop_tgt:`AUTOMOC_MACRO_NAMES`. +Additional macro names to search for can be added to :prop_tgt:`AUTOMOC_MACRO_NAMES`. Additional ``moc`` dependency file names can be extracted from source code by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 1b4873d..cba81e5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -367,6 +367,7 @@ Variables for Languages /variable/CMAKE_COMPILER_IS_GNUCC /variable/CMAKE_COMPILER_IS_GNUCXX /variable/CMAKE_COMPILER_IS_GNUG77 + /variable/CMAKE_CUDA_HOST_COMPILER /variable/CMAKE_CUDA_EXTENSIONS /variable/CMAKE_CUDA_STANDARD /variable/CMAKE_CUDA_STANDARD_REQUIRED diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 6eef6c6..6a21683 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -138,6 +138,8 @@ Options .. include:: OPTIONS_HELP.txt +.. _`Build Tool Mode`: + Build Tool Mode =============== diff --git a/Help/policy/CMP0071.rst b/Help/policy/CMP0071.rst index 61f14dc..ee33aa1 100644 --- a/Help/policy/CMP0071.rst +++ b/Help/policy/CMP0071.rst @@ -4,16 +4,15 @@ CMP0071 Let :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` process :prop_sf:`GENERATED` files. -CMake 3.10 and newer process regular *and* :prop_sf:`GENERATED` source files -in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`. -In CMake 3.9 and lower, only regular source files were processed in -:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`, -:prop_sf:`GENERATED` source files were ignored. +Since version 3.10, CMake processes **regular** and :prop_sf:`GENERATED` +source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`. +In earlier CMake versions, only **regular** source files were processed. +:prop_sf:`GENERATED` source files were ignored silently. -This policy affects how :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` process -source files that are :prop_sf:`GENERATED`. +This policy affects how source files that are :prop_sf:`GENERATED` +get treated in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`. -The ``OLD`` behavior for this policy is to *ignore* :prop_sf:`GENERATED` +The ``OLD`` behavior for this policy is to ignore :prop_sf:`GENERATED` source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`. The ``NEW`` behavior for this policy is to process :prop_sf:`GENERATED` @@ -21,10 +20,19 @@ source files in :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` just like regular source files. .. note:: - To exclude source files from :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` - processing, the boolean source file properties - :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` and :prop_sf:`SKIP_AUTOGEN` - can be set accordingly. + + To silence the CMP0071 warning source files can be excluded from + :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` processing by setting the + source file properties :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` or + :prop_sf:`SKIP_AUTOGEN`. + +Source skip example:: + + # ... + set_property(SOURCE /path/to/file1.h PROPERTY SKIP_AUTOMOC ON) + set_property(SOURCE /path/to/file2.h PROPERTY SKIP_AUTOUIC ON) + set_property(SOURCE /path/to/file3.h PROPERTY SKIP_AUTOGEN ON) + # ... This policy was introduced in CMake version 3.10. CMake version |release| warns when the policy is not set and uses ``OLD`` behavior. diff --git a/Help/prop_sf/SKIP_AUTOGEN.rst b/Help/prop_sf/SKIP_AUTOGEN.rst index 6bf2409..f31185a 100644 --- a/Help/prop_sf/SKIP_AUTOGEN.rst +++ b/Help/prop_sf/SKIP_AUTOGEN.rst @@ -4,5 +4,14 @@ SKIP_AUTOGEN Exclude the source file from :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and :prop_tgt:`AUTORCC` processing (for Qt projects). -For finer control see :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC` and -:prop_sf:`SKIP_AUTORCC`. +For finer exclusion control see :prop_sf:`SKIP_AUTOMOC`, +:prop_sf:`SKIP_AUTOUIC` and :prop_sf:`SKIP_AUTORCC`. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE file.h PROPERTY SKIP_AUTOGEN ON) + # ... diff --git a/Help/prop_sf/SKIP_AUTOMOC.rst b/Help/prop_sf/SKIP_AUTOMOC.rst index 2245ca6..a929448 100644 --- a/Help/prop_sf/SKIP_AUTOMOC.rst +++ b/Help/prop_sf/SKIP_AUTOMOC.rst @@ -3,4 +3,13 @@ SKIP_AUTOMOC Exclude the source file from :prop_tgt:`AUTOMOC` processing (for Qt projects). -For broader control see :prop_sf:`SKIP_AUTOGEN` +For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE file.h PROPERTY SKIP_AUTOMOC ON) + # ... diff --git a/Help/prop_sf/SKIP_AUTORCC.rst b/Help/prop_sf/SKIP_AUTORCC.rst index 394d8f8..bccccfc 100644 --- a/Help/prop_sf/SKIP_AUTORCC.rst +++ b/Help/prop_sf/SKIP_AUTORCC.rst @@ -3,4 +3,13 @@ SKIP_AUTORCC Exclude the source file from :prop_tgt:`AUTORCC` processing (for Qt projects). -For broader control see :prop_sf:`SKIP_AUTOGEN` +For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE file.qrc PROPERTY SKIP_AUTORCC ON) + # ... diff --git a/Help/prop_sf/SKIP_AUTOUIC.rst b/Help/prop_sf/SKIP_AUTOUIC.rst index 50f78ef..4eda726 100644 --- a/Help/prop_sf/SKIP_AUTOUIC.rst +++ b/Help/prop_sf/SKIP_AUTOUIC.rst @@ -3,4 +3,13 @@ SKIP_AUTOUIC Exclude the source file from :prop_tgt:`AUTOUIC` processing (for Qt projects). -For broader control see :prop_sf:`SKIP_AUTOGEN` +For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE file.h PROPERTY SKIP_AUTOUIC ON) + # ... diff --git a/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst b/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst new file mode 100644 index 0000000..e6763d3 --- /dev/null +++ b/Help/prop_sf/VS_SHADER_OUTPUT_HEADER_FILE.rst @@ -0,0 +1,5 @@ +VS_SHADER_OUTPUT_HEADER_FILE +---------------------------- + +Set filename for output header file containing object code of a ``.hlsl`` +source file. diff --git a/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst b/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst new file mode 100644 index 0000000..1a5e369 --- /dev/null +++ b/Help/prop_sf/VS_SHADER_VARIABLE_NAME.rst @@ -0,0 +1,5 @@ +VS_SHADER_VARIABLE_NAME +----------------------- + +Set name of variable in header file containing object code of a ``.hlsl`` +source file. diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 4542401..641ac09 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -12,8 +12,8 @@ When this property is set ``ON``, CMake will scan the header and source files at build time and invoke moc accordingly. * If an ``#include`` statement like ``#include "moc_<basename>.cpp"`` is found, - the ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in an otherwise empty - line of the ``<basename>.h(xx)`` header file. ``moc`` is run on the header + a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is expected to appear in the + ``<basename>.h(xx)`` header file. ``moc`` is run on the header file to generate ``moc_<basename>.cpp`` in the ``<AUTOGEN_BUILD_DIR>/include`` directory which is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`. @@ -26,11 +26,12 @@ source files at build time and invoke moc accordingly. * See :prop_tgt:`AUTOGEN_BUILD_DIR`. * If an ``#include`` statement like ``#include "<basename>.moc"`` is found, - then ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in the current source - file and ``moc`` is run on the source file itself. + a macro from :prop_tgt:`AUTOMOC_MACRO_NAMES` is expected to appear in the + source file and ``moc`` is run on the source file itself. * Header files that are not included by an ``#include "moc_<basename>.cpp"`` - statement are nonetheless scanned for ``Q_OBJECT`` or ``Q_GADGET`` macros. + statement are nonetheless scanned for a macro out of + :prop_tgt:`AUTOMOC_MACRO_NAMES`. The resulting ``moc_<basename>.cpp`` files are generated in custom directories and automatically included in a generated ``<AUTOGEN_BUILD_DIR>/mocs_compilation.cpp`` file, @@ -44,8 +45,9 @@ source files at build time and invoke moc accordingly. * Additionally, header files with the same base name as a source file, (like ``<basename>.h``) or ``_p`` appended to the base name (like - ``<basename>_p.h``), are parsed for ``Q_OBJECT`` or ``Q_GADGET`` macros, - and if found, ``moc`` is also executed on those files. + ``<basename>_p.h``), are scanned for a macro out of + :prop_tgt:`AUTOMOC_MACRO_NAMES`, and if found, ``moc`` + is also executed on those files. * ``AUTOMOC`` always checks multiple header alternative extensions, such as ``hpp``, ``hxx``, etc. when searching for headers. @@ -69,9 +71,7 @@ automoc targets together in an IDE, e.g. in MSVS. The global property :prop_gbl:`AUTOGEN_SOURCE_GROUP` can be used to group files generated by :prop_tgt:`AUTOMOC` together in an IDE, e.g. in MSVS. -The appearance of the strings ``Q_OBJECT`` or ``Q_GADGET`` in a source file -determines if it needs to be ``moc`` processed. To search for additional -strings, list them in :prop_tgt:`AUTOMOC_MACRO_NAMES`. +Additional macro names to search for can be added to :prop_tgt:`AUTOMOC_MACRO_NAMES`. Additional ``moc`` dependency file names can be extracted from source code by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`. diff --git a/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst index 0639bc8..0535fde 100644 --- a/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst +++ b/Help/prop_tgt/AUTOMOC_MACRO_NAMES.rst @@ -1,20 +1,23 @@ AUTOMOC_MACRO_NAMES ------------------- -Additional macro names used by :prop_tgt:`AUTOMOC` -to determine if a C++ file needs to be processed by ``moc``. +A :ref:`;-list <CMake Language Lists>` list of macro names used by +:prop_tgt:`AUTOMOC` to determine if a C++ file needs to be processed by ``moc``. This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON`` for this target. -CMake searches for the strings ``Q_OBJECT`` and ``Q_GADGET`` to -determine if a file needs to be processed by ``moc``. -:prop_tgt:`AUTOMOC_MACRO_NAMES` allows to add additional strings to the -search list. This is useful for cases where the ``Q_OBJECT`` or ``Q_GADGET`` -macro is hidden inside another macro. +When running :prop_tgt:`AUTOMOC`, CMake searches for the strings listed in +:prop_tgt:`AUTOMOC_MACRO_NAMES` in C++ source and header files. +If any of the strings is found + +- as the first non space string on a new line or +- as the first non space string after a ``{`` on a new line, + +then the file will be processed by ``moc``. By default :prop_tgt:`AUTOMOC_MACRO_NAMES` is initialized from -:variable:`CMAKE_AUTOMOC_MACRO_NAMES`, which is empty by default. +:variable:`CMAKE_AUTOMOC_MACRO_NAMES`. See the :manual:`cmake-qt(7)` manual for more information on using CMake with Qt. @@ -25,4 +28,4 @@ In this case the the ``Q_OBJECT`` macro is hidden inside an other macro called ``CUSTOM_MACRO``. To let CMake know that source files, that contain ``CUSTOM_MACRO``, need to be ``moc`` processed, we call:: - set_property(TARGET tgt PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO") + set_property(TARGET tgt APPEND PROPERTY AUTOMOC_MACRO_NAMES "CUSTOM_MACRO") diff --git a/Help/release/dev/add-vs-shader-properties.rst b/Help/release/dev/add-vs-shader-properties.rst new file mode 100644 index 0000000..c48b984 --- /dev/null +++ b/Help/release/dev/add-vs-shader-properties.rst @@ -0,0 +1,6 @@ +add-vs-shader-properties +------------------------ + +* Source file properties :prop_sf:`VS_SHADER_OUTPUT_HEADER_FILE` and + :prop_sf:`VS_SHADER_VARIABLE_NAME` have been added to specify more + details of ``.hlsl`` sources with :ref:`Visual Studio Generators`. diff --git a/Help/release/dev/autogen-macro-names.rst b/Help/release/dev/autogen-macro-names.rst index 736dd3a..6471295 100644 --- a/Help/release/dev/autogen-macro-names.rst +++ b/Help/release/dev/autogen-macro-names.rst @@ -1,12 +1,14 @@ autogen-macro-names ------------------- -* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT`` - and ``Q_OBJECT`` in a source file to determine if it needs to be ``moc`` - processed. The new variable :variable:`CMAKE_AUTOMOC_MACRO_NAMES` allows to - register additional strings (macro names) so search for. +* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``, + ``Q_GADGET`` or ``Q_NAMESPACE`` in a source file to determine if it needs + to be ``moc`` processed. The new variable + :variable:`CMAKE_AUTOMOC_MACRO_NAMES` allows to register additional + strings (macro names) so search for. -* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT`` - and ``Q_OBJECT`` in a source file to determine if it needs to be ``moc`` - processed. The new target property :prop_tgt:`AUTOMOC_MACRO_NAMES` allows to - register additional strings (macro names) so search for. +* When using :prop_tgt:`AUTOMOC`, CMake searches for the strings ``Q_OBJECT``, + ``Q_GADGET`` or ``Q_NAMESPACE`` in a source file to determine if it needs + to be ``moc`` processed. The new target property + :prop_tgt:`AUTOMOC_MACRO_NAMES` allows to register additional strings + (macro names) so search for. diff --git a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst index 7ed3445..5b79c40 100644 --- a/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst +++ b/Help/variable/CMAKE_AUTOMOC_MACRO_NAMES.rst @@ -1,14 +1,15 @@ CMAKE_AUTOMOC_MACRO_NAMES ---------------------------- -Additional macro names used by :variable:`CMAKE_AUTOMOC` -to determine if a C++ file needs to be processed by ``moc``. +A :ref:`;-list <CMake Language Lists>` list of macro names used by +:variable:`CMAKE_AUTOMOC` to determine if a C++ file needs to be +processed by ``moc``. This variable is used to initialize the :prop_tgt:`AUTOMOC_MACRO_NAMES` property on all the targets. See that target property for additional information. -By default it is empty. +The default value is ``Q_OBJECT;Q_GADGET;Q_NAMESPACE``. Example ------- @@ -16,4 +17,4 @@ Let CMake know that source files that contain ``CUSTOM_MACRO`` must be ``moc`` processed as well:: set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTOMOC_MACRO_NAMES "CUSTOM_MACRO") + list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "CUSTOM_MACRO") diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst new file mode 100644 index 0000000..72e8e66 --- /dev/null +++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst @@ -0,0 +1,7 @@ +CMAKE_CUDA_HOST_COMPILER +------------------------ + +Executable to use when compiling host code when compiling ``CUDA`` language +files. Maps to the nvcc -ccbin option. Will only be used by CMake on the first +configuration to determine a valid host compiler for ``CUDA``. After a valid +host compiler has been found, this value is read-only. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 9c38f6e..3951b2c 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -23,6 +23,7 @@ set(CMAKE_DL_LIBS "dl") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") +set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE") # basically all general purpose OSs support shared libs set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 912c5ac..76f5080 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1923,6 +1923,15 @@ function(_ep_get_step_stampfile name step stampfile_var) endfunction() +function(_ep_get_complete_stampfile name stampfile_var) + set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) + _ep_get_configuration_subdir_suffix(cfgdir) + set(stampfile "${cmf_dir}${cfgdir}/${name}-complete") + + set(${stampfile_var} ${stampfile} PARENT_SCOPE) +endfunction() + + function(ExternalProject_Add_StepTargets name) set(steps ${ARGN}) if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS") @@ -1952,10 +1961,7 @@ endfunction() function(ExternalProject_Add_Step name step) - set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) - _ep_get_configuration_subdir_suffix(cfgdir) - - set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete") + _ep_get_complete_stampfile(${name} complete_stamp_file) _ep_get_step_stampfile(${name} ${step} stamp_file) _ep_parse_arguments(ExternalProject_Add_Step @@ -2958,7 +2964,7 @@ function(ExternalProject_Add name) # Add a custom target for the external project. set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) - set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete") + _ep_get_complete_stampfile(${name} complete_stamp_file) # The "ALL" option to add_custom_target just tells it to not set the # EXCLUDE_FROM_ALL target property. Later, if the EXCLUDE_FROM_ALL diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 7493281..d287688 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -681,12 +681,12 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans) string( - REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*([0-9]+(\\.[0-9]+)?)" + REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*'?([0-9]+(\\.[0-9]+)?)" matlab_versions_regex ${substring_ans}) foreach(match IN LISTS matlab_versions_regex) string( - REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)" + REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*'?(([0-9]+)(\\.([0-9]+))?)" current_match ${match}) list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fdc6476..a4dd918 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -779,6 +779,8 @@ if(WIN32 AND NOT UNIX) target_link_libraries(CMakeLib rpcrt4 crypt32) endif() +target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS}) + # # CTestLib # diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d5dc2ba..b0647f6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 9) -set(CMake_VERSION_PATCH 20170927) +set(CMake_VERSION_PATCH 20170929) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index bbf2a50..f47ca7a 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -213,8 +213,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) cmSystemTools::ExpandListArgument(sign_files, relFiles); // sign the files supplied by the user, ie. frameworks. - for (std::vector<std::string>::iterator it = relFiles.begin(); - it != relFiles.end(); ++it) { + for (auto const& file : relFiles) { std::ostringstream temp_sign_file_cmd; temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); temp_sign_file_cmd << " " << sign_parameter << " -s \"" @@ -223,11 +222,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID"); temp_sign_file_cmd << " \""; temp_sign_file_cmd << bundle_path; - temp_sign_file_cmd << *it << "\""; + temp_sign_file_cmd << file << "\""; if (!this->RunCommand(temp_sign_file_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error signing file:" << bundle_path << *it << std::endl + "Error signing file:" << bundle_path << file << std::endl << output << std::endl); return 0; diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 88204c8..45c7fc6 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -136,17 +136,17 @@ int cmCPackDragNDropGenerator::InitializeInternal() "CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl); return 0; } - for (size_t i = 0; i < languages.size(); ++i) { - std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; + for (auto const& language : languages) { + std::string license = slaDirectory + "/" + language + ".license.txt"; if (!singleLicense && !cmSystemTools::FileExists(license)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing license file " - << languages[i] << ".license.txt" << std::endl); + << language << ".license.txt" << std::endl); return 0; } - std::string menu = slaDirectory + "/" + languages[i] + ".menu.txt"; + std::string menu = slaDirectory + "/" + language + ".menu.txt"; if (!cmSystemTools::FileExists(menu)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing menu file " - << languages[i] << ".menu.txt" << std::endl); + << language << ".menu.txt" << std::endl); return 0; } } @@ -185,19 +185,19 @@ int cmCPackDragNDropGenerator::PackageFiles() // loop to create dmg files packageFileNames.clear(); - for (size_t i = 0; i < package_files.size(); i++) { + for (auto const& package_file : package_files) { std::string full_package_name = std::string(toplevel) + std::string("/"); - if (package_files[i] == "ALL_IN_ONE") { + if (package_file == "ALL_IN_ONE") { full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } else { - full_package_name += package_files[i]; + full_package_name += package_file; } full_package_name += std::string(GetOutputExtension()); packageFileNames.push_back(full_package_name); std::string src_dir = toplevel; src_dir += "/"; - src_dir += package_files[i]; + src_dir += package_file; if (0 == this->CreateDMG(src_dir, full_package_name)) { return 0; @@ -226,14 +226,14 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target, cmsys::ofstream fout(target.str().c_str(), std::ios::out | std::ios::binary); if (!fout) { return false; - } else { - // Seek to desired size - 1 byte - fout.seekp(size - 1, std::ios::beg); - char byte = 0; - // Write one byte to ensure file grows - fout.write(&byte, 1); } + // Seek to desired size - 1 byte + fout.seekp(size - 1, std::ios::beg); + char byte = 0; + // Write one byte to ensure file grows + fout.write(&byte, 1); + return true; } @@ -561,7 +561,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmCPackLogger(cmCPackLog::LOG_ERROR, languages[i] << " is not a recognized language" << std::endl); } - char* iso_language_cstr = (char*)malloc(65); + char* iso_language_cstr = static_cast<char*>(malloc(65)); CFStringGetCString(iso_language, iso_language_cstr, 64, kCFStringEncodingMacRoman); LangCode lang = 0; @@ -769,7 +769,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( bool cmCPackDragNDropGenerator::WriteLicense( cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile, std::string* error) + std::string licenseLanguage, const std::string& licenseFile, + std::string* error) { if (!licenseFile.empty() && !singleLicense) { licenseNumber = 5002; @@ -795,8 +796,8 @@ bool cmCPackDragNDropGenerator::WriteLicense( if (!this->BreakLongLine(line, lines, error)) { return false; } - for (size_t i = 0; i < lines.size(); ++i) { - outputStream << " \"" << lines[i] << "\"\n"; + for (auto const& l : lines) { + outputStream << " \"" << l << "\"\n"; } } outputStream << " \"\\n\"\n"; @@ -865,10 +866,11 @@ bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, size_t line_length = max_line_length; if (i + line_length > line.size()) { line_length = line.size() - i; - } else + } else { while (line_length > 0 && line[i + line_length - 1] != ' ') { line_length = line_length - 1; } + } if (line_length == 0) { *error = "Please make sure there are no words " diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 8565c68..d8c5c83 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -45,8 +45,8 @@ private: bool singleLicense; bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile, - std::string* error); + std::string licenseLanguage, + const std::string& licenseFile, std::string* error); bool BreakLongLine(const std::string& line, std::vector<std::string>& lines, std::string* error); void EscapeQuotesAndBackslashes(std::string& line); diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 321b6a7..4f5b2a0 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -42,9 +42,9 @@ std::string cmCPackPKGGenerator::GetPackageName( out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-" << component.Name << ".pkg"; return out.str(); - } else { - return component.ArchiveFile + ".pkg"; } + + return component.ArchiveFile + ".pkg"; } void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile) diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 6624b16..0299279 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -275,8 +275,9 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (this->PackageMakerVersion > 2.0) { pkgCmd << " -v"; } - if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) + if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) { return 0; + } } else { // We have built the package in place. Generate the // distribution.dist file to describe it for the installer. diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index ed4463c..6a6dc82 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -190,7 +190,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating installer directory: " << scriptDir << std::endl); - return 0; + return false; } // if preflight, postflight, or postupgrade are set diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index f2c54fc..addb54e 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -194,7 +194,7 @@ int main(int argc, char const* const* argv) cmGlobalGenerator cmgg(&cminst); cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot()); #if defined(__CYGWIN__) - globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); + globalMF.AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); #endif bool cpackConfigFileSpecified = true; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 1da42d4..f4fc769 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -769,6 +769,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, } std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& arg : args) { argv.push_back(arg.c_str()); } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 7fe74af..8cb795e 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -214,6 +214,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom) std::vector<std::string> git_custom_command; cmSystemTools::ExpandListArgument(custom, git_custom_command, true); std::vector<char const*> git_custom; + git_custom.reserve(git_custom_command.size() + 1); for (std::string const& i : git_custom_command) { git_custom.push_back(i.c_str()); } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 11f6a00..fdf8932 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -464,6 +464,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom) cmSystemTools::ExpandListArgument(custom, p4_custom_command, true); std::vector<char const*> p4_custom; + p4_custom.reserve(p4_custom_command.size() + 1); for (std::string const& i : p4_custom_command) { p4_custom.push_back(i.c_str()); } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 7e09ef0..fd7f37a 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -56,6 +56,7 @@ bool cmCTestVC::InitialCheckout(const char* command) // Construct the initial checkout command line. std::vector<std::string> args = cmSystemTools::ParseArguments(command); std::vector<char const*> vc_co; + vc_co.reserve(args.size() + 1); for (std::string const& arg : args) { vc_co.push_back(arg.c_str()); } diff --git a/Source/Checks/cm_cxx_auto_ptr.cxx b/Source/Checks/cm_cxx_auto_ptr.cxx deleted file mode 100644 index d3100fd..0000000 --- a/Source/Checks/cm_cxx_auto_ptr.cxx +++ /dev/null @@ -1,18 +0,0 @@ -#include <memory> - -std::auto_ptr<int> get_auto_ptr() -{ - std::auto_ptr<int> ptr; - ptr = std::auto_ptr<int>(new int(0)); - return ptr; -} - -int use_auto_ptr(std::auto_ptr<int> ptr) -{ - return *ptr; -} - -int main() -{ - return use_auto_ptr(get_auto_ptr()); -} diff --git a/Source/Checks/cm_cxx_eq_delete.cxx b/Source/Checks/cm_cxx_eq_delete.cxx deleted file mode 100644 index 809e4cf..0000000 --- a/Source/Checks/cm_cxx_eq_delete.cxx +++ /dev/null @@ -1,14 +0,0 @@ -struct Foo -{ - Foo() {} - ~Foo() {} - Foo(Foo const&) = delete; - Foo& operator=(Foo const&) = delete; - int test() const { return 0; } -}; - -int main() -{ - Foo const foo; - return foo.test(); -} diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 2c39cbe..a30a5e6 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -41,8 +41,6 @@ function(cm_check_cxx_feature name) endif() endfunction() -cm_check_cxx_feature(auto_ptr) -cm_check_cxx_feature(eq_delete) cm_check_cxx_feature(fallthrough) if(NOT CMake_HAVE_CXX_FALLTHROUGH) cm_check_cxx_feature(gnu_fallthrough) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e248219..4ea1493 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -969,6 +969,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, } std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& a : args) { argv.push_back(a.c_str()); } @@ -2569,6 +2570,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, const char* dir, double timeout, Encoding encoding) { std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& a : args) { argv.push_back(a.c_str()); } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index bd4077f..1189606 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -194,6 +194,7 @@ std::string cmCommonTargetGenerator::GetManifests() this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName); std::vector<std::string> manifests; + manifests.reserve(manifest_srcs.size()); for (cmSourceFile const* manifest_src : manifest_srcs) { manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat( this->LocalCommonGenerator->ConvertToRelativePath( diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 9d11fff..9a78aca 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -19,22 +19,13 @@ #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER -#cmakedefine CMake_HAVE_CXX_AUTO_PTR -#cmakedefine CMake_HAVE_CXX_EQ_DELETE #cmakedefine CMake_HAVE_CXX_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_GNU_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE -#cmakedefine CMake_HAVE_CXX_UNIQUE_PTR #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" -#ifdef CMake_HAVE_CXX_EQ_DELETE -#define CM_EQ_DELETE = delete -#else -#define CM_EQ_DELETE -#endif - #if defined(CMake_HAVE_CXX_FALLTHROUGH) #define CM_FALLTHROUGH [[fallthrough]] #elif defined(CMake_HAVE_CXX_GNU_FALLTHROUGH) @@ -46,7 +37,7 @@ #endif #define CM_DISABLE_COPY(Class) \ - Class(Class const&) CM_EQ_DELETE; \ - Class& operator=(Class const&) CM_EQ_DELETE; + Class(Class const&) = delete; \ + Class& operator=(Class const&) = delete; #endif diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f06ef43..fdd5f0c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2294,10 +2294,9 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args) if (errorArg.GetString().empty()) { this->SetError(error); return false; - } else { - this->Makefile->AddDefinition(errorArg.GetString(), error.c_str()); - return true; } + this->Makefile->AddDefinition(errorArg.GetString(), error.c_str()); + return true; #endif } diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 61e419c..622c15e 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -116,18 +116,22 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1, // Compare using nanosecond resolution. if (s1->st_mtimespec.tv_sec < s2->st_mtimespec.tv_sec) { return -1; - } else if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) { + } + if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) { return 1; - } else if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) { + } + if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) { return -1; - } else if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) { + } + if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) { return 1; } #else // Compare using 1 second resolution. if (s1->st_mtime < s2->st_mtime) { return -1; - } else if (s1->st_mtime > s2->st_mtime) { + } + if (s1->st_mtime > s2->st_mtime) { return 1; } #endif @@ -162,20 +166,20 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1, long long t2 = s2->st_mtimespec.tv_sec * bil + s2->st_mtimespec.tv_nsec; if (t1 < t2) { return (t2 - t1) >= bil; - } else if (t2 < t1) { + } + if (t2 < t1) { return (t1 - t2) >= bil; - } else { - return false; } + return false; #else // Times are integers in units of 1s. if (s1->st_mtime < s2->st_mtime) { return (s2->st_mtime - s1->st_mtime) >= 1; - } else if (s1->st_mtime > s2->st_mtime) { + } + if (s1->st_mtime > s2->st_mtime) { return (s1->st_mtime - s2->st_mtime) >= 1; - } else { - return false; } + return false; #endif #else // Times are integers in units of 100ns. diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index b8b51ba..758da2c 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -260,7 +260,7 @@ void cmFindLibraryHelper::RegexFromLiteral(std::string& out, out += "\\"; } #if defined(_WIN32) || defined(__APPLE__) - out += tolower(ch); + out += static_cast<char>(tolower(ch)); #else out += ch; #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9375f60..304a188 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -47,8 +47,11 @@ public: : Version("1.5") { } - void StartElement(const std::string&, const char**) { this->Data = ""; } - void EndElement(const std::string& name) + void StartElement(const std::string&, const char**) override + { + this->Data = ""; + } + void EndElement(const std::string& name) override { if (name == "key") { this->Key = this->Data; @@ -58,7 +61,7 @@ public: } } } - void CharacterDataHandler(const char* data, int length) + void CharacterDataHandler(const char* data, int length) override { this->Data.append(data, length); } @@ -108,9 +111,8 @@ public: { if (this->Group) { return this->Group; - } else { - return this->Generator->CreateString(this->String); } + return this->Generator->CreateString(this->String); } }; @@ -161,8 +163,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( const std::string& name, cmake* cm) const { - if (name != GetActualName()) + if (name != GetActualName()) { return nullptr; + } #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; std::string versionFile; @@ -237,10 +240,9 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand() makeProgram = "xcodebuild"; } return makeProgram; - } else { - // Use cmakexbuild wrapper to suppress environment dump from output. - return cmSystemTools::GetCMakeCommand() + "xbuild"; } + // Use cmakexbuild wrapper to suppress environment dump from output. + return cmSystemTools::GetCMakeCommand() + "xbuild"; } bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, @@ -435,18 +437,13 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // now make the allbuild depend on all the non-utility targets // in the project - for (std::vector<cmLocalGenerator*>::iterator i = gens.begin(); - i != gens.end(); ++i) { - cmLocalGenerator* lg = *i; - if (this->IsExcluded(root, *i)) { + for (auto& gen : gens) { + if (this->IsExcluded(root, gen)) { continue; } - const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); l++) { - cmGeneratorTarget* target = *l; - + const std::vector<cmGeneratorTarget*>& tgts = gen->GetGeneratorTargets(); + for (auto target : tgts) { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } @@ -472,7 +469,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( cmCustomCommandLines commandLines; commandLines.push_back(makeHelper); std::vector<std::string> no_byproducts; - lg->GetMakefile()->AddCustomCommandToTarget( + gen->GetMakefile()->AddCustomCommandToTarget( target->GetName(), no_byproducts, no_depends, commandLines, cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true, false, "", false, cmMakefile::AcceptObjectLibraryCommands); @@ -484,7 +481,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( } // Refer to the build configuration file for easy editing. - listfile = lg->GetCurrentSourceDirectory(); + listfile = gen->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; target->AddSource(listfile); @@ -496,9 +493,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens) { std::vector<std::string> lfiles; - for (std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin(); - gi != gens.end(); ++gi) { - std::vector<std::string> const& lf = (*gi)->GetMakefile()->GetListFiles(); + for (auto gen : gens) { + std::vector<std::string> const& lf = gen->GetMakefile()->GetListFiles(); lfiles.insert(lfiles.end(), lf.begin(), lf.end()); } @@ -558,8 +554,8 @@ void cmGlobalXCodeGenerator::SortXCodeObjects() void cmGlobalXCodeGenerator::ClearXCodeObjects() { this->TargetDoneSet.clear(); - for (unsigned int i = 0; i < this->XCodeObjects.size(); ++i) { - delete this->XCodeObjects[i]; + for (auto& obj : this->XCodeObjects) { + delete obj; } this->XCodeObjects.clear(); this->XCodeObjectIDs.clear(); @@ -573,7 +569,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects() void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj) { if (obj->GetType() == cmXCodeObject::OBJECT) { - std::string id = obj->GetId(); + const std::string& id = obj->GetId(); // If this is a duplicate id, it's an error: // @@ -933,13 +929,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets> cmSortedTargets; cmSortedTargets sortedTargets; - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); l++) { - sortedTargets[(*l)->GetName()] = *l; + for (auto tgt : tgts) { + sortedTargets[tgt->GetName()] = tgt; } - for (cmSortedTargets::iterator l = sortedTargets.begin(); - l != sortedTargets.end(); l++) { - cmGeneratorTarget* gtgt = l->second; + for (auto& sortedTarget : sortedTargets) { + cmGeneratorTarget* gtgt = sortedTarget.second; std::string targetName = gtgt->GetName(); @@ -1042,9 +1036,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( sourceBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<cmXCodeObject*>::iterator i = sourceFiles.begin(); - i != sourceFiles.end(); ++i) { - buildFiles->AddObject(*i); + for (auto& sourceFile : sourceFiles) { + buildFiles->AddObject(sourceFile); } sourceBuildPhase->AddAttribute("files", buildFiles); sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", @@ -1060,9 +1053,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( headerBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<cmXCodeObject*>::iterator i = headerFiles.begin(); - i != headerFiles.end(); ++i) { - buildFiles->AddObject(*i); + for (auto& headerFile : headerFiles) { + buildFiles->AddObject(headerFile); } headerBuildPhase->AddAttribute("files", buildFiles); headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", @@ -1079,9 +1071,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( resourceBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<cmXCodeObject*>::iterator i = resourceFiles.begin(); - i != resourceFiles.end(); ++i) { - buildFiles->AddObject(*i); + for (auto& resourceFile : resourceFiles) { + buildFiles->AddObject(resourceFile); } resourceBuildPhase->AddAttribute("files", buildFiles); resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", @@ -1189,9 +1180,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( this->CreateString("2147483647")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); frameworkBuildPhase->AddAttribute("files", buildFiles); - for (std::vector<cmXCodeObject*>::iterator i = externalObjFiles.begin(); - i != externalObjFiles.end(); ++i) { - buildFiles->AddObject(*i); + for (auto& externalObjFile : externalObjFiles) { + buildFiles->AddObject(externalObjFile); } frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", this->CreateString("0")); @@ -1212,14 +1202,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( void cmGlobalXCodeGenerator::ForceLinkerLanguages() { - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { + for (auto& localGenerator : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& tgts = - this->LocalGenerators[i]->GetGeneratorTargets(); + localGenerator->GetGeneratorTargets(); // All targets depend on the build-system check target. - for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin(); - ti != tgts.end(); ++ti) { + for (auto tgt : tgts) { // This makes sure all targets link using the proper language. - this->ForceLinkerLanguage(*ti); + this->ForceLinkerLanguage(tgt); } } } @@ -1240,9 +1229,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) // If the language is compiled as a source trust Xcode to link with it. cmLinkImplementation const* impl = gtgt->GetLinkImplementation("NOCONFIG"); - for (std::vector<std::string>::const_iterator li = impl->Languages.begin(); - li != impl->Languages.end(); ++li) { - if (*li == llang) { + for (auto const& Language : impl->Languages) { + if (Language == llang) { return; } } @@ -1280,7 +1268,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateBuildPhase( const char* name, const char* name2, cmGeneratorTarget* target, const std::vector<cmCustomCommand>& commands) { - if (commands.size() == 0 && strcmp(name, "CMake ReRun") != 0) { + if (commands.empty() && strcmp(name, "CMake ReRun") != 0) { return nullptr; } cmXCodeObject* buildPhase = @@ -1468,7 +1456,7 @@ void cmGlobalXCodeGenerator::FilterConfigurationAttribute( return; } - std::string::size_type endVariant = attribute.find("]", beginVariant + 9); + std::string::size_type endVariant = attribute.find(']', beginVariant + 9); if (endVariant == std::string::npos) { // There is no terminating bracket. return; @@ -1544,16 +1532,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( makefileStream << "all: "; std::map<const cmCustomCommand*, std::string> tname; int count = 0; - for (std::vector<cmCustomCommand>::const_iterator i = commands.begin(); - i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator); + for (auto const& command : commands) { + cmCustomCommandGenerator ccg(command, configName, + this->CurrentLocalGenerator); if (ccg.GetNumberOfCommands() > 0) { const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { - for (std::vector<std::string>::const_iterator o = outputs.begin(); - o != outputs.end(); ++o) { + for (auto const& output : outputs) { makefileStream << "\\\n\t" - << this->ConvertToRelativeForMake(o->c_str()); + << this->ConvertToRelativeForMake(output.c_str()); } } else { std::ostringstream str; @@ -1564,18 +1551,18 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } } makefileStream << "\n\n"; - for (std::vector<cmCustomCommand>::const_iterator i = commands.begin(); - i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator); + for (auto const& command : commands) { + cmCustomCommandGenerator ccg(command, configName, + this->CurrentLocalGenerator); if (ccg.GetNumberOfCommands() > 0) { makefileStream << "\n"; const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { // There is at least one output, start the rule for it const char* sep = ""; - for (std::vector<std::string>::const_iterator oi = outputs.begin(); - oi != outputs.end(); ++oi) { - makefileStream << sep << this->ConvertToRelativeForMake(oi->c_str()); + for (auto const& output : outputs) { + makefileStream << sep + << this->ConvertToRelativeForMake(output.c_str()); sep = " "; } makefileStream << ": "; @@ -1583,11 +1570,9 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( // There are no outputs. Use the generated force rule name. makefileStream << tname[&ccg.GetCC()] << ": "; } - for (std::vector<std::string>::const_iterator d = - ccg.GetDepends().begin(); - d != ccg.GetDepends().end(); ++d) { + for (auto const& d : ccg.GetDepends()) { std::string dep; - if (this->CurrentLocalGenerator->GetRealDependency(*d, configName, + if (this->CurrentLocalGenerator->GetRealDependency(d, configName, dep)) { makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep.c_str()); @@ -1642,9 +1627,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::set<std::string> languages; gtgt->GetLanguages(languages, configName); std::map<std::string, std::string> cflags; - for (std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) { - std::string const& lang = *li; + for (auto const& lang : languages) { std::string& flags = cflags[lang]; // Add language-specific flags. @@ -1740,9 +1723,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } else { cmXCodeObject* archObjects = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<std::string>::iterator i = archs.begin(); - i != archs.end(); i++) { - archObjects->AddObject(this->CreateString(*i)); + for (auto& arch : archs) { + archObjects->AddObject(this->CreateString(arch)); } buildSettings->AddAttribute("ARCHS", archObjects); } @@ -1967,10 +1949,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::set<std::string> emitted; emitted.insert("/System/Library/Frameworks"); - for (std::vector<std::string>::iterator i = includes.begin(); - i != includes.end(); ++i) { - if (this->NameResolvesToFramework(*i)) { - std::string frameworkDir = *i; + for (auto& include : includes) { + if (this->NameResolvesToFramework(include)) { + std::string frameworkDir = include; frameworkDir += "/../"; frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); if (emitted.insert(frameworkDir).second) { @@ -1983,9 +1964,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } } } else { - std::string incpath = this->XCodeEscapePath(*i); + std::string incpath = this->XCodeEscapePath(include); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(*i, configName)) { + gtgt->IsSystemIncludeDirectory(include, configName)) { sysdirs.Add(incpath); } else { dirs.Add(incpath); @@ -1995,12 +1976,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add framework search paths needed for linking. if (cmComputeLinkInformation* cli = gtgt->GetLinkInformation(configName)) { std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths(); - for (std::vector<std::string>::const_iterator fdi = fwDirs.begin(); - fdi != fwDirs.end(); ++fdi) { - if (emitted.insert(*fdi).second) { - std::string incpath = this->XCodeEscapePath(*fdi); + for (auto const& fwDir : fwDirs) { + if (emitted.insert(fwDir).second) { + std::string incpath = this->XCodeEscapePath(fwDir); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(*fdi, configName)) { + gtgt->IsSystemIncludeDirectory(fwDir, configName)) { sysfdirs.Add(incpath); } else { fdirs.Add(incpath); @@ -2028,13 +2008,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // system include directory awareness. We need to also keep on setting // HEADER_SEARCH_PATHS to work around a missing compile options flag for // GNU assembly files (#16449) - for (std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) { + for (auto const& language : languages) { std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags( - includes, gtgt, *li, true, false, configName); + includes, gtgt, language, true, false, configName); if (!includeFlags.empty()) { - cflags[*li] += " " + includeFlags; + cflags[language] += " " + includeFlags; } } } @@ -2045,10 +2024,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string optLevel = "0"; // Minimal map of flags to build settings. - for (std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) { - std::string& flags = cflags[*li]; - std::string& gflag = gflags[*li]; + for (auto const& language : languages) { + std::string& flags = cflags[language]; + std::string& gflag = gflags[language]; std::string oflag = this->ExtractFlagRegex("(^| )(-Ofast|-Os|-O[0-9]*)( |$)", 2, flags); if (oflag.size() == 2) { @@ -2073,10 +2051,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (!same_gflags) { // We can't set the Xcode flag differently depending on the language, // so put them back in this case. - for (std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) { - cflags[*li] += " "; - cflags[*li] += gflags[*li]; + for (auto const& language : languages) { + cflags[language] += " "; + cflags[language] += gflags[language]; } debugStr = "NO"; } else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) { @@ -2093,18 +2070,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", this->CreateString("NO")); - for (std::set<std::string>::iterator li = languages.begin(); - li != languages.end(); ++li) { - std::string flags = cflags[*li] + " " + defFlags; - if (*li == "CXX") { + for (auto const& language : languages) { + std::string flags = cflags[language] + " " + defFlags; + if (language == "CXX") { buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", this->CreateString(flags)); - } else if (*li == "Fortran") { + } else if (language == "Fortran") { buildSettings->AddAttribute("IFORT_OTHER_FLAGS", this->CreateString(flags)); - } else if (*li == "C") { + } else if (language == "C") { buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags)); - } else if (*li == "Swift") { + } else if (language == "Swift") { buildSettings->AddAttribute("OTHER_SWIFT_FLAGS", this->CreateString(flags)); } @@ -2228,15 +2204,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Convert "XCODE_ATTRIBUTE_*" properties directly. { std::vector<std::string> const& props = gtgt->GetPropertyKeys(); - for (std::vector<std::string>::const_iterator i = props.begin(); - i != props.end(); ++i) { - if (i->find("XCODE_ATTRIBUTE_") == 0) { - std::string attribute = i->substr(16); + for (auto const& prop : props) { + if (prop.find("XCODE_ATTRIBUTE_") == 0) { + std::string attribute = prop.substr(16); this->FilterConfigurationAttribute(configName, attribute); if (!attribute.empty()) { cmGeneratorExpression ge; std::string processed = - ge.Parse(gtgt->GetProperty(*i)) + ge.Parse(gtgt->GetProperty(prop)) ->Evaluate(this->CurrentLocalGenerator, configName); buildSettings->AddAttribute(attribute, this->CreateString(processed)); @@ -2324,15 +2299,15 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, configlist->SetComment(comment); target->AddAttribute("buildConfigurationList", this->CreateObjectReference(configlist)); - for (unsigned int i = 0; i < configVector.size(); ++i) { + for (auto const& i : configVector) { cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); buildConfigurations->AddObject(config); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - this->CreateBuildSettings(gtgt, buildSettings, configVector[i]); - config->AddAttribute("name", this->CreateString(configVector[i])); - config->SetComment(configVector[i]); + this->CreateBuildSettings(gtgt, buildSettings, i); + config->AddAttribute("name", this->CreateString(i)); + config->SetComment(i); config->AddAttribute("buildSettings", buildSettings); } if (!configVector.empty()) { @@ -2352,9 +2327,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar( (target->GetType() == cmStateEnums::STATIC_LIBRARY || target->GetType() == cmStateEnums::OBJECT_LIBRARY)) { return "OTHER_LIBTOOLFLAGS"; - } else { - return "OTHER_LDFLAGS"; } + return "OTHER_LDFLAGS"; } const char* cmGlobalXCodeGenerator::GetTargetFileType( @@ -2371,12 +2345,13 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" : "archive.ar"); case cmStateEnums::MODULE_LIBRARY: - if (target->IsXCTestOnApple()) + if (target->IsXCTestOnApple()) { return "wrapper.cfbundle"; - else if (target->IsCFBundleOnApple()) + } + if (target->IsCFBundleOnApple()) { return "wrapper.plug-in"; - else - return "compiled.mach-o.executable"; + } + return "compiled.mach-o.executable"; case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" @@ -2404,12 +2379,13 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( ? "com.apple.product-type.framework" : "com.apple.product-type.library.static"); case cmStateEnums::MODULE_LIBRARY: - if (target->IsXCTestOnApple()) + if (target->IsXCTestOnApple()) { return "com.apple.product-type.bundle.unit-test"; - else if (target->IsCFBundleOnApple()) + } else if (target->IsCFBundleOnApple()) { return "com.apple.product-type.bundle"; - else + } else { return "com.apple.product-type.tool"; + } case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "com.apple.product-type.framework" @@ -2563,15 +2539,14 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); // each configuration and the target itself has a buildSettings in it // list.push_back(target); - for (std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end(); - ++i) { + for (auto& i : list) { if (!configName.empty()) { - if ((*i)->GetObject("name")->GetString() == configName) { - cmXCodeObject* settings = (*i)->GetObject("buildSettings"); + if (i->GetObject("name")->GetString() == configName) { + cmXCodeObject* settings = i->GetObject("buildSettings"); this->AppendOrAddBuildSetting(settings, attribute, value); } } else { - cmXCodeObject* settings = (*i)->GetObject("buildSettings"); + cmXCodeObject* settings = i->GetObject("buildSettings"); this->AppendOrAddBuildSetting(settings, attribute, value); } } @@ -2590,20 +2565,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // Add dependencies on other CMake targets. TargetDependSet const& deps = this->GetTargetDirectDepends(gt); - for (TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); - ++i) { - if (cmXCodeObject* dptarget = this->FindXCodeTarget(*i)) { + for (auto dep : deps) { + if (cmXCodeObject* dptarget = this->FindXCodeTarget(dep)) { this->AddDependTarget(target, dptarget); } } // Loop over configuration types and set per-configuration info. - for (std::vector<std::string>::iterator i = - this->CurrentConfigurationTypes.begin(); - i != this->CurrentConfigurationTypes.end(); ++i) { + for (auto const& configName : this->CurrentConfigurationTypes) { // Get the current configuration name. - std::string configName = *i; - if (this->XcodeVersion >= 50) { // Add object library contents as link flags. std::string linkObjs; @@ -2639,9 +2609,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // Add dependencies directly on library files. { std::vector<std::string> const& libDeps = cli.GetDepends(); - for (std::vector<std::string>::const_iterator j = libDeps.begin(); - j != libDeps.end(); ++j) { - target->AddDependLibrary(configName, *j); + for (auto const& libDep : libDeps) { + target->AddDependLibrary(configName, libDep); } } @@ -2649,16 +2618,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) { std::vector<std::string> const& libDirs = cli.GetDirectories(); std::string linkDirs; - for (std::vector<std::string>::const_iterator libDir = libDirs.begin(); - libDir != libDirs.end(); ++libDir) { - if (libDir->size() && *libDir != "/usr/lib") { + for (auto const& libDir : libDirs) { + if (!libDir.empty() && libDir != "/usr/lib") { // Now add the same one but append // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it: linkDirs += " "; linkDirs += this->XCodeEscapePath( - *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"); + libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"); linkDirs += " "; - linkDirs += this->XCodeEscapePath(*libDir); + linkDirs += this->XCodeEscapePath(libDir); } } this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS", @@ -2671,18 +2639,18 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) const char* sep = ""; typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector const& libNames = cli.GetItems(); - for (ItemVector::const_iterator li = libNames.begin(); - li != libNames.end(); ++li) { + for (auto const& libName : libNames) { linkLibs += sep; sep = " "; - if (li->IsPath) { - linkLibs += this->XCodeEscapePath(li->Value); - } else if (!li->Target || - li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - linkLibs += li->Value; + if (libName.IsPath) { + linkLibs += this->XCodeEscapePath(libName.Value); + } else if (!libName.Target || + libName.Target->GetType() != + cmStateEnums::INTERFACE_LIBRARY) { + linkLibs += libName.Value; } - if (li->Target && !li->Target->IsImported()) { - target->AddDependTarget(configName, li->Target->GetName()); + if (libName.Target && !libName.Target->IsImported()) { + target->AddDependTarget(configName, libName.Target->GetName()); } } this->AppendBuildSettingAttribute( @@ -2694,15 +2662,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) bool cmGlobalXCodeGenerator::CreateGroups( std::vector<cmLocalGenerator*>& generators) { - for (std::vector<cmLocalGenerator*>::iterator i = generators.begin(); - i != generators.end(); ++i) { - cmMakefile* mf = (*i)->GetMakefile(); + for (auto& generator : generators) { + cmMakefile* mf = generator->GetMakefile(); std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups(); - const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); l++) { - cmGeneratorTarget* gtgt = *l; - + const std::vector<cmGeneratorTarget*>& tgts = + generator->GetGeneratorTargets(); + for (auto gtgt : tgts) { // Same skipping logic here as in CreateXCodeTargets so that we do not // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source // groups: @@ -2726,10 +2691,8 @@ bool cmGlobalXCodeGenerator::CreateGroups( gtgt->GetAllConfigSources(); // Put cmSourceFile instances in proper groups: - for (std::vector<cmGeneratorTarget::AllConfigSource>::const_iterator si = - sources.begin(); - si != sources.end(); ++si) { - cmSourceFile const* sf = si->Source; + for (auto const& si : sources) { + cmSourceFile const* sf = si.Source; if (this->XcodeVersion >= 50 && !sf->GetObjectLibrary().empty()) { // Object library files go on the link line instead. continue; @@ -2748,19 +2711,21 @@ bool cmGlobalXCodeGenerator::CreateGroups( } cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent, - std::string name) + const std::string& name) { cmXCodeObject* parentChildren = nullptr; - if (parent) + if (parent) { parentChildren = parent->GetObject("children"); + } cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup); cmXCodeObject* groupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); group->AddAttribute("name", this->CreateString(name)); group->AddAttribute("children", groupChildren); group->AddAttribute("sourceTree", this->CreateString("<group>")); - if (parentChildren) + if (parentChildren) { parentChildren->AddObject(group); + } return group; } @@ -2814,7 +2779,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( // If it's the default source group (empty name) then put the source file // directly in the tgroup... // - if (std::string(sg->GetFullName()) == "") { + if (std::string(sg->GetFullName()).empty()) { this->GroupNameMap[s] = tgroup; return tgroup; } @@ -2825,13 +2790,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( cmSystemTools::tokenize(sg->GetFullName(), "\\"); std::string curr_folder = target; curr_folder += "/"; - for (std::vector<std::string>::size_type i = 0; i < folders.size(); i++) { - curr_folder += folders[i]; + for (auto const& folder : folders) { + curr_folder += folder; std::map<std::string, cmXCodeObject*>::iterator i_folder = this->GroupNameMap.find(curr_folder); // Create new folder if (i_folder == this->GroupNameMap.end()) { - cmXCodeObject* group = this->CreatePBXGroup(tgroup, folders[i]); + cmXCodeObject* group = this->CreatePBXGroup(tgroup, folder); this->GroupNameMap[curr_folder] = group; tgroup = group; } else { @@ -2855,10 +2820,10 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO")); cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) { + for (auto& CurrentConfigurationType : this->CurrentConfigurationTypes) { cmXCodeObject* buildStyle = this->CreateObject(cmXCodeObject::PBXBuildStyle); - const char* name = this->CurrentConfigurationTypes[i].c_str(); + const char* name = CurrentConfigurationType.c_str(); buildStyle->AddAttribute("name", this->CreateString(name)); buildStyle->SetComment(name); cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); @@ -2891,7 +2856,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( std::string project_id = "PROJECT_"; project_id += root->GetProjectName(); this->RootObject->SetId( - this->GetOrCreateId(project_id.c_str(), this->RootObject->GetId())); + this->GetOrCreateId(project_id, this->RootObject->GetId())); group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->RootObject->AddAttribute("mainGroup", @@ -2907,15 +2872,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( v << std::setfill('0') << std::setw(4) << XcodeVersion * 10; group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str())); this->RootObject->AddAttribute("attributes", group); - if (this->XcodeVersion >= 32) + if (this->XcodeVersion >= 32) { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.2")); - else if (this->XcodeVersion >= 31) + } else if (this->XcodeVersion >= 31) { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.1")); - else + } else { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.0")); + } // Point Xcode at the top of the source tree. { std::string pdir = @@ -2940,8 +2906,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( config->AddAttribute("name", this->CreateString(name)); configs.push_back(std::make_pair(name, config)); } - for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) { - buildConfigurations->AddObject(c->second); + for (auto& config : configs) { + buildConfigurations->AddObject(config.second); } configlist->AddAttribute("buildConfigurations", buildConfigurations); @@ -2999,7 +2965,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot)); - for (Configs::iterator i = configs.begin(); i != configs.end(); ++i) { + for (auto& config : configs) { cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings); // Put this last so it can override existing settings @@ -3009,43 +2975,38 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( d != vars.end(); ++d) { if (d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) { std::string attribute = d->substr(22); - this->FilterConfigurationAttribute(i->first, attribute); + this->FilterConfigurationAttribute(config.first, attribute); if (!attribute.empty()) { cmGeneratorExpression ge; std::string processed = ge.Parse(this->CurrentMakefile->GetDefinition(*d)) - ->Evaluate(this->CurrentLocalGenerator, i->first); + ->Evaluate(this->CurrentLocalGenerator, config.first); buildSettingsForCfg->AddAttribute(attribute, this->CreateString(processed)); } } } // store per-config buildSettings into configuration object - i->second->AddAttribute("buildSettings", buildSettingsForCfg); + config.second->AddAttribute("buildSettings", buildSettingsForCfg); } this->RootObject->AddAttribute("buildConfigurationList", this->CreateObjectReference(configlist)); std::vector<cmXCodeObject*> targets; - for (std::vector<cmLocalGenerator*>::iterator i = generators.begin(); - i != generators.end(); ++i) { - if (!this->CreateXCodeTargets(*i, targets)) { + for (auto& generator : generators) { + if (!this->CreateXCodeTargets(generator, targets)) { return false; } } // loop over all targets and add link and depend info - for (std::vector<cmXCodeObject*>::iterator i = targets.begin(); - i != targets.end(); ++i) { - cmXCodeObject* t = *i; + for (auto t : targets) { this->AddDependAndLinkInformation(t); } this->CreateXCodeDependHackTarget(targets); // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (std::vector<cmXCodeObject*>::iterator i = targets.begin(); - i != targets.end(); ++i) { - cmXCodeObject* t = *i; + for (auto t : targets) { allTargets->AddObject(t); cmXCodeObject* productRef = t->GetObject("productReference"); if (productRef) { @@ -3138,9 +3099,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) { std::string configName = *ct; - for (std::vector<cmXCodeObject*>::iterator i = targets.begin(); - i != targets.end(); ++i) { - cmXCodeObject* target = *i; + for (auto target : targets) { cmGeneratorTarget* gt = target->GetTarget(); if (gt->GetType() == cmStateEnums::EXECUTABLE || @@ -3165,9 +3124,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( target->GetDependTargets().find(*ct); if (y != target->GetDependTargets().end()) { std::vector<std::string> const& deptgts = y->second; - for (std::vector<std::string>::const_iterator d = deptgts.begin(); - d != deptgts.end(); ++d) { - makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": " + for (auto const& deptgt : deptgts) { + makefileStream << this->PostBuildMakeTarget(deptgt, *ct) << ": " << trel << "\n"; } } @@ -3189,9 +3147,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( target->GetDependLibraries().find(*ct); if (x != target->GetDependLibraries().end()) { std::vector<std::string> const& deplibs = x->second; - for (std::vector<std::string>::const_iterator d = deplibs.begin(); - d != deplibs.end(); ++d) { - std::string file = this->ConvertToRelativeForMake(d->c_str()); + for (auto const& deplib : deplibs) { + std::string file = this->ConvertToRelativeForMake(deplib.c_str()); makefileStream << "\\\n\t" << file; dummyRules.insert(file); } @@ -3223,11 +3180,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( if (this->Architectures.size() > 1) { std::string universal = this->GetObjectsNormalDirectory( this->CurrentProject, configName, gt); - for (std::vector<std::string>::iterator arch = - this->Architectures.begin(); - arch != this->Architectures.end(); ++arch) { + for (auto& architecture : this->Architectures) { std::string universalFile = universal; - universalFile += *arch; + universalFile += architecture; universalFile += "/"; universalFile += gt->GetFullName(configName); makefileStream << "\t/bin/rm -f " @@ -3244,22 +3199,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "\n\n" << "# For each target create a dummy rule" << "so the target does not have to exist\n"; - for (std::set<std::string>::const_iterator it = dummyRules.begin(); - it != dummyRules.end(); ++it) { - makefileStream << *it << ":\n"; + for (auto const& dummyRule : dummyRules) { + makefileStream << dummyRule << ":\n"; } } void cmGlobalXCodeGenerator::OutputXCodeProject( cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators) { - if (generators.size() == 0) { + if (generators.empty()) { return; } // Skip local generators that are excluded from this project. - for (std::vector<cmLocalGenerator*>::iterator g = generators.begin(); - g != generators.end(); ++g) { - if (this->IsExcluded(root, *g)) { + for (auto& generator : generators) { + if (this->IsExcluded(root, generator)) { continue; } } @@ -3387,12 +3340,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::Indent(1, fout); fout << "};\n"; cmXCodeObject::Indent(1, fout); - if (this->XcodeVersion >= 32) + if (this->XcodeVersion >= 32) { fout << "objectVersion = 46;\n"; - else if (this->XcodeVersion >= 31) + } else if (this->XcodeVersion >= 31) { fout << "objectVersion = 45;\n"; - else + } else { fout << "objectVersion = 44;\n"; + } cmXCode21Object::PrintList(this->XCodeObjects, fout); cmXCodeObject::Indent(1, fout); fout << "rootObject = " << this->RootObject->GetId() @@ -3512,11 +3466,10 @@ void cmGlobalXCodeGenerator::AppendDefines( { // GCC_PREPROCESSOR_DEFINITIONS is a space-separated list of definitions. std::string def; - for (std::vector<std::string>::const_iterator di = defines.begin(); - di != defines.end(); ++di) { + for (auto const& define : defines) { // Start with -D if requested. def = dflag ? "-D" : ""; - def += *di; + def += define; // Append the flag with needed escapes. std::string tmp; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 81d1bd0..e9ca91c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -106,7 +106,8 @@ protected: private: cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt, cmSourceGroup* sg); - cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, std::string name); + cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, + const std::string& name); bool CreateGroups(std::vector<cmLocalGenerator*>& generators); std::string XCodeEscapePath(const std::string& p); std::string RelativeToSource(const char* p); diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index c8144aa..3ffeabd 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -16,9 +16,7 @@ cmInstalledFile::cmInstalledFile() cmInstalledFile::~cmInstalledFile() { - if (NameExpression) { - delete NameExpression; - } + delete NameExpression; } cmInstalledFile::Property::Property() diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 355c394..853e66c 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -43,9 +43,8 @@ void cmLocalXCodeGenerator::Generate() cmLocalGenerator::Generate(); const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin(); - iter != targets.end(); ++iter) { - (*iter)->HasMacOSXRpathInstallNameDir(""); + for (auto target : targets) { + target->HasMacOSXRpathInstallNameDir(""); } } @@ -54,9 +53,8 @@ void cmLocalXCodeGenerator::GenerateInstallRules() cmLocalGenerator::GenerateInstallRules(); const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator iter = targets.begin(); - iter != targets.end(); ++iter) { - (*iter)->HasMacOSXRpathInstallNameDir(""); + for (auto target : targets) { + target->HasMacOSXRpathInstallNameDir(""); } } @@ -69,10 +67,8 @@ void cmLocalXCodeGenerator::ComputeObjectFilenames( // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. std::map<std::string, int> counts; - for (std::map<cmSourceFile const*, std::string>::iterator si = - mapping.begin(); - si != mapping.end(); ++si) { - cmSourceFile const* sf = si->first; + for (auto& si : mapping) { + cmSourceFile const* sf = si.first; std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); objectName += ".o"; @@ -82,6 +78,6 @@ void cmLocalXCodeGenerator::ComputeObjectFilenames( if (2 == counts[objectNameLower]) { // TODO: emit warning about duplicate name? } - si->second = objectName; + si.second = objectName; } } diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index b05eab7..8c9596f 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -27,16 +27,16 @@ public: ///! Set cache only and recurse to false by default. cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmMakefile* mf); - virtual ~cmLocalXCodeGenerator(); - virtual std::string GetTargetDirectory( - cmGeneratorTarget const* target) const; - virtual void AppendFlagEscape(std::string& flags, - const std::string& rawFlag); - virtual void Generate(); + ~cmLocalXCodeGenerator() override; + std::string GetTargetDirectory( + cmGeneratorTarget const* target) const override; + void AppendFlagEscape(std::string& flags, + const std::string& rawFlag) override; + void Generate() override; virtual void GenerateInstallRules(); - virtual void ComputeObjectFilenames( + void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, - cmGeneratorTarget const* gt = nullptr); + cmGeneratorTarget const* gt = nullptr) override; private: }; diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 3706dd3..7294c1c 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -134,7 +134,7 @@ public: : cmMachOHeaderAndLoadCommands(_swap) { } - bool read_mach_o(cmsys::ifstream& fin) + bool read_mach_o(cmsys::ifstream& fin) override { if (!read(fin, this->Header)) { return false; @@ -251,8 +251,7 @@ cmMachOInternal::cmMachOInternal(const char* fname) } // parse each Mach-O file - for (size_t i = 0; i < this->FatArchs.size(); i++) { - const fat_arch& arch = this->FatArchs[i]; + for (const auto& arch : this->FatArchs) { if (!this->read_mach_o(OSSwapBigToHostInt32(arch.offset))) { return; } @@ -265,8 +264,8 @@ cmMachOInternal::cmMachOInternal(const char* fname) cmMachOInternal::~cmMachOInternal() { - for (size_t i = 0; i < this->MachOList.size(); i++) { - delete this->MachOList[i]; + for (auto& i : this->MachOList) { + delete i; } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 32181cf..5643c97 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3186,8 +3186,8 @@ int cmMakefile::TryCompile(const std::string& srcdir, // do a configure cm.SetHomeDirectory(srcdir); cm.SetHomeOutputDirectory(bindir); - cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform()); - cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); + cm.SetGeneratorPlatform(this->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM")); + cm.SetGeneratorToolset(this->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET")); cm.LoadCache(); if (!gg->IsMultiConfig()) { if (const char* config = diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 9befd65..c6f0a51 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -613,6 +613,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); std::string const autogenTargetName = GetAutogenTargetName(target); + std::string const autogenInfoDir = GetAutogenTargetFilesDir(target); std::string const autogenBuildDir = GetAutogenTargetBuildDir(target); std::string const workingDirectory = cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory()); @@ -630,8 +631,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( AddCleanFile(makefile, autogenBuildDir); // Remove old settings on cleanup { - std::string base = GetAutogenTargetFilesDir(target); - base += "/AutogenOldSettings"; + std::string base = autogenInfoDir + "/AutogenOldSettings"; if (multiConfig == cmQtAutoGen::SINGLE) { AddCleanFile(makefile, base.append(".cmake")); } else { @@ -652,7 +652,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( currentLine.push_back(cmSystemTools::GetCMakeCommand()); currentLine.push_back("-E"); currentLine.push_back("cmake_autogen"); - currentLine.push_back(GetAutogenTargetFilesDir(target)); + currentLine.push_back(autogenInfoDir); currentLine.push_back("$<CONFIGURATION>"); commandLines.push_back(currentLine); } @@ -662,23 +662,24 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( { std::vector<std::string> toolNames; if (digest.MocEnabled) { - toolNames.push_back("MOC"); + toolNames.emplace_back("MOC"); } if (digest.UicEnabled) { - toolNames.push_back("UIC"); + toolNames.emplace_back("UIC"); } if (digest.RccEnabled) { - toolNames.push_back("RCC"); + toolNames.emplace_back("RCC"); } - std::string tools = toolNames[0]; + std::string tools = toolNames.front(); toolNames.erase(toolNames.begin()); - while (toolNames.size() > 1) { - tools += ", " + toolNames[0]; - toolNames.erase(toolNames.begin()); - } - if (toolNames.size() == 1) { - tools += " and " + toolNames[0]; + if (!toolNames.empty()) { + while (toolNames.size() > 1) { + tools += ", "; + tools += toolNames.front(); + toolNames.erase(toolNames.begin()); + } + tools += " and " + toolNames.front(); } autogenComment = "Automatic " + tools + " for target " + target->GetName(); } @@ -809,27 +810,35 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071); msg += "\n"; std::string tools; - if (digest.MocEnabled) { - tools += "AUTOMOC"; + std::string property; + if (digest.MocEnabled && digest.UicEnabled) { + tools = "AUTOMOC and AUTOUIC"; + property = "SKIP_AUTOGEN"; + } else if (digest.MocEnabled) { + tools = "AUTOMOC"; + property = "SKIP_AUTOMOC"; + } else if (digest.UicEnabled) { + tools = "AUTOUIC"; + property = "SKIP_AUTOUIC"; } - if (digest.UicEnabled) { - if (!tools.empty()) { - tools += ","; - } - tools += "AUTOUIC"; + msg += "For compatibility, CMake is excluding the GENERATED source " + "file(s):\n"; + for (const std::string& absFile : generatedHeaders) { + msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n"); } - if (!generatedHeaders.empty()) { - msg.append(tools).append(": Ignoring GENERATED header file(s):\n"); - for (std::string const& absFile : generatedHeaders) { - msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n"); - } - } - if (!generatedSources.empty()) { - msg.append(tools).append(": Ignoring GENERATED source file(s):\n"); - for (std::string const& absFile : generatedSources) { - msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n"); - } + for (const std::string& absFile : generatedSources) { + msg.append(" ").append(cmQtAutoGen::Quoted(absFile)).append("\n"); } + msg += "from processing by "; + msg += tools; + msg += + ". If any of the files should be processed, set CMP0071 to NEW. " + "If any of the files should not be processed, " + "explicitly exclude them by setting the source file property "; + msg += property; + msg += ":\n set_property(SOURCE file.h PROPERTY "; + msg += property; + msg += " ON)\n"; makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } } @@ -1088,8 +1097,13 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( // Generate info file { - std::string infoFile = GetAutogenTargetFilesDir(target); - infoFile += "/AutogenInfo.cmake"; + std::string const infoDir = GetAutogenTargetFilesDir(target); + if (!cmSystemTools::MakeDirectory(infoDir)) { + std::string emsg = ("Could not create directory: "); + emsg += cmQtAutoGen::Quoted(infoDir); + cmSystemTools::Error(emsg.c_str()); + } + std::string const infoFile = infoDir + "/AutogenInfo.cmake"; { std::string infoFileIn = cmSystemTools::GetCMakeRoot(); infoFileIn += "/Modules/AutogenInfo.cmake.in"; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index bd0fb9a..f13312f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -149,12 +149,6 @@ cmQtAutoGenerators::cmQtAutoGenerators() } } - // Moc macro filters - this->MocMacroFilters.emplace_back( - "Q_OBJECT", "[\n][ \t]*{?[ \t]*Q_OBJECT[^a-zA-Z0-9_]"); - this->MocMacroFilters.emplace_back( - "Q_GADGET", "[\n][ \t]*{?[ \t]*Q_GADGET[^a-zA-Z0-9_]"); - // Precompile regular expressions this->MocRegExpInclude.compile( "[\n][ \t]*#[ \t]*include[ \t]+" @@ -326,7 +320,7 @@ bool cmQtAutoGenerators::InitInfoFile(cmMakefile* makefile, InfoGetList("AM_MOC_MACRO_NAMES"); for (std::string const& item : MocMacroNames) { this->MocMacroFilters.emplace_back( - item, ("[^a-zA-Z0-9_]" + item).append("[^a-zA-Z0-9_]")); + item, ("[\n][ \t]*{?[ \t]*" + item).append("[^a-zA-Z0-9_]")); } } { diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 1b47608..e835b7a 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -602,11 +602,12 @@ bool LanguageData::operator==(const LanguageData& other) const 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 = result; + Defines = std::move(result); } namespace std { diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index fb5b330..467682d 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -90,8 +90,7 @@ private: void Update(cmSourceFileLocation const& loc); void UpdateExtension(const std::string& name); - cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) - CM_EQ_DELETE; + cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) = delete; }; #endif diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 5aa8e5b..85e6366 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -442,6 +442,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, std::vector<std::string> child_dirs; std::vector<cmStateSnapshot> const& children = this->DirectoryState->Children; + child_dirs.reserve(children.size()); for (cmStateSnapshot const& ci : children) { child_dirs.push_back(ci.GetDirectory().GetCurrentSource()); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 4fd10a4..63c1452 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -700,6 +700,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, double timeout, Encoding encoding) { std::vector<const char*> argv; + argv.reserve(command.size() + 1); for (std::string const& cmd : command) { argv.push_back(cmd.c_str()); } @@ -2065,7 +2066,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) #undef CM_EXE_PATH_LOCAL_SIZE char* exe_path = exe_path_local; if (_NSGetExecutablePath(exe_path, &exe_path_size) < 0) { - exe_path = (char*)malloc(exe_path_size); + exe_path = static_cast<char*>(malloc(exe_path_size)); _NSGetExecutablePath(exe_path, &exe_path_size); } exe_dir = @@ -2325,12 +2326,12 @@ struct cmSystemToolsRPathInfo }; #endif +#if defined(CMAKE_USE_ELF_PARSER) bool cmSystemTools::ChangeRPath(std::string const& file, std::string const& oldRPath, std::string const& newRPath, std::string* emsg, bool* changed) { -#if defined(CMAKE_USE_ELF_PARSER) if (changed) { *changed = false; } @@ -2496,15 +2497,16 @@ bool cmSystemTools::ChangeRPath(std::string const& file, *changed = true; } return true; +} #else - (void)file; - (void)oldRPath; - (void)newRPath; - (void)emsg; - (void)changed; +bool cmSystemTools::ChangeRPath(std::string const& /*file*/, + std::string const& /*oldRPath*/, + std::string const& /*newRPath*/, + std::string* /*emsg*/, bool* /*changed*/) +{ return false; -#endif } +#endif bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, const char* lhss, const char* rhss) @@ -2638,10 +2640,10 @@ int cmSystemTools::strverscmp(std::string const& lhs, std::string const& rhs) return cm_strverscmp(lhs.c_str(), rhs.c_str()); } +#if defined(CMAKE_USE_ELF_PARSER) bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, bool* removed) { -#if defined(CMAKE_USE_ELF_PARSER) if (removed) { *removed = false; } @@ -2779,13 +2781,14 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, *removed = true; } return true; +} #else - (void)file; - (void)emsg; - (void)removed; +bool cmSystemTools::RemoveRPath(std::string const& /*file*/, + std::string* /*emsg*/, bool* /*removed*/) +{ return false; -#endif } +#endif bool cmSystemTools::CheckRPath(std::string const& file, std::string const& newRPath) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e163783..6535008 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1592,6 +1592,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) std::string shaderEntryPoint; std::string shaderModel; std::string shaderAdditionalFlags; + std::string outputHeaderFile; + std::string variableName; std::string settingsGenerator; std::string settingsLastGenOutput; std::string sourceLink; @@ -1641,6 +1643,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) shaderModel = sm; toolHasSettings = true; } + // Figure out which output header file to use if any + if (const char* ohf = sf->GetProperty("VS_SHADER_OUTPUT_HEADER_FILE")) { + outputHeaderFile = ohf; + toolHasSettings = true; + } + // Figure out which variable name to use if any + if (const char* vn = sf->GetProperty("VS_SHADER_VARIABLE_NAME")) { + variableName = vn; + toolHasSettings = true; + } // Figure out if there's any additional flags to use if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS")) { shaderAdditionalFlags = saf; @@ -1766,6 +1778,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel) << "</ShaderModel>\n"; } + if (!outputHeaderFile.empty()) { + for (size_t i = 0; i != this->Configurations.size(); ++i) { + this->WriteString("<HeaderFileOutput Condition=\"" + "'$(Configuration)|$(Platform)'=='", + 3); + (*this->BuildFileStream) << this->Configurations[i] << "|" + << this->Platform << "'\">" + << cmVS10EscapeXML(outputHeaderFile); + this->WriteString("</HeaderFileOutput>\n", 0); + } + } + if (!variableName.empty()) { + for (size_t i = 0; i != this->Configurations.size(); ++i) { + this->WriteString("<VariableName Condition=\"" + "'$(Configuration)|$(Platform)'=='", + 3); + (*this->BuildFileStream) << this->Configurations[i] << "|" + << this->Platform << "'\">" + << cmVS10EscapeXML(variableName); + this->WriteString("</VariableName>\n", 0); + } + } if (!shaderAdditionalFlags.empty()) { this->WriteString("<AdditionalOptions>", 3); (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index 719e627..a9bb2ef 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -34,9 +34,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v, std::ostream& out, PBXType t) { bool hasOne = false; - for (std::vector<cmXCodeObject*>::const_iterator i = v.begin(); i != v.end(); - ++i) { - cmXCodeObject* obj = *i; + for (auto obj : v) { if (obj->GetType() == OBJECT && obj->GetIsA() == t) { hasOne = true; break; @@ -46,9 +44,7 @@ void cmXCode21Object::PrintList(std::vector<cmXCodeObject*> const& v, return; } out << "\n/* Begin " << PBXTypeNames[t] << " section */\n"; - for (std::vector<cmXCodeObject*>::const_iterator i = v.begin(); i != v.end(); - ++i) { - cmXCodeObject* obj = *i; + for (auto obj : v) { if (obj->GetType() == OBJECT && obj->GetIsA() == t) { obj->Print(out); } diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h index bcd8d93..8e4b80f 100644 --- a/Source/cmXCode21Object.h +++ b/Source/cmXCode21Object.h @@ -14,7 +14,7 @@ class cmXCode21Object : public cmXCodeObject { public: cmXCode21Object(PBXType ptype, Type type); - virtual void PrintComment(std::ostream&); + void PrintComment(std::ostream&) override; static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out, PBXType t); static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 957adb4..e54f1f3 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -120,8 +120,9 @@ void cmXCodeObject::Print(std::ostream& out) out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; for (i = this->ObjectAttributes.begin(); i != this->ObjectAttributes.end(); ++i) { - if (i->first == "isa") + if (i->first == "isa") { continue; + } PrintAttribute(out, 3, separator, indentFactor, i->first, i->second, this); } @@ -129,9 +130,9 @@ void cmXCodeObject::Print(std::ostream& out) out << "};\n"; } -void cmXCodeObject::PrintAttribute(std::ostream& out, const int level, - const std::string separator, - const int factor, const std::string& name, +void cmXCodeObject::PrintAttribute(std::ostream& out, int level, + const std::string& separator, int factor, + const std::string& name, const cmXCodeObject* object, const cmXCodeObject* parent) { @@ -203,9 +204,9 @@ void cmXCodeObject::PrintList(std::vector<cmXCodeObject*> const& objs, { cmXCodeObject::Indent(1, out); out << "objects = {\n"; - for (unsigned int i = 0; i < objs.size(); ++i) { - if (objs[i]->TypeValue == OBJECT) { - objs[i]->Print(out); + for (auto obj : objs) { + if (obj->TypeValue == OBJECT) { + obj->Print(out); } } cmXCodeObject::Indent(1, out); diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b51aac7..b0f1d31 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -94,8 +94,8 @@ public: } static void Indent(int level, std::ostream& out); void Print(std::ostream& out); - void PrintAttribute(std::ostream& out, const int level, - const std::string separator, const int factor, + void PrintAttribute(std::ostream& out, int level, + const std::string& separator, int factor, const std::string& name, const cmXCodeObject* object, const cmXCodeObject* parent); virtual void PrintComment(std::ostream&) {} @@ -119,9 +119,7 @@ public: // search the attribute list for an object of the specified type cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const { - for (std::vector<cmXCodeObject*>::const_iterator i = this->List.begin(); - i != this->List.end(); ++i) { - cmXCodeObject* o = *i; + for (auto o : this->List) { if (o->IsA == t) { return o; } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index bca39af..f1dce64 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -91,7 +91,7 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, - std::string configuration, + const std::string& configuration, const std::string& container) { xout.StartElement("TestAction"); @@ -104,12 +104,11 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); xout.StartElement("Testables"); - for (TestObjects::const_iterator it = this->Tests.begin(); - it != this->Tests.end(); ++it) { + for (auto test : this->Tests) { xout.StartElement("TestableReference"); xout.BreakAttributes(); xout.Attribute("skipped", "NO"); - WriteBuildableReference(xout, *it, container); + WriteBuildableReference(xout, test, container); xout.EndElement(); // TestableReference } xout.EndElement(); @@ -127,7 +126,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, - std::string configuration, + const std::string& configuration, const std::string& container) { xout.StartElement("LaunchAction"); @@ -164,7 +163,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("ProfileAction"); xout.BreakAttributes(); @@ -177,7 +176,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("AnalyzeAction"); xout.BreakAttributes(); @@ -186,7 +185,7 @@ void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("ArchiveAction"); xout.BreakAttributes(); @@ -223,8 +222,9 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name) // if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) == this->ConfigList.end() && - this->ConfigList.size() > 0) + !this->ConfigList.empty()) { return this->ConfigList[0]; + } return name; } diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index def75b1..e5e501a 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -37,13 +37,13 @@ private: void WriteXCodeXCScheme(std::ostream& fout, const std::string& container); void WriteBuildAction(cmXMLWriter& xout, const std::string& container); - void WriteTestAction(cmXMLWriter& xout, std::string configuration, + void WriteTestAction(cmXMLWriter& xout, const std::string& configuration, const std::string& container); - void WriteLaunchAction(cmXMLWriter& xout, std::string configuration, + void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration, const std::string& container); - void WriteProfileAction(cmXMLWriter& xout, std::string configuration); - void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration); - void WriteArchiveAction(cmXMLWriter& xout, std::string configuration); + void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration); + void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration); + void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration); void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj, const std::string& container); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 61595d5..fd7151f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1328,9 +1328,8 @@ int cmake::ActualConfigure() if (const char* platformName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) { - if (this->GeneratorPlatform.empty()) { - this->GeneratorPlatform = platformName; - } else if (this->GeneratorPlatform != platformName) { + if (!this->GeneratorPlatform.empty() && + this->GeneratorPlatform != platformName) { std::string message = "Error: generator platform: "; message += this->GeneratorPlatform; message += "\nDoes not match the platform used previously: "; @@ -1348,9 +1347,7 @@ int cmake::ActualConfigure() if (const char* tsName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) { - if (this->GeneratorToolset.empty()) { - this->GeneratorToolset = tsName; - } else if (this->GeneratorToolset != tsName) { + if (!this->GeneratorToolset.empty() && this->GeneratorToolset != tsName) { std::string message = "Error: generator toolset: "; message += this->GeneratorToolset; message += "\nDoes not match the toolset used previously: "; diff --git a/Source/cmake.h b/Source/cmake.h index a2054ef..b31b6f5 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -209,24 +209,12 @@ public: this->GeneratorPlatform = ts; } - ///! Get the name of the selected generator-specific platform. - std::string const& GetGeneratorPlatform() const - { - return this->GeneratorPlatform; - } - ///! Set the name of the selected generator-specific toolset. void SetGeneratorToolset(std::string const& ts) { this->GeneratorToolset = ts; } - ///! Get the name of the selected generator-specific toolset. - std::string const& GetGeneratorToolset() const - { - return this->GeneratorToolset; - } - const std::vector<std::string>& GetSourceExtensions() const { return this->SourceFileExtensions; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5a9e321..c0c7d03 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -348,6 +348,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) std::bind(&cmcmd::HandleCppCheck, a1, a2, a3); // copy the command options to a vector of strings std::vector<std::string> commandOptions; + commandOptions.reserve(coCompileTypes.size()); for (const auto& i : coCompileTypes) { commandOptions.push_back(i.first); } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index fe24a72..f6466fa 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -186,6 +186,7 @@ int main(int argc, char const* const* argv) // copy the args to a vector std::vector<std::string> args; + args.reserve(argc); for (int i = 0; i < argc; ++i) { args.push_back(argv[i]); } diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 81ab734..ec35b89 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -66,15 +66,6 @@ set_property(TARGET mocOnly PROPERTY AUTOMOC ON) target_link_libraries(mocOnly ${QT_LIBRARIES}) # -- Test -# MOC AUTOMOC_MACRO_NAMES -if (NOT QT_TEST_VERSION STREQUAL 4) - add_executable(mocMacroName mocMacroName/main.cpp mocMacroName/MacroName.cpp) - set_property(TARGET mocMacroName PROPERTY AUTOMOC ON) - set_property(TARGET mocMacroName PROPERTY AUTOMOC_MACRO_NAMES "QO_ALIAS") - target_link_libraries(mocMacroName ${QT_LIBRARIES}) -endif() - -# -- Test # UIC only if(ALLOW_WRAP_CPP) qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) @@ -188,8 +179,10 @@ set_property(TARGET skipRccB PROPERTY AUTOMOC ON) target_link_libraries(skipRccB ${QT_LIBRARIES}) # -- Test -# Source files with the same basename in different subdirectories -add_subdirectory(sameName) +# MOC AUTOMOC_MACRO_NAMES +if (NOT QT_TEST_VERSION STREQUAL 4) + add_subdirectory(mocMacroName) +endif() # -- Test # Tests AUTOMOC with generated sources @@ -217,5 +210,9 @@ add_subdirectory(uicInclude) add_subdirectory(objectLibrary) # -- Test +# Source files with the same basename in different subdirectories +add_subdirectory(sameName) + +# -- Test # Complex test case add_subdirectory(complex) diff --git a/Tests/QtAutogen/mocMacroName/CMakeLists.txt b/Tests/QtAutogen/mocMacroName/CMakeLists.txt new file mode 100644 index 0000000..08e6803 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.9) + +list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS") + +add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp) +set_property(TARGET mmn PROPERTY AUTOMOC ON) +set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS") +target_link_libraries(mmn ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp new file mode 100644 index 0000000..93e5bfd --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp @@ -0,0 +1,8 @@ +#ifndef CUSTOM_MACROS_HPP +#define CUSTOM_MACROS_HPP + +#include <QObject> +#define QO1_ALIAS Q_OBJECT +#define QO2_ALIAS Q_OBJECT + +#endif diff --git a/Tests/QtAutogen/mocMacroName/Gadget.cpp b/Tests/QtAutogen/mocMacroName/Gadget.cpp new file mode 100644 index 0000000..167faeb --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Gadget.cpp @@ -0,0 +1,6 @@ +#include "Gadget.hpp" + +Gadget::Gadget() + : test(0) +{ +} diff --git a/Tests/QtAutogen/mocMacroName/Gadget.hpp b/Tests/QtAutogen/mocMacroName/Gadget.hpp new file mode 100644 index 0000000..2587ed2 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Gadget.hpp @@ -0,0 +1,15 @@ +#ifndef GADGET_HPP +#define GADGET_HPP + +#include <QMetaType> + +class Gadget +{ + Q_GADGET + Q_PROPERTY(int test MEMBER test) +public: + Gadget(); + int test; +}; + +#endif diff --git a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp b/Tests/QtAutogen/mocMacroName/MacroAlias.hpp deleted file mode 100644 index cf06f2a..0000000 --- a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef MACROALIAS_HPP -#define MACROALIAS_HPP - -#include <QObject> -#define QO_ALIAS Q_OBJECT - -#endif diff --git a/Tests/QtAutogen/mocMacroName/MacroName.cpp b/Tests/QtAutogen/mocMacroName/MacroName.cpp deleted file mode 100644 index 78d04a8..0000000 --- a/Tests/QtAutogen/mocMacroName/MacroName.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "MacroName.hpp" - -MacroName::MacroName() -{ -} - -void MacroName::aSlot() -{ -} diff --git a/Tests/QtAutogen/mocMacroName/MacroName.hpp b/Tests/QtAutogen/mocMacroName/MacroName.hpp deleted file mode 100644 index b6c7306..0000000 --- a/Tests/QtAutogen/mocMacroName/MacroName.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MACRONAME_HPP -#define MACRONAME_HPP - -#include "MacroAlias.hpp" - -// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES) -class MacroName : public QObject -{ - QO_ALIAS -public: - MacroName(); - -signals: - void aSignal(); - -public slots: - void aSlot(); -}; - -#endif diff --git a/Tests/QtAutogen/mocMacroName/Object.cpp b/Tests/QtAutogen/mocMacroName/Object.cpp new file mode 100644 index 0000000..c0b4f33 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object.cpp @@ -0,0 +1,9 @@ +#include "Object.hpp" + +Object::Object() +{ +} + +void Object::aSlot() +{ +} diff --git a/Tests/QtAutogen/mocMacroName/Object.hpp b/Tests/QtAutogen/mocMacroName/Object.hpp new file mode 100644 index 0000000..0c40824 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object.hpp @@ -0,0 +1,19 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include <QObject> + +class Object : public QObject +{ + Q_OBJECT + Q_PROPERTY(int test MEMBER test) +public: + Object(); + + Q_SLOT + void aSlot(); + + int test; +}; + +#endif diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp new file mode 100644 index 0000000..b8b4806 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object1Aliased.hpp" + +Object1Aliased::Object1Aliased() +{ +} + +void Object1Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp new file mode 100644 index 0000000..6c6bb40 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp @@ -0,0 +1,20 @@ +#ifndef OBJECTALIASED_HPP +#define OBJECTALIASED_HPP + +#include "CustomMacros.hpp" + +// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES) +class Object1Aliased : public QObject +{ + QO1_ALIAS +public: + Object1Aliased(); + +signals: + void aSignal(); + +public slots: + void aSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp new file mode 100644 index 0000000..4b09dd1 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object2Aliased.hpp" + +Object2Aliased::Object2Aliased() +{ +} + +void Object2Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp new file mode 100644 index 0000000..b9bdc12 --- /dev/null +++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp @@ -0,0 +1,20 @@ +#ifndef OBJECT2ALIASED_HPP +#define OBJECT2ALIASED_HPP + +#include "CustomMacros.hpp" + +// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES) +class Object2Aliased : public QObject +{ + QO2_ALIAS +public: + Object2Aliased(); + +signals: + void aSignal(); + +public slots: + void aSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/mocMacroName/main.cpp b/Tests/QtAutogen/mocMacroName/main.cpp index 67ee81f..3b45d04 100644 --- a/Tests/QtAutogen/mocMacroName/main.cpp +++ b/Tests/QtAutogen/mocMacroName/main.cpp @@ -1,7 +1,13 @@ -#include "MacroName.hpp" +#include "Gadget.hpp" +#include "Object.hpp" +#include "Object1Aliased.hpp" +#include "Object2Aliased.hpp" int main(int argv, char** args) { - MacroName macroName; + Gadget gadget; + Object object; + Object1Aliased object1Aliased; + Object2Aliased object2Aliased; return 0; } diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index 2b0c478..acda117 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -116,12 +116,14 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3) -set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"") +set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED") +set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h") set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex) set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS) set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3) -set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"") +set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED") +set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h") source_group("Source Files" FILES ${SOURCE_FILES}) @@ -1270,7 +1270,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" -cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE" cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH" cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)" |