diff options
143 files changed, 929 insertions, 711 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index a1b43c5..8ae57d4 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -352,7 +352,7 @@ and store the result as a list in LISTVAR." ;;;###autoload (defun cmake-help () - "Queries for any of the four available help topics and prints out the approriate page." + "Queries for any of the four available help topics and prints out the appropriate page." (interactive) (let* ((default-entry (cmake-symbol-at-point)) (command-list (cmake-get-list "command")) diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst index 799493f..716f457 100644 --- a/Help/command/execute_process.rst +++ b/Help/command/execute_process.rst @@ -90,8 +90,10 @@ Options: Use the ANSI codepage. ``OEM`` Use the original equipment manufacturer (OEM) code page. - ``UTF8`` - Use the UTF-8 codepage. + ``UTF8`` or ``UTF-8`` + Use the UTF-8 codepage. Prior to CMake 3.11.0, only ``UTF8`` was accepted + for this encoding. In CMake 3.11.0, ``UTF-8`` was added for consistency with + the `UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention. If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the same pipe the precedence is not specified. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 83f4716..b2e70f2 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -176,7 +176,7 @@ claim compatibility with the version requested it is unspecified which one is chosen: unless the variable :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` is set no attempt is made to choose a highest or closest version number. -To control the order in which ``find_package`` checks for compatibiliy use +To control the order in which ``find_package`` checks for compatibility use the two variables :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` and :variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION`. For instance in order to select the highest version one can set:: diff --git a/Help/command/install.rst b/Help/command/install.rst index 9f9ee13..f43b2a0 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -347,7 +347,7 @@ included in the export but a target to which it links is not included the behavior is unspecified. In addition to cmake language files, the ``EXPORT_ANDROID_MK`` option maybe -used to specifiy an export to the android ndk build system. The Android +used to specify an export to the android ndk build system. The Android NDK supports the use of prebuilt libraries, both static and shared. This allows cmake to build the libraries of a project and make them available to an ndk build system complete with transitive dependencies, include flags diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 28171c6..1ddcb1b 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -162,7 +162,7 @@ When the server is busy for a long time, it is polite to send back replies of type "progress" to the client. These will contain a "progressMessage" with a string describing the action currently taking place as well as "progressMinimum", "progressMaximum" and "progressCurrent" with integer values -describing the range of progess. +describing the range of progress. Messages of type "progress" will be followed by more "progress" messages or with a message of type "reply" or "error" that complete the request. diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 8041960..d1afeb7 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -11,7 +11,7 @@ diagnostics expect target names to match a restricted pattern. Target names may contain upper and lower case letters, numbers, the underscore character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS -targets and IMPORTED targets may contain two consequtive colons. +targets and IMPORTED targets may contain two consecutive colons. Target names reserved by one or more CMake generators are not allowed. Among others these include "all", "clean", "help", and "install". diff --git a/Help/prop_sf/GENERATED.rst b/Help/prop_sf/GENERATED.rst index a3aa127..d430ee2 100644 --- a/Help/prop_sf/GENERATED.rst +++ b/Help/prop_sf/GENERATED.rst @@ -1,8 +1,23 @@ GENERATED --------- -Is this source file generated as part of the build process. +Is this source file generated as part of the build or CMake process. -If a source file is generated by the build process CMake will handle -it differently in terms of dependency checking etc. Otherwise having -a non-existent source file could create problems. +Tells the internal CMake engine that a source file is generated by an outside +process such as another build step, or the execution of CMake itself. This +information is then used to exempt the file from any existence or validity +checks. Generated files are created by the execution of commands such as +:command:`add_custom_command` and :command:`file(GENERATE)`. + +When a generated file created by an :command:`add_custom_command` command +is explicitly listed as a source file for any target in the same +directory scope (which usually means the same ``CMakeLists.txt`` file), +CMake will automatically create a dependency to make sure the file is +generated before building that target. + +Generated sources may be hidden in some IDE tools, while in others they might +be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC` +or :prop_tgt:`AUTORCC` functionality, the :prop_gbl:`AUTOGEN_SOURCE_GROUP`, +:prop_gbl:`AUTOMOC_SOURCE_GROUP` and :prop_gbl:`AUTORCC_SOURCE_GROUP` target +properties may influence where the generated sources are grouped in the project's +file lists. diff --git a/Help/prop_tgt/OUTPUT_NAME.rst b/Help/prop_tgt/OUTPUT_NAME.rst index f1bdb7c..4b33b38 100644 --- a/Help/prop_tgt/OUTPUT_NAME.rst +++ b/Help/prop_tgt/OUTPUT_NAME.rst @@ -5,7 +5,8 @@ Output name for target files. This sets the base name for output files created for an executable or library target. If not set, the logical target name is used by -default. +default during generation. The value is not set by default during +configuration. Contents of ``OUTPUT_NAME`` and the variants listed below may use :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/cpack-rpm-check-executable-flags.rst b/Help/release/dev/cpack-rpm-check-executable-flags.rst index 30475d6..5221417 100644 --- a/Help/release/dev/cpack-rpm-check-executable-flags.rst +++ b/Help/release/dev/cpack-rpm-check-executable-flags.rst @@ -2,5 +2,5 @@ cpack-rpm-check-executable-flags -------------------------------- * The :module:`CPackRPM` module learned to enable enforcing of execute - privilages on programs and shared libraries. + privileges on programs and shared libraries. See :variable:`CPACK_RPM_INSTALL_WITH_EXEC` variable. diff --git a/Help/release/dev/doxygen-verbatim-vars.rst b/Help/release/dev/doxygen-verbatim-vars.rst new file mode 100644 index 0000000..761290e --- /dev/null +++ b/Help/release/dev/doxygen-verbatim-vars.rst @@ -0,0 +1,8 @@ +FindDoxygen +----------- + +* The :command:`doxygen_add_docs` function of the :module:`FindDoxygen` module + now supports a new ``DOXYGEN_VERBATIM_VARS`` list variable. Any + ``DOXYGEN_...`` variable contained in that list will bypass the automatic + quoting logic, leaving its contents untouched when transferring them to the + output Doxyfile. diff --git a/Help/release/dev/iphone-deployment-target.rst b/Help/release/dev/iphone-deployment-target.rst new file mode 100644 index 0000000..e586df6 --- /dev/null +++ b/Help/release/dev/iphone-deployment-target.rst @@ -0,0 +1,11 @@ +iphone-deployment-target +------------------------ + +* The minimum deployment target set in the + :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` variable used to be only + applied for macOS regardless of the selected SDK. It is now properly + set for the target platform selected by :variable:`CMAKE_OSX_SYSROOT`. + + If for example the sysroot variable specifies an iOS SDK then the + value in ``CMAKE_OSX_DEPLOYMENT_TARGET`` is interpreted as minium + iOS version. diff --git a/Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst b/Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst index 4fb2caa..9df5edd 100644 --- a/Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst +++ b/Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst @@ -1,10 +1,12 @@ CMAKE_OSX_DEPLOYMENT_TARGET --------------------------- -Specify the minimum version of OS X on which the target binaries are -to be deployed. CMake uses this value for the ``-mmacosx-version-min`` -flag and to help choose the default SDK -(see :variable:`CMAKE_OSX_SYSROOT`). +Specify the minimum version of the target platform (e.g. macOS or iOS) +on which the target binaries are to be deployed. CMake uses this +variable value for the ``-mmacosx-version-min`` flag or their respective +target platform equivalents. For older Xcode versions that shipped +multiple macOS SDKs this variable also helps to choose the SDK in case +:variable:`CMAKE_OSX_SYSROOT` is unset. If not set explicitly the value is initialized by the ``MACOSX_DEPLOYMENT_TARGET`` environment variable, if set, diff --git a/Help/variable/CMAKE_OSX_VARIABLE.txt b/Help/variable/CMAKE_OSX_VARIABLE.txt index 385f871..5b84726 100644 --- a/Help/variable/CMAKE_OSX_VARIABLE.txt +++ b/Help/variable/CMAKE_OSX_VARIABLE.txt @@ -3,4 +3,7 @@ The value of this variable should be set prior to the first because it may influence configuration of the toolchain and flags. It is intended to be set locally by the user creating a build tree. -This variable is ignored on platforms other than OS X. +Despite the ``OSX`` part in the variable name(s) they apply also to +other SDKs than macOS like iOS, tvOS, or watchOS. + +This variable is ignored on platforms other than Apple. diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst index ba9df5a..5ca40a3 100644 --- a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst +++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst @@ -2,5 +2,5 @@ CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE ------------------------------------ A CMake language file or module to be included by the :command:`project` -command. This is is intended for injecting custom code into project +command. This is intended for injecting custom code into project builds without modifying their source. diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 20dcf1b..600d558 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -2,7 +2,7 @@ # file Copyright.txt or https://cmake.org/licensing for details. -# This module is used by the Makefile generator to determin the following variables: +# This module is used by the Makefile generator to determine the following variables: # CMAKE_SYSTEM_NAME - on unix this is uname -s, for windows it is Windows # CMAKE_SYSTEM_VERSION - on unix this is uname -r, for windows it is empty # CMAKE_SYSTEM - ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}, for windows: ${CMAKE_SYSTEM} diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index ad065f0..21a3065 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -50,6 +50,10 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) endif() if(NOT CEIT_CONFIGURATION) + # Would be better to test GENERATOR_IS_MULTI_CONFIG global property, + # but the documented behavior specifically says we check + # CMAKE_CONFIGURATION_TYPES and fall back to CMAKE_BUILD_TYPE if no + # config types are defined. if(CMAKE_CONFIGURATION_TYPES) list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) else() diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 1261137..7c41d49 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -17,7 +17,7 @@ # i.e. GNU/Intel/Clang/MSVC, etc. # ``LANGUAGE`` # language for which the result will be used, -# i.e. C/CXX/Fortan/ASM +# i.e. C/CXX/Fortran/ASM # ``MODE`` # ``EXIST`` # only check for existence of the given package diff --git a/Modules/CMakeJavaInformation.cmake b/Modules/CMakeJavaInformation.cmake index 844bbbb..11568a8 100644 --- a/Modules/CMakeJavaInformation.cmake +++ b/Modules/CMakeJavaInformation.cmake @@ -30,7 +30,7 @@ if(NOT CMAKE_Java_CREATE_STATIC_LIBRARY) set(CMAKE_Java_CREATE_STATIC_LIBRARY "<CMAKE_Java_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> ${class_files_mask}") - # "${class_files_mask}" should really be "<OBJECTS>" but compling a *.java + # "${class_files_mask}" should really be "<OBJECTS>" but compiling a *.java # file can create more than one *.class file... endif() diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 54f6133..9d733dc 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -843,7 +843,7 @@ if(CPACK_IFW_VERBOSE) endif() endif() if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION) - message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manualy.") + message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manually.") endif() #============================================================================= diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index c723e72..27737e5 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -263,7 +263,7 @@ # between the system on which the installer is created # and the system on which the installer might be used into account. # -# It is therefor possible that the installer e.g. might try to install +# It is therefore possible that the installer e.g. might try to install # onto a drive that is unavailable or unintended or a path that does not # follow the localization or convention of the system on which the # installation is performed. diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index ff9aada..838fbbf 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -3,7 +3,7 @@ if(NOT RUN_FROM_CTEST_OR_DART) - message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly") + message(FATAL_ERROR "Do not include CTestTargets.cmake directly") endif() if(NOT PROJECT_BINARY_DIR) @@ -38,7 +38,8 @@ endif() # set(__conf_types "") -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) # We need to pass the configuration type on the test command line. set(__conf_types -C "${CMAKE_CFG_INTDIR}") endif() diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index ceb4d88..dde0775 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -5,7 +5,7 @@ # CheckPrototypeDefinition # ------------------------ # -# Check if the protoype we expect is correct. +# Check if the prototype we expect is correct. # # check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE) # diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index 9f8befd..3feea1c 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -67,7 +67,7 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic") # If the link type is not explicitly specified in the environment then - # the Cray wrappers assume that the code will be built staticly so + # the Cray wrappers assume that the code will be built statically so # we check the following condition(s) are NOT met # Compiler flags are explicitly dynamic # Env var is dynamic and compiler flags are not explicitly static diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 8ada451..28054f8 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -259,7 +259,8 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va file(MAKE_DIRECTORY "${plugins_path}") file(COPY "${plugin}" DESTINATION "${plugins_path}") else() - if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(configurations AND (_isMultiConfig OR CMAKE_BUILD_TYPE)) set(configurations CONFIGURATIONS ${configurations}) else() unset(configurations) @@ -295,7 +296,8 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) set(plugin_debug "${plugin_release}") endif() - if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig OR CMAKE_BUILD_TYPE) install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d284e27..30176bb 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1076,7 +1076,7 @@ foreach(config IN LISTS git_config) list(APPEND git_clone_options --config \${config}) endforeach() -# try the clone 3 times incase there is an odd git clone issue +# try the clone 3 times in case there is an odd git clone issue set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) @@ -1790,7 +1790,8 @@ function(_ep_get_build_command name step cmd_var) set(cmd "${CMAKE_COMMAND}") endif() set(args --build ".") - if(CMAKE_CONFIGURATION_TYPES) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) if (CMAKE_CFG_INTDIR AND NOT CMAKE_CFG_INTDIR STREQUAL "." AND NOT CMAKE_CFG_INTDIR MATCHES "\\$") @@ -1815,7 +1816,7 @@ function(_ep_get_build_command name step cmd_var) if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") - if(CMAKE_CONFIGURATION_TYPES) + if(_isMultiConfig) list(APPEND args -C ${config}) endif() endif() @@ -1955,7 +1956,8 @@ endfunction() # function(_ep_get_configuration_subdir_suffix suffix_var) set(suffix "") - if(CMAKE_CONFIGURATION_TYPES) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) set(suffix "/${CMAKE_CFG_INTDIR}") endif() set(${suffix_var} "${suffix}" PARENT_SCOPE) @@ -2085,7 +2087,8 @@ function(ExternalProject_Add_Step name step) set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1) set(touch) # Remove any existing stamp in case the option changed in an existing tree. - if(CMAKE_CONFIGURATION_TYPES) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) string(REPLACE "/${CMAKE_CFG_INTDIR}" "/${cfg}" stamp_file_config "${stamp_file}") file(REMOVE ${stamp_file_config}) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0786248..a0fd90f 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -275,13 +275,14 @@ endif() macro(_Boost_ADJUST_LIB_VARS basename) if(Boost_INCLUDE_DIR ) if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig OR CMAKE_BUILD_TYPE) set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) else() - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries + # For single-config generators where CMAKE_BUILD_TYPE has no value, + # just use the release libraries set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) endif() # FIXME: This probably should be set for both cases diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 04b5cf9..9176db4 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -98,12 +98,13 @@ # CUDA_HOST_COMPILATION_CPP (Default ON) # -- Set to OFF for C compilation of host code. # -# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS) +# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER) # -- Set the host compiler to be used by nvcc. Ignored if -ccbin or # --compiler-bindir is already present in the CUDA_NVCC_FLAGS or -# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets -# $(VCInstallDir)/bin is a special value that expands out to the path when -# the command is run from within VS. +# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets, +# the host compiler is constructed with one or more visual studio macros +# such as $(VCInstallDir), that expands out to the path when +# the command is run from withing VS. # # CUDA_NVCC_FLAGS # CUDA_NVCC_FLAGS_<CONFIG> @@ -527,7 +528,13 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") - set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") + set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)") + if(MSVC_VERSION LESS 1910) + set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin") + endif() + + set(CUDA_HOST_COMPILER "${_CUDA_MSVC_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") + else() if(APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang" @@ -578,12 +585,15 @@ mark_as_advanced( CUDA_SEPARABLE_COMPILATION ) -# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we -# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the -# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo) -# for completeness. We need run this loop in order to accommodate the addition -# of extra configuration types. Duplicate entries will be removed by -# REMOVE_DUPLICATES. +# Single config generators like Makefiles or Ninja don't usually have +# CMAKE_CONFIGURATION_TYPES defined (but note that it can be defined if set by +# projects or developers). Even CMAKE_BUILD_TYPE might not be defined for +# single config generators (and should not be defined for multi-config +# generators). To ensure we get a complete superset of all possible +# configurations, we combine CMAKE_CONFIGURATION_TYPES, CMAKE_BUILD_TYPE and +# all of the standard configurations, then weed out duplicates with +# list(REMOVE_DUPLICATES). Looping over the unique set then ensures we have +# each configuration-specific set of nvcc flags defined and marked as advanced. set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo) list(REMOVE_DUPLICATES CUDA_configuration_types) foreach(config ${CUDA_configuration_types}) @@ -977,7 +987,7 @@ if(NOT CUDA_VERSION VERSION_LESS "9.0") find_cuda_helper_libs(npps) set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}") elseif(CUDA_VERSION VERSION_GREATER "5.0") - # In CUDA 5.5 NPP was splitted onto 3 separate libraries. + # In CUDA 5.5 NPP was split into 3 separate libraries. find_cuda_helper_libs(nppc) find_cuda_helper_libs(nppi) find_cuda_helper_libs(npps) @@ -1315,11 +1325,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # This needs to be passed in at this stage, because VS needs to fill out the - # value of VCInstallDir from within VS. Note that CCBIN is only used if + # various macros from within VS. Note that CCBIN is only used if # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches - # $(VCInstallDir)/bin. + # _CUDA_MSVC_HOST_COMPILER if(CMAKE_GENERATOR MATCHES "Visual Studio") - set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) + set(ccbin_flags -D "\"CCBIN:PATH=${_CUDA_MSVC_HOST_COMPILER}\"" ) else() set(ccbin_flags) endif() @@ -1438,7 +1448,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11") # Add the c++11 flag to nvcc if it isn't already present. Note that we only look at # the main flag instead of the configuration specific flags. - if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" ) + if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std=c\\+\\+11" ) list(APPEND nvcc_flags --std c++11) endif() string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}") diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index 7b5389e..580f24a 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -40,7 +40,7 @@ # verbose:BOOL=<> OFF: Be as quiet as possible (default) # ON : Extra output # -# input_file:FILEPATH=<> Path to dependecy file in makefile format +# input_file:FILEPATH=<> Path to dependency file in makefile format # # output_file:FILEPATH=<> Path to file with dependencies in CMake readable variable # diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 86051cf..6fc2439 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -125,7 +125,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) - if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) + if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN) set(CCBIN -ccbin "${CCBIN}") else() set(CCBIN -ccbin "${CUDA_HOST_COMPILER}") @@ -187,7 +187,7 @@ endif() # nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This # can cause incorrect dependencies when #including files based on this macro which is -# defined in the generating passes of nvcc invokation. We will go ahead and manually +# defined in the generating passes of nvcc invocation. We will go ahead and manually # define this for now until a future version fixes this bug. set(CUDACC_DEFINE -D__CUDACC__) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index d0dd0f1..8aea4e0 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -244,7 +244,7 @@ required form if set. TAGFILES TCL_SUBST -The following single value Doxygen options would be quoted automatically +The following single value Doxygen options will be quoted automatically if they contain at least one space: :: @@ -292,6 +292,36 @@ if they contain at least one space: WARN_LOGFILE XML_OUTPUT +There are situations where it may be undesirable for a particular config option +to be automatically quoted by ``doxygen_add_docs()``, such as ``ALIASES`` which +may need to include its own embedded quoting. The ``DOXYGEN_VERBATIM_VARS`` +variable can be used to specify a list of Doxygen variables (including the +leading ``DOXYGEN_`` prefix) which should not be quoted. The project is then +responsible for ensuring that those variables' values make sense when placed +directly in the Doxygen input file. In the case of list variables, list items +are still separated by spaces, it is only the automatic quoting that is +skipped. For example, the following allows ``doxygen_add_docs()`` to apply +quoting to ``DOXYGEN_PROJECT_BRIEF``, but not each item in the +``DOXYGEN_ALIASES`` list (:ref:`bracket syntax <Bracket Argument>` can also +be used to make working with embedded quotes easier): + +.. code-block:: cmake + + set(DOXYGEN_PROJECT_BRIEF "String with spaces") + set(DOXYGEN_ALIASES + [[somealias="@some_command param"]] + "anotherAlias=@foobar" + ) + set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES) + +The resultant ``Doxyfile`` will contain the following lines: + +.. code-block:: text + + PROJECT_BRIEF = "String with spaces" + ALIASES = somealias="@some_command param" anotherAlias=@foobar + + Deprecated Result Variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -331,7 +361,7 @@ Deprecated Hint Variables .. variable:: DOXYGEN_SKIP_DOT - This variable has no any effect for component form of ``find_package``. + This variable has no effect for the component form of ``find_package``. In backward compatibility mode (i.e. without components list) it prevents the finder module from searching for Graphviz's ``dot`` utility. @@ -716,12 +746,15 @@ endif() function(doxygen_quote_value VARIABLE) # Quote a value of the given variable if: - # - variable parameter was really given - # - a variable it points is defined - # - a value doesn't quoted already - # - and it has spaces + # - VARIABLE parameter was really given + # - the variable it names is defined and is not present in the list + # specified by DOXYGEN_VERBATIM_VARS (if set) + # - the value of the named variable isn't already quoted + # - the value has spaces if(VARIABLE AND DEFINED ${VARIABLE} AND - NOT ${VARIABLE} MATCHES "^\".* .*\"$" AND ${VARIABLE} MATCHES " ") + NOT ${VARIABLE} MATCHES "^\".* .*\"$" AND ${VARIABLE} MATCHES " " AND + NOT (DEFINED DOXYGEN_VERBATIM_VARS AND + "${VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS)) set(${VARIABLE} "\"${${VARIABLE}}\"" PARENT_SCOPE) endif() endfunction() @@ -730,8 +763,18 @@ function(doxygen_list_to_quoted_strings LIST_VARIABLE) if(LIST_VARIABLE AND DEFINED ${LIST_VARIABLE}) unset(_inputs) unset(_sep) + unset(_verbatim) + # Have to test if list items should be treated as verbatim here + # because we lose the variable name when we pass just one list item + # to doxygen_quote_value() below + if(DEFINED DOXYGEN_VERBATIM_VARS AND + "${LIST_VARIABLE}" IN_LIST DOXYGEN_VERBATIM_VARS) + set(_verbatim True) + endif() foreach(_in IN LISTS ${LIST_VARIABLE}) - doxygen_quote_value(_in) + if(NOT _verbatim) + doxygen_quote_value(_in) + endif() string(APPEND _inputs "${_sep}${_in}") set(_sep " ") endforeach() diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index 838ca6a..315f301 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -80,10 +80,10 @@ else() # include the math library for Unix if(UNIX AND NOT APPLE) find_library(MATH_LIBRARY_FOR_LUA m) - set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatentation of lua and lualib libraries") + set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua};${MATH_LIBRARY_FOR_LUA}" CACHE STRING "This is the concatenation of lua and lualib libraries") # For Windows and Mac, don't need to explicitly include the math library else() - set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatentation of lua and lualib libraries") + set( LUA_LIBRARIES "${LUA_LIBRARY_lualib};${LUA_LIBRARY_lua}" CACHE STRING "This is the concatenation of lua and lualib libraries") endif() endif() endif() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 06f7d96..8402b23 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -765,7 +765,7 @@ endfunction() # ``WORKING_DIRECTORY`` # This will be the working directory for the test. If specified it will # also be the output directory used for the log file of the test run. -# If not specifed the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will +# If not specified the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will # be used as the working directory and the log location. # function(matlab_add_unit_test) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 9e2194c..7964917 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -23,7 +23,7 @@ # ---------------------------------------------------------------------------- # Note: # PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the -# version mumber of the implementation of PostgreSQL. +# version number of the implementation of PostgreSQL. # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 714e4af..a65c533 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -398,13 +398,14 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename) # if the release- as well as the debug-version of the library have been found: if (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig OR CMAKE_BUILD_TYPE) set(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) else() - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries + # For single-config generators where CMAKE_BUILD_TYPE has no value, + # just use the release libraries set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) endif() set(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake index a6661a8..f8a07ec 100644 --- a/Modules/Platform/Darwin-Clang.cmake +++ b/Modules/Platform/Darwin-Clang.cmake @@ -17,4 +17,19 @@ macro(__darwin_compiler_clang lang) if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.2) set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") endif() + if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mios-simulator-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVOS") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-simulator-version-min=") + else() + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + endif() endmacro() diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index dce6f99..fe3bb00 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -38,11 +38,12 @@ macro( select_library_configurations basename ) set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") endif() + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND - ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) - # if the generator supports configuration types or CMAKE_BUILD_TYPE - # is set, then set optimized and debug options. + ( _isMultiConfig OR CMAKE_BUILD_TYPE ) ) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries set( ${basename}_LIBRARY "" ) foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ec7b8c9..6fb5057 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 10) -set(CMake_VERSION_PATCH 20180103) +set(CMake_VERSION_PATCH 20180109) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 825a888..86c6981 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -61,7 +61,7 @@ int cmCPackIFWGenerator::PackageFiles() } } else { cmCPackIFWLogger(WARNING, "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" " - << "variable is set, but content will be skiped, " + << "variable is set, but content will be skipped, " << "because this feature available only since " << "QtIFW 3.1. Please update your QtIFW instance." << std::endl); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 57d2489..6b6c337 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -176,7 +176,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand( } // Create a copy of the memory tester environment variable. // This is used for memory testing programs that pass options - // via environment varaibles. + // via environment variables. std::string memTesterEnvironmentVariable = this->MemoryTesterEnvironmentVariable; for (std::string const& arg : this->MemoryTesterOptions) { diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 1419743..18412ba 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -114,7 +114,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) for (std::string& file : glob.GetFiles()) { std::string name = cmSystemTools::GetFilenameName(file); this->RoutineToDirectory[name.substr(0, name.size() - 2)] = file; - // initialze each file, this is left out until CDash is fixed + // initialize each file, this is left out until CDash is fixed // to handle large numbers of files this->InitializeMumpsFile(file); } diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b38797b..06d13ba 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -40,7 +40,7 @@ if (Qt5Widgets_FOUND) endif() # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. - # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly + # FIXME: This should be part of Qt5 CMake scripts, but unfortunately # Qt5 support is missing there. if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var) diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 8a7d9bd..a1de8b1 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -343,7 +343,7 @@ void GetProjectCommandsInScriptMode(cmState* state) CM_UNEXPECTED_PROJECT_COMMAND("try_compile"); CM_UNEXPECTED_PROJECT_COMMAND("try_run"); - // deprected commands + // deprecated commands CM_UNEXPECTED_PROJECT_COMMAND("export_library_dependencies"); CM_UNEXPECTED_PROJECT_COMMAND("load_command"); CM_UNEXPECTED_PROJECT_COMMAND("output_required_files"); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 23f622b..25d78c4 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -583,7 +583,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, A mod file is a binary file. However, looking into both generated bar.mod files with a hex editor shows that they differ only before a sequence linefeed-zero (0x0A 0x00) - which is located some bytes in front of the absoulte path to the source + which is located some bytes in front of the absolute path to the source file. sun: diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index ccf267b..bee9804 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -64,7 +64,7 @@ protected: const std::string& file, std::ostream& makeDepends, std::ostream& internalDepends) override; - // Actually write the depenencies to the streams. + // Actually write the dependencies to the streams. bool WriteDependenciesReal(const char* obj, cmFortranSourceInfo const& info, std::string const& mod_dir, const char* stamp_dir, std::ostream& makeDepends, diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index 3165982..91554ee 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -22,7 +22,7 @@ class cmInstallExportGenerator; * cmExportInstallAndroidMKGenerator generates files exporting targets from * install an installation tree. The files are placed in a temporary * location for installation by cmInstallExportGenerator. The file format - * is for the ndk build system and is a makefile fragment specifing prebuilt + * is for the ndk build system and is a makefile fragment specifying prebuilt * libraries to the ndk build system. * * This is used to implement the INSTALL(EXPORT_ANDROID_MK) command. diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h index 48b5da0..30881ce 100644 --- a/Source/cmFilePathChecksum.h +++ b/Source/cmFilePathChecksum.h @@ -29,13 +29,13 @@ public: /// @brief Parent directories are empty cmFilePathChecksum(); - /// @brief Initilizes the parent directories manually + /// @brief Initializes the parent directories manually cmFilePathChecksum(std::string const& currentSrcDir, std::string const& currentBinDir, std::string const& projectSrcDir, std::string const& projectBinDir); - /// @brief Initilizes the parent directories from a makefile + /// @brief Initializes the parent directories from a makefile cmFilePathChecksum(cmMakefile* makefile); /// @brief Allows parent directories setup after construction diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2cf53cc..4eddd15 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1529,7 +1529,8 @@ std::string cmGeneratorTarget::GetAppBundleDirectory( ext = "app"; } fpath += ext; - if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Contents"; if (shouldAddFullLevel(level)) { fpath += "/MacOS"; @@ -1559,7 +1560,8 @@ std::string cmGeneratorTarget::GetCFBundleDirectory( } } fpath += ext; - if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Contents"; if (shouldAddFullLevel(level)) { fpath += "/MacOS"; @@ -1579,7 +1581,8 @@ std::string cmGeneratorTarget::GetFrameworkDirectory( ext = "framework"; } fpath += ext; - if (shouldAddFullLevel(level) && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddFullLevel(level) && + !this->Makefile->PlatformIsAppleEmbedded()) { fpath += "/Versions/"; fpath += this->GetFrameworkVersion(); } @@ -2166,7 +2169,7 @@ void cmTargetTraceDependencies::Trace() // Queue the source needed to generate this file, if any. this->FollowName(sf->GetFullPath()); - // Queue dependencies added programatically by commands. + // Queue dependencies added programmatically by commands. this->FollowNames(sf->GetDepends()); // Queue custom command dependencies. @@ -3004,7 +3007,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName, if (this->IsFrameworkOnApple()) { realName = prefix; - if (!this->Makefile->PlatformIsAppleIos()) { + if (!this->Makefile->PlatformIsAppleEmbedded()) { realName += "Versions/"; realName += this->GetFrameworkVersion(); realName += "/"; @@ -5154,7 +5157,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLanguages( std::set<std::string> languages; // Get languages used in our source files. this->GetLanguages(languages, config); - // Copy the set of langauges to the link implementation. + // Copy the set of languages to the link implementation. impl.Languages.insert(impl.Languages.begin(), languages.begin(), languages.end()); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6e903fb..fd9b488 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2609,7 +2609,7 @@ std::string cmGlobalGenerator::GenerateRuleFile( bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const { - return mf->PlatformIsAppleIos(); + return mf->PlatformIsAppleEmbedded(); } std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4c4c62c..73a5dae 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -478,12 +478,11 @@ void cmGlobalVisualStudio10Generator::Generate() void cmGlobalVisualStudio10Generator::EnableLanguage( std::vector<std::string> const& lang, cmMakefile* mf, bool optional) { - for (std::vector<std::string>::const_iterator it = lang.begin(); - it != lang.end(); ++it) { - if (*it == "ASM_NASM") { + for (std::string const& it : lang) { + if (it == "ASM_NASM") { this->NasmEnabled = true; } - if (*it == "CUDA") { + if (it == "CUDA") { this->CudaEnabled = true; } } @@ -829,8 +828,9 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( if (parser.ParseFile(slnFile, slnData, cmVisualStudioSlnParser::DataGroupProjects)) { std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects(); - for (std::vector<cmSlnProjectEntry>::iterator i = slnProjects.begin(); - !useDevEnv && i != slnProjects.end(); ++i) { + for (std::vector<cmSlnProjectEntry>::const_iterator i = + slnProjects.cbegin(); + !useDevEnv && i != slnProjects.cend(); ++i) { std::string proj = i->GetRelativePath(); if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj") { useDevEnv = true; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index cb3b047..f1d5a8c 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -83,9 +83,8 @@ public: std::set<std::string> installedSDKs = cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - for (std::set<std::string>::const_iterator i = installedSDKs.begin(); - i != installedSDKs.end(); ++i) { - names.push_back(std::string(vs11generatorName) + " " + *i); + for (std::string const& i : installedSDKs) { + names.push_back(std::string(vs11generatorName) + " " + i); } } @@ -224,18 +223,17 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs() cmSystemTools::KeyWOW64_32); std::set<std::string> ret; - for (std::vector<std::string>::const_iterator i = subkeys.begin(); - i != subkeys.end(); ++i) { + for (std::string const& i : subkeys) { std::string key = sdksKey; key += '\\'; - key += *i; + key += i; key += ';'; std::string path; - if (cmSystemTools::ReadRegistryValue(key.c_str(), path, + if (cmSystemTools::ReadRegistryValue(key, path, cmSystemTools::KeyWOW64_32) && !path.empty()) { - ret.insert(*i); + ret.insert(i); } } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 97d5313..c440e0d 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -257,9 +257,8 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() std::vector<std::string> sdks; // Grab the paths of the different SDKs that are installed - for (std::vector<std::string>::iterator i = win10Roots.begin(); - i != win10Roots.end(); ++i) { - std::string path = *i + "/Include/*"; + for (std::string const& i : win10Roots) { + std::string path = i + "/Include/*"; cmSystemTools::GlobDirs(path, sdks); } @@ -269,19 +268,17 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() if (!sdks.empty()) { // Only use the filename, which will be the SDK version. - for (std::vector<std::string>::iterator i = sdks.begin(); i != sdks.end(); - ++i) { - *i = cmSystemTools::GetFilenameName(*i); + for (std::string& i : sdks) { + i = cmSystemTools::GetFilenameName(i); } // Sort the results to make sure we select the most recent one. std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); // Look for a SDK exactly matching the requested target version. - for (std::vector<std::string>::iterator i = sdks.begin(); i != sdks.end(); - ++i) { - if (cmSystemTools::VersionCompareEqual(*i, this->SystemVersion)) { - return *i; + for (std::string const& i : sdks) { + if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) { + return i; } } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 8a9a3fb..45cc583 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -76,9 +76,8 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations( std::ostream& fout, std::vector<std::string> const& configs) { fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n"; - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { - fout << "\t\t" << *i << " = " << *i << "\n"; + for (std::string const& i : configs) { + fout << "\t\t" << i << " = " << i << "\n"; } fout << "\tEndGlobalSection\n"; } @@ -143,9 +142,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends( cmGeneratorTarget const* target) { VSDependSet const& depends = this->VSTargetDepends[target]; - for (VSDependSet::const_iterator di = depends.begin(); di != depends.end(); - ++di) { - const char* name = di->c_str(); + for (std::string const& name : depends) { std::string guid = this->GetGUID(name); if (guid.empty()) { std::string m = "Target: "; @@ -174,11 +171,10 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( // project instead of in the global section if (!depends.empty()) { fout << "\tProjectSection(ProjectDependencies) = postProject\n"; - std::set<std::string>::const_iterator it; - for (it = depends.begin(); it != depends.end(); ++it) { - if (!it->empty()) { - fout << "\t\t{" << this->GetGUID(it->c_str()) << "} = {" - << this->GetGUID(it->c_str()) << "}\n"; + for (std::string const& it : depends) { + if (!it.empty()) { + fout << "\t\t{" << this->GetGUID(it) << "} = {" << this->GetGUID(it) + << "}\n"; } } fout << "\tEndProjectSection\n"; @@ -198,26 +194,25 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( const std::string& platformName = !platformMapping.empty() ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { + for (std::string const& i : configs) { std::vector<std::string> mapConfig; - const char* dstConfig = i->c_str(); + const char* dstConfig = i.c_str(); if (target.GetProperty("EXTERNAL_MSPROJECT")) { if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(*i))) { + cmSystemTools::UpperCase(i))) { cmSystemTools::ExpandListArgument(m, mapConfig); if (!mapConfig.empty()) { dstConfig = mapConfig[0].c_str(); } } } - fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << dstConfig - << "|" << platformName << std::endl; + fout << "\t\t{" << guid << "}." << i << ".ActiveCfg = " << dstConfig << "|" + << platformName << std::endl; std::set<std::string>::const_iterator ci = - configsPartOfDefaultBuild.find(*i); + configsPartOfDefaultBuild.find(i); if (!(ci == configsPartOfDefaultBuild.end())) { - fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << dstConfig - << "|" << platformName << std::endl; + fout << "\t\t{" << guid << "}." << i << ".Build.0 = " << dstConfig << "|" + << platformName << std::endl; } } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a14b5f7..c915dc5 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -334,9 +334,8 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile( // output the SLN file void cmGlobalVisualStudio7Generator::OutputSLNFile() { - std::map<std::string, std::vector<cmLocalGenerator*>>::iterator it; - for (it = this->ProjectMap.begin(); it != this->ProjectMap.end(); ++it) { - this->OutputSLNFile(it->second[0], it->second); + for (auto& it : this->ProjectMap) { + this->OutputSLNFile(it.second[0], it.second); } } @@ -346,9 +345,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( { // loop over again and write out configurations for each target // in the solution - for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); - tt != projectTargets.end(); ++tt) { - cmGeneratorTarget const* target = *tt; + for (cmGeneratorTarget const* target : projectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -378,9 +375,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( VisualStudioFolders.clear(); std::string rootBinaryDir = root->GetCurrentBinaryDirectory(); - for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); - tt != projectTargets.end(); ++tt) { - cmGeneratorTarget const* target = *tt; + for (cmGeneratorTarget const* target : projectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -420,19 +415,18 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string cumulativePath; - for (std::vector<cmsys::String>::iterator iter = tokens.begin(); - iter != tokens.end(); ++iter) { - if (!iter->size()) { + for (cmsys::String const& iter : tokens) { + if (!iter.size()) { continue; } if (cumulativePath.empty()) { - cumulativePath = "CMAKE_FOLDER_GUID_" + *iter; + cumulativePath = "CMAKE_FOLDER_GUID_" + iter; } else { VisualStudioFolders[cumulativePath].insert(cumulativePath + "/" + - *iter); + iter); - cumulativePath = cumulativePath + "/" + *iter; + cumulativePath = cumulativePath + "/" + iter; } } @@ -447,9 +441,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( void cmGlobalVisualStudio7Generator::WriteTargetDepends( std::ostream& fout, OrderedTargetDependSet const& projectTargets) { - for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); - tt != projectTargets.end(); ++tt) { - cmGeneratorTarget const* target = *tt; + for (cmGeneratorTarget const* target : projectTargets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -467,11 +459,9 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout) const char* prefix = "CMAKE_FOLDER_GUID_"; const std::string::size_type skip_prefix = strlen(prefix); std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8"; - for (std::map<std::string, std::set<std::string>>::iterator iter = - VisualStudioFolders.begin(); - iter != VisualStudioFolders.end(); ++iter) { - std::string fullName = iter->first; - std::string guid = this->GetGUID(fullName.c_str()); + for (auto const& iter : VisualStudioFolders) { + std::string fullName = iter.first; + std::string guid = this->GetGUID(fullName); std::replace(fullName.begin(), fullName.end(), '/', '\\'); if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix)) { @@ -487,16 +477,13 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout) void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout) { - for (std::map<std::string, std::set<std::string>>::iterator iter = - VisualStudioFolders.begin(); - iter != VisualStudioFolders.end(); ++iter) { - std::string key(iter->first); - std::string guidParent(this->GetGUID(key.c_str())); + for (auto const& iter : VisualStudioFolders) { + std::string key(iter.first); + std::string guidParent(this->GetGUID(key)); - for (std::set<std::string>::iterator it = iter->second.begin(); - it != iter->second.end(); ++it) { - std::string value(*it); - std::string guid(this->GetGUID(value.c_str())); + for (std::string const& it : iter.second) { + std::string value(it); + std::string guid(this->GetGUID(value)); fout << "\t\t{" << guid << "} = {" << guidParent << "}\n"; } @@ -525,11 +512,10 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( bool extensibilityAddInsOverridden = false; const std::vector<std::string> propKeys = root->GetMakefile()->GetPropertyKeys(); - for (std::vector<std::string>::const_iterator it = propKeys.begin(); - it != propKeys.end(); ++it) { - if (it->find("VS_GLOBAL_SECTION_") == 0) { + for (std::string const& it : propKeys) { + if (it.find("VS_GLOBAL_SECTION_") == 0) { std::string sectionType; - std::string name = it->substr(18); + std::string name = it.substr(18); if (name.find("PRE_") == 0) { name = name.substr(4); sectionType = "preSolution"; @@ -549,17 +535,15 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( } fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; std::vector<std::string> keyValuePairs; - cmSystemTools::ExpandListArgument( - root->GetMakefile()->GetProperty(it->c_str()), keyValuePairs); - for (std::vector<std::string>::const_iterator itPair = - keyValuePairs.begin(); - itPair != keyValuePairs.end(); ++itPair) { - const std::string::size_type posEqual = itPair->find('='); + cmSystemTools::ExpandListArgument(root->GetMakefile()->GetProperty(it), + keyValuePairs); + for (std::string const& itPair : keyValuePairs) { + const std::string::size_type posEqual = itPair.find('='); if (posEqual != std::string::npos) { const std::string key = - cmSystemTools::TrimWhitespace(itPair->substr(0, posEqual)); + cmSystemTools::TrimWhitespace(itPair.substr(0, posEqual)); const std::string value = - cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1)); + cmSystemTools::TrimWhitespace(itPair.substr(posEqual + 1)); fout << "\t\t" << key << " = " << value << "\n"; if (key == "SolutionGuid") { addGuid = false; @@ -618,14 +602,13 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend( "\t<Configurations>\n" ; /* clang-format on */ - for (std::vector<std::string>::iterator i = configs.begin(); - i != configs.end(); ++i) { + for (std::string const& i : configs) { /* clang-format off */ fout << "\t\t<Configuration\n" - "\t\t\tName=\"" << *i << "|Win32\"\n" - "\t\t\tOutputDirectory=\"" << *i << "\"\n" - "\t\t\tIntermediateDirectory=\"" << pname << ".dir\\" << *i << "\"\n" + "\t\t\tName=\"" << i << "|Win32\"\n" + "\t\t\tOutputDirectory=\"" << i << "\"\n" + "\t\t\tIntermediateDirectory=\"" << pname << ".dir\\" << i << "\"\n" "\t\t\tConfigurationType=\"10\"\n" "\t\t\tUseOfMFC=\"0\"\n" "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n" @@ -696,23 +679,21 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( std::vector<std::string> targetNames; targetNames.push_back("INSTALL"); targetNames.push_back("PACKAGE"); - for (std::vector<std::string>::const_iterator t = targetNames.begin(); - t != targetNames.end(); ++t) { - // check if target <*t> is part of default build - if (target->GetName() == *t) { + for (std::string const& t : targetNames) { + // check if target <t> is part of default build + if (target->GetName() == t) { const std::string propertyName = - "CMAKE_VS_INCLUDE_" + *t + "_TO_DEFAULT_BUILD"; - // inspect CMAKE_VS_INCLUDE_<*t>_TO_DEFAULT_BUILD properties - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { + "CMAKE_VS_INCLUDE_" + t + "_TO_DEFAULT_BUILD"; + // inspect CMAKE_VS_INCLUDE_<t>_TO_DEFAULT_BUILD properties + for (std::string const& i : configs) { const char* propertyValue = target->Target->GetMakefile()->GetDefinition(propertyName); cmGeneratorExpression ge; std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(propertyValue); if (cmSystemTools::IsOn( - cge->Evaluate(target->GetLocalGenerator(), *i))) { - activeConfigs.insert(*i); + cge->Evaluate(target->GetLocalGenerator(), i))) { + activeConfigs.insert(i); } } } @@ -724,12 +705,11 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( return activeConfigs; } // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { + for (std::string const& i : configs) { const char* propertyValue = - target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str()); + target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i); if (cmSystemTools::IsOff(propertyValue)) { - activeConfigs.insert(*i); + activeConfigs.insert(i); } } return activeConfigs; @@ -738,9 +718,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( bool cmGlobalVisualStudio7Generator::IsDependedOn( OrderedTargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn) { - for (OrderedTargetDependSet::const_iterator l = projectTargets.begin(); - l != projectTargets.end(); ++l) { - TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*l); + for (cmTargetDepend const& l : projectTargets) { + TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(l); if (tgtdeps.count(gtIn)) { return true; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1743b18..ab8ad70 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -66,10 +66,8 @@ public: parser.ParseVersion("8.0"); const std::vector<std::string>& availablePlatforms = parser.GetAvailablePlatforms(); - for (std::vector<std::string>::const_iterator i = - availablePlatforms.begin(); - i != availablePlatforms.end(); ++i) { - names.push_back("Visual Studio 8 2005 " + *i); + for (std::string const& i : availablePlatforms) { + names.push_back("Visual Studio 8 2005 " + i); } } @@ -117,9 +115,8 @@ std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand() void cmGlobalVisualStudio8Generator::EnableLanguage( std::vector<std::string> const& lang, cmMakefile* mf, bool optional) { - for (std::vector<std::string>::const_iterator it = lang.begin(); - it != lang.end(); ++it) { - if (*it == "ASM_MASM") { + for (std::string const& it : lang) { + if (it == "ASM_MASM") { this->MasmEnabled = true; } } @@ -249,10 +246,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() stampListFile += stampList; std::string stampFile; cmGeneratedFileStream fout(stampListFile.c_str()); - for (std::vector<cmLocalGenerator*>::const_iterator gi = - generators.begin(); - gi != generators.end(); ++gi) { - stampFile = (*gi)->GetMakefile()->GetCurrentBinaryDirectory(); + for (cmLocalGenerator const* gi : generators) { + stampFile = gi->GetMakefile()->GetCurrentBinaryDirectory(); stampFile += "/"; stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); stampFile += "generate.stamp"; @@ -323,10 +318,9 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets() const std::vector<cmGeneratorTarget*>& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); // All targets depend on the build-system check target. - for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin(); - ti != tgts.end(); ++ti) { - if ((*ti)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { - (*ti)->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + for (cmGeneratorTarget const* ti : tgts) { + if (ti->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { + ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); } } } @@ -337,10 +331,9 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations( std::ostream& fout, std::vector<std::string> const& configs) { fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { - fout << "\t\t" << *i << "|" << this->GetPlatformName() << " = " << *i - << "|" << this->GetPlatformName() << "\n"; + for (std::string const& i : configs) { + fout << "\t\t" << i << "|" << this->GetPlatformName() << " = " << i << "|" + << this->GetPlatformName() << "\n"; } fout << "\tEndGlobalSection\n"; } @@ -352,35 +345,34 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( std::string const& platformMapping) { std::string guid = this->GetGUID(name); - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { + for (std::string const& i : configs) { std::vector<std::string> mapConfig; - const char* dstConfig = i->c_str(); + const char* dstConfig = i.c_str(); if (target.GetProperty("EXTERNAL_MSPROJECT")) { if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(*i))) { + cmSystemTools::UpperCase(i))) { cmSystemTools::ExpandListArgument(m, mapConfig); if (!mapConfig.empty()) { dstConfig = mapConfig[0].c_str(); } } } - fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() + fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() << ".ActiveCfg = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) << "\n"; std::set<std::string>::const_iterator ci = - configsPartOfDefaultBuild.find(*i); + configsPartOfDefaultBuild.find(i); if (!(ci == configsPartOfDefaultBuild.end())) { - fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() + fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() << ".Build.0 = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) << "\n"; } if (this->NeedsDeploy(target.GetType())) { - fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() + fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() << ".Deploy.0 = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) @@ -410,12 +402,11 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( { TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); OrderedTargetDependSet depends(unordered, std::string()); - for (OrderedTargetDependSet::const_iterator i = depends.begin(); - i != depends.end(); ++i) { - if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + for (cmTargetDepend const& i : depends) { + if (i->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - std::string guid = this->GetGUID((*i)->GetName().c_str()); + std::string guid = this->GetGUID(i->GetName()); fout << "\t\t{" << guid << "} = {" << guid << "}\n"; } } @@ -424,11 +415,9 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( cmGeneratorTarget* target) { // Look for utility dependencies that magically link. - for (std::set<std::string>::const_iterator ui = - target->GetUtilities().begin(); - ui != target->GetUtilities().end(); ++ui) { + for (std::string const& ui : target->GetUtilities()) { if (cmGeneratorTarget* depTarget = - target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) { + target->GetLocalGenerator()->FindGeneratorTargetToUse(ui)) { if (depTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) { // This utility dependency names an external .vcproj target. diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 0abb348..7ac3a6f 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -68,10 +68,8 @@ public: parser.ParseVersion("9.0"); const std::vector<std::string>& availablePlatforms = parser.GetAvailablePlatforms(); - for (std::vector<std::string>::const_iterator i = - availablePlatforms.begin(); - i != availablePlatforms.end(); ++i) { - names.push_back("Visual Studio 9 2008 " + *i); + for (std::string const& i : availablePlatforms) { + names.push_back("Visual Studio 9 2008 " + i); } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index c89c2c4..d7ebcac 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -61,9 +61,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() const char* no_working_dir = 0; std::vector<std::string> no_depends; cmCustomCommandLines no_commands; - std::map<std::string, std::vector<cmLocalGenerator*>>::iterator it; - for (it = this->ProjectMap.begin(); it != this->ProjectMap.end(); ++it) { - std::vector<cmLocalGenerator*>& gen = it->second; + for (auto const& it : this->ProjectMap) { + std::vector<cmLocalGenerator*> const& gen = it.second; // add the ALL_BUILD to the first local generator of each project if (!gen.empty()) { // Use no actual command lines so that the target itself is not @@ -83,14 +82,10 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() } // Now make all targets depend on the ALL_BUILD target - for (std::vector<cmLocalGenerator*>::iterator i = gen.begin(); - i != gen.end(); ++i) { - const std::vector<cmGeneratorTarget*>& targets = - (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator t = - targets.begin(); - t != targets.end(); ++t) { - cmGeneratorTarget* tgt = *t; + for (cmLocalGenerator const* i : gen) { + std::vector<cmGeneratorTarget*> const& targets = + i->GetGeneratorTargets(); + for (cmGeneratorTarget* tgt : targets) { if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET || tgt->IsImported()) { continue; @@ -243,10 +238,9 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure( { if (linked.insert(target).second) { TargetDependSet const& depends = this->GetTargetDirectDepends(target); - for (TargetDependSet::const_iterator di = depends.begin(); - di != depends.end(); ++di) { - if (di->IsLink()) { - this->FillLinkClosure(*di, linked); + for (cmTargetDepend const& di : depends) { + if (di.IsLink()) { + this->FillLinkClosure(di, linked); } } } @@ -275,10 +269,9 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends( // Static library targets do not list their link dependencies so // we must follow them transitively now. TargetDependSet const& depends = this->GetTargetDirectDepends(target); - for (TargetDependSet::const_iterator di = depends.begin(); - di != depends.end(); ++di) { - if (di->IsLink()) { - this->FollowLinkDepends(*di, linked); + for (cmTargetDepend const& di : depends) { + if (di.IsLink()) { + this->FollowLinkDepends(di, linked); } } } @@ -289,17 +282,13 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() if (!this->cmGlobalGenerator::ComputeTargetDepends()) { return false; } - std::map<std::string, std::vector<cmLocalGenerator*>>::iterator it; - for (it = this->ProjectMap.begin(); it != this->ProjectMap.end(); ++it) { - std::vector<cmLocalGenerator*>& gen = it->second; - for (std::vector<cmLocalGenerator*>::iterator i = gen.begin(); - i != gen.end(); ++i) { - const std::vector<cmGeneratorTarget*>& targets = - (*i)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator ti = - targets.begin(); - ti != targets.end(); ++ti) { - this->ComputeVSTargetDepends(*ti); + for (auto const& it : this->ProjectMap) { + std::vector<cmLocalGenerator*> const& gen = it.second; + for (const cmLocalGenerator* i : gen) { + std::vector<cmGeneratorTarget*> const& targets = + i->GetGeneratorTargets(); + for (cmGeneratorTarget* ti : targets) { + this->ComputeVSTargetDepends(ti); } } } @@ -349,22 +338,20 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // due to behavior (2), but they do not really need to. std::set<cmGeneratorTarget const*> linkDepends; if (target->GetType() != cmStateEnums::STATIC_LIBRARY) { - for (TargetDependSet::const_iterator di = depends.begin(); - di != depends.end(); ++di) { - cmTargetDepend dep = *di; + for (cmTargetDepend const& di : depends) { + cmTargetDepend dep = di; if (dep.IsLink()) { - this->FollowLinkDepends(*di, linkDepends); + this->FollowLinkDepends(di, linkDepends); } } } // Collect explicit util dependencies (add_dependencies). std::set<cmGeneratorTarget const*> utilDepends; - for (TargetDependSet::const_iterator di = depends.begin(); - di != depends.end(); ++di) { - cmTargetDepend dep = *di; + for (cmTargetDepend const& di : depends) { + cmTargetDepend dep = di; if (dep.IsUtil()) { - this->FollowLinkDepends(*di, utilDepends); + this->FollowLinkDepends(di, utilDepends); } } @@ -376,16 +363,12 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( } // Emit link dependencies. - for (std::set<cmGeneratorTarget const*>::iterator di = linkDepends.begin(); - di != linkDepends.end(); ++di) { - cmGeneratorTarget const* dep = *di; + for (cmGeneratorTarget const* dep : linkDepends) { vsTargetDepend.insert(dep->GetName()); } // Emit util dependencies. Possibly use intermediate targets. - for (std::set<cmGeneratorTarget const*>::iterator di = utilDepends.begin(); - di != utilDepends.end(); ++di) { - cmGeneratorTarget const* dgt = *di; + for (cmGeneratorTarget const* dgt : utilDepends) { if (allowLinkable || !VSLinkable(dgt) || linked.count(dgt)) { // Direct dependency allowed. vsTargetDepend.insert(dgt->GetName()); @@ -815,9 +798,8 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet::OrderedTargetDependSet( TargetSet const& targets, std::string const& first) : derived(TargetCompare(first)) { - for (TargetSet::const_iterator it = targets.begin(); it != targets.end(); - ++it) { - this->insert(*it); + for (cmGeneratorTarget const* it : targets) { + this->insert(it); } } @@ -851,10 +833,8 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( std::vector<cmSourceFile const*> objectSources; gt->GetObjectSources(objectSources, configName); std::map<cmSourceFile const*, std::string> mapping; - for (std::vector<cmSourceFile const*>::const_iterator it = - objectSources.begin(); - it != objectSources.end(); ++it) { - mapping[*it]; + for (cmSourceFile const* it : objectSources) { + mapping[it]; } gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); std::string obj_dir = gt->ObjectDirectory; @@ -879,12 +859,10 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( if (mdi->WindowsExportAllSymbols) { std::vector<std::string> objs; - for (std::vector<cmSourceFile const*>::const_iterator it = - objectSources.begin(); - it != objectSources.end(); ++it) { + for (cmSourceFile const* it : objectSources) { // Find the object file name corresponding to this source file. std::map<cmSourceFile const*, std::string>::const_iterator map_it = - mapping.find(*it); + mapping.find(it); // It must exist because we populated the mapping just above. assert(!map_it->second.empty()); std::string objFile = obj_dir + map_it->second; @@ -892,15 +870,12 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( } std::vector<cmSourceFile const*> externalObjectSources; gt->GetExternalObjects(externalObjectSources, configName); - for (std::vector<cmSourceFile const*>::const_iterator it = - externalObjectSources.begin(); - it != externalObjectSources.end(); ++it) { - objs.push_back((*it)->GetFullPath()); + for (cmSourceFile const* it : externalObjectSources) { + objs.push_back(it->GetFullPath()); } - for (std::vector<std::string>::iterator it = objs.begin(); - it != objs.end(); ++it) { - std::string objFile = *it; + for (std::string const& it : objs) { + std::string objFile = it; // replace $(ConfigurationName) in the object names cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(), configName.c_str()); @@ -910,10 +885,8 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( } } - for (std::vector<cmSourceFile const*>::const_iterator i = - mdi->Sources.begin(); - i != mdi->Sources.end(); ++i) { - fout << (*i)->GetFullPath() << "\n"; + for (cmSourceFile const* i : mdi->Sources) { + fout << i->GetFullPath() << "\n"; } cmCustomCommandLines commandLines; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6223be8..338c2b4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1172,7 +1172,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( // dstPath in frameworks is relative to Versions/<version> ostr << keySources.first; } else if (keySources.first != "MacOS") { - if (gtgt->Target->GetMakefile()->PlatformIsAppleIos()) { + if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; } else { // dstPath in bundles is relative to Contents/MacOS @@ -2992,7 +2992,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( buildSettings->AddAttribute("ARCHS", this->CreateString(archs)); } if (deploymentTarget && *deploymentTarget) { - buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET", + buildSettings->AddAttribute(GetDeploymentPlatform(root->GetMakefile()), this->CreateString(deploymentTarget)); } if (!this->GeneratorToolset.empty()) { @@ -3218,7 +3218,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( << this->ConvertToRelativeForMake(tfull.c_str()) << "\n"; // if building for more than one architecture - // then remove those exectuables as well + // then remove those executables as well if (this->Architectures.size() > 1) { std::string universal = this->GetObjectsNormalDirectory( this->CurrentProject, configName, gt); @@ -3605,7 +3605,7 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME"); if (!epnValue) { - return mf->PlatformIsAppleIos(); + return mf->PlatformIsAppleEmbedded(); } return cmSystemTools::IsOn(epnValue); @@ -3627,3 +3627,24 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( dir += "/"; gt->ObjectDirectory = dir; } + +std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf) +{ + switch (mf->GetAppleSDKType()) { + case cmMakefile::AppleSDK::AppleTVOS: + case cmMakefile::AppleSDK::AppleTVSimulator: + return "TVOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::IPhoneOS: + case cmMakefile::AppleSDK::IPhoneSimulator: + return "IPHONEOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::WatchOS: + case cmMakefile::AppleSDK::WatchSimulator: + return "WATCHOS_DEPLOYMENT_TARGET"; + + case cmMakefile::AppleSDK::MacOS: + default: + return "MACOSX_DEPLOYMENT_TARGET"; + } +} diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index b758e97..2269b25 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -254,6 +254,8 @@ private: const std::string& configName, const cmGeneratorTarget* t) const; + static std::string GetDeploymentPlatform(const cmMakefile* mf); + void ComputeArchitectures(cmMakefile* mf); void ComputeObjectDirArch(cmMakefile* mf); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index b964794..814dc4f 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( to1 += "."; to1 += ext; to1 += "/"; - if (!mf->PlatformIsAppleIos()) { + if (!mf->PlatformIsAppleEmbedded()) { to1 += "Contents/MacOS/"; } to1 += targetName; @@ -796,7 +796,7 @@ void cmInstallTargetGenerator::AddUniversalInstallRule( { cmMakefile const* mf = this->Target->Target->GetMakefile(); - if (!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE")) { + if (!mf->PlatformIsAppleEmbedded() || !mf->IsOn("XCODE")) { return; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a389ad0..28890f0 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1161,7 +1161,7 @@ void cmLocalUnixMakefileGenerator3::AppendEcho( commands.push_back(cmd); } - // Reset the line to emtpy. + // Reset the line to empty. line.clear(); // Progress appears only on first line. diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 5e81514..2803d4a 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -64,20 +64,18 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator() void cmLocalVisualStudio10Generator::Generate() { - const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); ++l) { - if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + for (cmGeneratorTarget* l : tgts) { + if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) - ->TargetIsFortranOnly(*l)) { - this->CreateSingleVCProj((*l)->GetName().c_str(), *l); + ->TargetIsFortranOnly(l)) { + this->CreateSingleVCProj(l->GetName(), l); } else { cmVisualStudio10TargetGenerator tg( - *l, static_cast<cmGlobalVisualStudio10Generator*>( - this->GetGlobalGenerator())); + l, static_cast<cmGlobalVisualStudio10Generator*>( + this->GetGlobalGenerator())); tg.Generate(); } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1b96ef4..eccd4d0 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -70,14 +70,13 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() { // Now create GUIDs for targets const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); ++l) { - if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + for (cmGeneratorTarget const* l : tgts) { + if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT"); + const char* path = l->GetProperty("EXTERNAL_MSPROJECT"); if (path) { - this->ReadAndStoreExternalGUID((*l)->GetName().c_str(), path); + this->ReadAndStoreExternalGUID(l->GetName(), path); } } @@ -96,9 +95,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() // commands for targets in which no sources are built. Add dummy // rules to force these targets to build. const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); l++) { - if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) { + for (cmGeneratorTarget* l : tgts) { + if (l->GetType() == cmStateEnums::GLOBAL_TARGET) { std::vector<std::string> no_depends; cmCustomCommandLine force_command; force_command.push_back("cd"); @@ -109,12 +107,12 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() std::string force = this->GetCurrentBinaryDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; - force += (*l)->GetName(); + force += l->GetName(); force += "_force"; if (cmSourceFile* file = this->Makefile->AddCustomCommandToOutput( force.c_str(), no_depends, no_main_dependency, force_commands, " ", 0, true)) { - (*l)->AddSource(file->GetFullPath()); + l->AddSource(file->GetFullPath()); } } } @@ -138,15 +136,14 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); // Create the project file for each target. - for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); - l != tgts.end(); l++) { - if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + for (cmGeneratorTarget* l : tgts) { + if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // so don't build a projectfile for it - if (!(*l)->GetProperty("EXTERNAL_MSPROJECT")) { - this->CreateSingleVCProj((*l)->GetName().c_str(), *l); + if (!l->GetProperty("EXTERNAL_MSPROJECT")) { + this->CreateSingleVCProj(l->GetName(), l); } } } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index bbb91e0..2237da7 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -39,10 +39,8 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( // windows file names are not case sensitive. 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 const& si : mapping) { + cmSourceFile const* sf = si.first; std::string objectNameLower = cmSystemTools::LowerCase( cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); if (custom_ext) { @@ -57,10 +55,8 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( // For all source files producing duplicate names we need unique // object name computation. - 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()); if (custom_ext) { @@ -74,7 +70,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( objectName = this->GetObjectFileNameWithoutTarget( *sf, dir_max, &keptSourceExtension, custom_ext); } - si->second = objectName; + si.second = objectName; } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a1e2f63..5d6029c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2244,25 +2244,38 @@ bool cmMakefile::PlatformIsx32() const return false; } -bool cmMakefile::PlatformIsAppleIos() const +cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const { std::string sdkRoot; sdkRoot = this->GetSafeDefinition("CMAKE_OSX_SYSROOT"); sdkRoot = cmSystemTools::LowerCase(sdkRoot); - const std::string embedded[] = { - "appletvos", "appletvsimulator", "iphoneos", - "iphonesimulator", "watchos", "watchsimulator", + struct + { + std::string name; + AppleSDK sdk; + } const sdkDatabase[]{ + { "appletvos", AppleSDK::AppleTVOS }, + { "appletvsimulator", AppleSDK::AppleTVSimulator }, + { "iphoneos", AppleSDK::IPhoneOS }, + { "iphonesimulator", AppleSDK::IPhoneSimulator }, + { "watchos", AppleSDK::WatchOS }, + { "watchsimulator", AppleSDK::WatchSimulator }, }; - for (std::string const& i : embedded) { - if (sdkRoot.find(i) == 0 || - sdkRoot.find(std::string("/") + i) != std::string::npos) { - return true; + for (auto entry : sdkDatabase) { + if (sdkRoot.find(entry.name) == 0 || + sdkRoot.find(std::string("/") + entry.name) != std::string::npos) { + return entry.sdk; } } - return false; + return AppleSDK::MacOS; +} + +bool cmMakefile::PlatformIsAppleEmbedded() const +{ + return GetAppleSDKType() != AppleSDK::MacOS; } const char* cmMakefile::GetSONameFlag(const std::string& language) const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 737cab9..c92424b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -191,7 +191,7 @@ public: }; /** - * Add a utility to the build. A utiltity target is a command that + * Add a utility to the build. A utility target is a command that * is run every time the target is built. */ cmTarget* AddUtilityCommand(const std::string& utilityName, @@ -439,8 +439,23 @@ public: /** Return whether the target platform is x32. */ bool PlatformIsx32() const; + /** Apple SDK Type */ + enum class AppleSDK + { + MacOS, + IPhoneOS, + IPhoneSimulator, + AppleTVOS, + AppleTVSimulator, + WatchOS, + WatchSimulator, + }; + + /** What SDK type points CMAKE_OSX_SYSROOT to? */ + AppleSDK GetAppleSDKType() const; + /** Return whether the target platform is Apple iOS. */ - bool PlatformIsAppleIos() const; + bool PlatformIsAppleEmbedded() const; /** Retrieve soname flag for the specified language if supported */ const char* GetSONameFlag(const std::string& language) const; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 850b8b2..002cc0f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -884,7 +884,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule( for (std::vector<std::string>::const_iterator o = outputs.begin() + 1; o != outputs.end(); ++o) { // Touch the extra output so "make" knows that it was updated, - // but only if the output was acually created. + // but only if the output was actually created. std::string const out = this->LocalGenerator->ConvertToOutputFormat( this->LocalGenerator->MaybeConvertToRelativePath(binDir, *o), cmOutputConverter::SHELL); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index c85c82d..e658e2c 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -82,7 +82,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, // Configure the Info.plist file std::string plist = newoutpath; - if (!this->Makefile->PlatformIsAppleIos()) { + if (!this->Makefile->PlatformIsAppleEmbedded()) { // Put the Info.plist file into the Resources directory. this->MacContentFolders->insert("Resources"); plist += "/Resources"; @@ -93,7 +93,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, plist.c_str()); // Generate Versions directory only for MacOSX frameworks - if (this->Makefile->PlatformIsAppleIos()) { + if (this->Makefile->PlatformIsAppleEmbedded()) { return; } diff --git a/Source/cmProcessOutput.cxx b/Source/cmProcessOutput.cxx index 617e1ca..8371706 100644 --- a/Source/cmProcessOutput.cxx +++ b/Source/cmProcessOutput.cxx @@ -13,7 +13,7 @@ cmProcessOutput::Encoding cmProcessOutput::FindEncoding( std::string const& name) { Encoding encoding = Auto; - if (name == "UTF8") { + if ((name == "UTF8") || (name == "UTF-8")) { encoding = UTF8; } else if (name == "NONE") { encoding = None; diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index fea8a9d..dfa1858 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -98,7 +98,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, } else if (args[i] == "DESCRIPTION") { if (haveDescription) { this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "DESCRITPION may be specified at most once."); + cmake::FATAL_ERROR, "DESCRIPTION may be specified at most once."); cmSystemTools::SetFatalErrorOccured(); return true; } diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 0de02b5..bce148e 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -234,7 +234,7 @@ bool cmQtAutoGeneratorMocUic::InitInfoFile(cmMakefile* makefile) // Compare list sizes if (sources.size() != options.size()) { std::ostringstream ost; - ost << "files/options lists sizes missmatch (" << sources.size() << "/" + ost << "files/options lists sizes mismatch (" << sources.size() << "/" << options.size() << ")"; this->LogFileError(cmQtAutoGen::UIC, this->GetInfoFile(), ost.str()); return false; diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0964bea..d5475d2 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -110,7 +110,7 @@ std::string const& cmSourceFile::GetFullPath() const bool cmSourceFile::FindFullPath(std::string* error) { - // If thie method has already failed once do not try again. + // If this method has already failed once do not try again. if (this->FindFullPathFailed) { return false; } diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index 467682d..a6819bd 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -38,12 +38,12 @@ public: bool Matches(cmSourceFileLocation const& loc); /** - * Explicity state that the source file is located in the source tree. + * Explicitly state that the source file is located in the source tree. */ void DirectoryUseSource(); /** - * Explicity state that the source file is located in the build tree. + * Explicitly state that the source file is located in the build tree. */ void DirectoryUseBinary(); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 2646df9..cf7de5a 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -59,7 +59,7 @@ public: * Set the function used by GUIs to display error messages * Function gets passed: message as a const char*, * title as a const char*, and a reference to bool that when - * set to false, will disable furthur messages (cancel). + * set to false, will disable further messages (cancel). */ static void SetMessageCallback(MessageCallback f, void* clientData = nullptr); @@ -167,7 +167,7 @@ public: * to be at the end of the string and it does not support ? * []... The optional argument type specifies what kind of files you * want to find. 0 means all files, -1 means directories, 1 means - * files only. This method returns true if search was succesfull. + * files only. This method returns true if search was successful. */ static bool SimpleGlob(const std::string& glob, std::vector<std::string>& files, int type = 0); @@ -229,7 +229,7 @@ public: /** * In this version of RunSingleCommand, command[0] should be * the command to run, and each argument to the command should - * be in comand[1]...command[command.size()] + * be in command[1]...command[command.size()] */ static bool RunSingleCommand(std::vector<std::string> const& command, std::string* captureStdOut = nullptr, diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 97bb0a2..9e4575a 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -242,7 +242,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( // Lookup old-style cache entry if type is unspecified. So if you // do a target_link_libraries(foo optimized bar) it will stay optimized // and not use the lookup. As there may be the case where someone has - // specifed that a library is both debug and optimized. (this check is + // specified that a library is both debug and optimized. (this check is // only there for backwards compatibility when mixing projects built // with old versions of CMake and new) llt = GENERAL_LibraryType; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9154dca..f997a11 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -38,8 +38,8 @@ static std::string cmVS10EscapeComment(std::string comment) // does "echo $CDATA" with no escapes. We must encode the string. // http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx std::string echoable; - for (std::string::iterator c = comment.begin(); c != comment.end(); ++c) { - switch (*c) { + for (char c : comment) { + switch (c) { case '\r': break; case '\n': @@ -54,7 +54,7 @@ static std::string cmVS10EscapeComment(std::string comment) echoable += '^'; /* no break */ CM_FALLTHROUGH; default: - echoable += *c; + echoable += c; break; } } @@ -405,18 +405,17 @@ void cmVisualStudio10TargetGenerator::Generate() } std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys(); - for (std::vector<std::string>::const_iterator keyIt = keys.begin(); - keyIt != keys.end(); ++keyIt) { + for (std::string const& keyIt : keys) { static const char* prefix = "VS_GLOBAL_"; - if (keyIt->find(prefix) != 0) + if (keyIt.find(prefix) != 0) continue; - std::string globalKey = keyIt->substr(strlen(prefix)); + std::string globalKey = keyIt.substr(strlen(prefix)); // Skip invalid or separately-handled properties. if (globalKey.empty() || globalKey == "PROJECT_TYPES" || globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") { continue; } - const char* value = this->GeneratorTarget->GetProperty(*keyIt); + const char* value = this->GeneratorTarget->GetProperty(keyIt); if (!value) continue; this->WriteString("<", 2); @@ -578,22 +577,18 @@ void cmVisualStudio10TargetGenerator::Generate() } this->WriteString("</ImportGroup>\n", 1); if (this->ProjectType == csproj) { - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { + for (std::string const& i : this->Configurations) { this->WriteString("<PropertyGroup Condition=\"'$(Configuration)' == '", 1); - (*this->BuildFileStream) << *i << "'\">\n"; - this->WriteEvents(*i); + (*this->BuildFileStream) << i << "'\">\n"; + this->WriteEvents(i); this->WriteString("</PropertyGroup>\n", 1); } // make sure custom commands are executed before build (if necessary) this->WriteString("<PropertyGroup>\n", 1); this->WriteString("<BuildDependsOn>\n", 2); - for (std::set<std::string>::const_iterator i = - this->CSharpCustomCommandNames.begin(); - i != this->CSharpCustomCommandNames.end(); ++i) { - this->WriteString(i->c_str(), 3); + for (std::string const& i : this->CSharpCustomCommandNames) { + this->WriteString(i.c_str(), 3); (*this->BuildFileStream) << ";\n"; } this->WriteString("$(BuildDependsOn)\n", 3); @@ -615,12 +610,11 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() cmSystemTools::ExpandListArgument(vsDotNetReferences, references); } cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties(); - for (cmPropertyMap::const_iterator i = props.begin(); i != props.end(); - ++i) { - if (i->first.find("VS_DOTNET_REFERENCE_") == 0) { - std::string name = i->first.substr(20); + for (auto const& i : props) { + if (i.first.find("VS_DOTNET_REFERENCE_") == 0) { + std::string name = i.first.substr(20); if (!name.empty()) { - std::string path = i->second.GetValue(); + std::string path = i.second.GetValue(); if (!cmsys::SystemTools::FileIsFullPath(path)) { path = std::string(this->GeneratorTarget->Target->GetMakefile() ->GetCurrentSourceDirectory()) + @@ -633,24 +627,20 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() } if (!references.empty() || !hintReferences.empty()) { this->WriteString("<ItemGroup>\n", 1); - for (std::vector<std::string>::iterator ri = references.begin(); - ri != references.end(); ++ri) { + for (std::string const& ri : references) { // if the entry from VS_DOTNET_REFERENCES is an existing file, generate // a new hint-reference and name it from the filename - if (cmsys::SystemTools::FileExists(*ri, true)) { - std::string name = - cmsys::SystemTools::GetFilenameWithoutExtension(*ri); - std::string path = *ri; + if (cmsys::SystemTools::FileExists(ri, true)) { + std::string name = cmsys::SystemTools::GetFilenameWithoutExtension(ri); + std::string path = ri; this->ConvertToWindowsSlash(path); hintReferences.push_back(HintReference(name, path)); } else { - this->WriteDotNetReference(*ri, ""); + this->WriteDotNetReference(ri, ""); } } - for (std::vector<std::pair<std::string, std::string>>::const_iterator i = - hintReferences.begin(); - i != hintReferences.end(); ++i) { - this->WriteDotNetReference(i->first, i->second); + for (const auto& i : hintReferences) { + this->WriteDotNetReference(i.first, i.second); } this->WriteString("</ItemGroup>\n", 1); } @@ -694,22 +684,19 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( typedef std::map<std::string, std::string> CustomTags; CustomTags tags; cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties(); - for (cmPropertyMap::const_iterator i = props.begin(); i != props.end(); - ++i) { - if (i->first.find(refPropFullPrefix) == 0) { - std::string refTag = i->first.substr(refPropFullPrefix.length()); - std::string refVal = i->second.GetValue(); + for (const auto& i : props) { + if (i.first.find(refPropFullPrefix) == 0) { + std::string refTag = i.first.substr(refPropFullPrefix.length()); + std::string refVal = i.second.GetValue(); if (!refTag.empty() && !refVal.empty()) { tags[refTag] = refVal; } } } - for (CustomTags::const_iterator tag = tags.begin(); tag != tags.end(); - ++tag) { + for (auto const& tag : tags) { this->WriteString("<", 3); - (*this->BuildFileStream) << tag->first << ">" - << cmVS10EscapeXML(tag->second) << "</" - << tag->first << ">\n"; + (*this->BuildFileStream) << tag.first << ">" << cmVS10EscapeXML(tag.second) + << "</" << tag.first << ">\n"; } } @@ -721,10 +708,8 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() this->WriteString("<ItemGroup>\n", 1); std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); this->ConvertToWindowsSlash(srcDir); - for (std::vector<cmSourceFile const*>::const_iterator oi = - resxObjs.begin(); - oi != resxObjs.end(); ++oi) { - std::string obj = (*oi)->GetFullPath(); + for (cmSourceFile const* oi : resxObjs) { + std::string obj = oi->GetFullPath(); this->WriteString("<EmbeddedResource Include=\"", 2); this->ConvertToWindowsSlash(obj); bool useRelativePath = false; @@ -746,10 +731,8 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; (*this->BuildFileStream) << hFileName << "</DependentUpon>\n"; - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - this->WritePlatformConfigTag("LogicalName", *i, 3); + for (std::string const& i : this->Configurations) { + this->WritePlatformConfigTag("LogicalName", i, 3); if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") || // Handle variant of VS_GLOBAL_<variable> for RootNamespace. this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) { @@ -780,13 +763,12 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() } // Determine if this is a generated resource from a .Designer.cs file std::string designerResource = - cmSystemTools::GetFilenamePath((*oi)->GetFullPath()) + "/" + - cmSystemTools::GetFilenameWithoutLastExtension( - (*oi)->GetFullPath()) + + cmSystemTools::GetFilenamePath(oi->GetFullPath()) + "/" + + cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()) + ".Designer.cs"; if (cmsys::SystemTools::FileExists(designerResource)) { std::string generator = "PublicResXFileCodeGenerator"; - if (const char* g = (*oi)->GetProperty("VS_RESOURCE_GENERATOR")) { + if (const char* g = oi->GetProperty("VS_RESOURCE_GENERATOR")) { generator = g; } if (!generator.empty()) { @@ -807,14 +789,13 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() << "</LastGenOutput>\n"; } } - const cmPropertyMap& props = (*oi)->GetProperties(); - for (cmPropertyMap::const_iterator p = props.begin(); p != props.end(); - ++p) { + const cmPropertyMap& props = oi->GetProperties(); + for (const auto& p : props) { static const std::string propNamePrefix = "VS_CSHARP_"; - if (p->first.find(propNamePrefix) == 0) { - std::string tagName = p->first.substr(propNamePrefix.length()); + if (p.first.find(propNamePrefix) == 0) { + std::string tagName = p.first.substr(propNamePrefix.length()); if (!tagName.empty()) { - std::string value = props.GetPropertyValue(p->first); + std::string value = props.GetPropertyValue(p.first); if (!value.empty()) { this->WriteString("<", 3); (*this->BuildFileStream) << tagName << ">"; @@ -838,19 +819,17 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() this->GeneratorTarget->GetXamlSources(xamlObjs, ""); if (!xamlObjs.empty()) { this->WriteString("<ItemGroup>\n", 1); - for (std::vector<cmSourceFile const*>::const_iterator oi = - xamlObjs.begin(); - oi != xamlObjs.end(); ++oi) { - std::string obj = (*oi)->GetFullPath(); + for (cmSourceFile const* oi : xamlObjs) { + std::string obj = oi->GetFullPath(); std::string xamlType; - const char* xamlTypeProperty = (*oi)->GetProperty("VS_XAML_TYPE"); + const char* xamlTypeProperty = oi->GetProperty("VS_XAML_TYPE"); if (xamlTypeProperty) { xamlType = xamlTypeProperty; } else { xamlType = "Page"; } - this->WriteSource(xamlType, *oi, ">\n"); + this->WriteSource(xamlType, oi, ">\n"); if (this->ProjectType == csproj && !this->InSourceBuild) { // add <Link> tag to written XAML source if necessary const std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); @@ -1425,30 +1404,28 @@ void cmVisualStudio10TargetGenerator::WriteGroups() // Added files are images and the manifest. if (!this->AddedFiles.empty()) { this->WriteString("<ItemGroup>\n", 1); - for (std::vector<std::string>::const_iterator oi = - this->AddedFiles.begin(); - oi != this->AddedFiles.end(); ++oi) { + for (std::string const& oi : this->AddedFiles) { std::string fileName = - cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(*oi)); + cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi)); if (fileName == "wmappmanifest.xml") { this->WriteString("<XML Include=\"", 2); - (*this->BuildFileStream) << *oi << "\">\n"; + (*this->BuildFileStream) << oi << "\">\n"; this->WriteString("<Filter>Resource Files</Filter>\n", 3); this->WriteString("</XML>\n", 2); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".appxmanifest") { this->WriteString("<AppxManifest Include=\"", 2); - (*this->BuildFileStream) << *oi << "\">\n"; + (*this->BuildFileStream) << oi << "\">\n"; this->WriteString("<Filter>Resource Files</Filter>\n", 3); this->WriteString("</AppxManifest>\n", 2); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") { this->WriteString("<None Include=\"", 2); - (*this->BuildFileStream) << *oi << "\">\n"; + (*this->BuildFileStream) << oi << "\">\n"; this->WriteString("<Filter>Resource Files</Filter>\n", 3); this->WriteString("</None>\n", 2); } else { this->WriteString("<Image Include=\"", 2); - (*this->BuildFileStream) << *oi << "\">\n"; + (*this->BuildFileStream) << oi << "\">\n"; this->WriteString("<Filter>Resource Files</Filter>\n", 3); this->WriteString("</Image>\n", 2); } @@ -1460,10 +1437,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->GeneratorTarget->GetResxSources(resxObjs, ""); if (!resxObjs.empty()) { this->WriteString("<ItemGroup>\n", 1); - for (std::vector<cmSourceFile const*>::const_iterator oi = - resxObjs.begin(); - oi != resxObjs.end(); ++oi) { - std::string obj = (*oi)->GetFullPath(); + for (cmSourceFile const* oi : resxObjs) { + std::string obj = oi->GetFullPath(); this->WriteString("<EmbeddedResource Include=\"", 2); this->ConvertToWindowsSlash(obj); (*this->BuildFileStream) << cmVS10EscapeXML(obj) << "\">\n"; @@ -1522,16 +1497,15 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( std::set<cmSourceGroup*>& groupsUsed, const std::vector<cmSourceGroup>& allGroups) { - for (std::vector<cmSourceGroup>::const_iterator current = allGroups.begin(); - current != allGroups.end(); ++current) { - std::vector<cmSourceGroup> const& children = current->GetGroupChildren(); + for (cmSourceGroup const& current : allGroups) { + std::vector<cmSourceGroup> const& children = current.GetGroupChildren(); if (children.empty()) { continue; // the group is really empty } this->AddMissingSourceGroups(groupsUsed, children); - cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(&(*current)); + cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(¤t); if (groupsUsed.find(current_ptr) != groupsUsed.end()) { continue; // group has already been added to set } @@ -1560,15 +1534,14 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources( std::vector<cmSourceGroup>& sourceGroups) { this->WriteString("<ItemGroup>\n", 1); - for (ToolSources::const_iterator s = sources.begin(); s != sources.end(); - ++s) { - cmSourceFile const* sf = s->SourceFile; + for (ToolSource const& s : sources) { + cmSourceFile const* sf = s.SourceFile; std::string const& source = sf->GetFullPath(); cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); std::string const& filter = sourceGroup->GetFullName(); this->WriteString("<", 2); - std::string path = this->ConvertPath(source, s->RelativePath); + std::string path = this->ConvertPath(source, s.RelativePath); this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path); if (!filter.empty()) { @@ -1939,11 +1912,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() std::vector<cmGeneratorTarget::AllConfigSource> const& sources = this->GeneratorTarget->GetAllConfigSources(); - for (std::vector<cmGeneratorTarget::AllConfigSource>::const_iterator si = - sources.begin(); - si != sources.end(); ++si) { + for (cmGeneratorTarget::AllConfigSource const& si : sources) { std::string tool; - switch (si->Kind) { + switch (si.Kind) { case cmGeneratorTarget::SourceKindAppManifest: tool = "AppxManifest"; break; @@ -1962,17 +1933,17 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() // then vs10 will use it in the build, and we have to list it as // None instead of Object. std::vector<cmSourceFile*> const* d = - this->GeneratorTarget->GetSourceDepends(si->Source); + this->GeneratorTarget->GetSourceDepends(si.Source); if (d && !d->empty()) { tool = "None"; } } break; case cmGeneratorTarget::SourceKindExtra: - this->WriteExtraSource(si->Source); + this->WriteExtraSource(si.Source); break; case cmGeneratorTarget::SourceKindHeader: - this->WriteHeaderSource(si->Source); + this->WriteHeaderSource(si.Source); break; case cmGeneratorTarget::SourceKindIDL: tool = "Midl"; @@ -1984,7 +1955,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() tool = "None"; break; case cmGeneratorTarget::SourceKindObjectSource: { - const std::string& lang = si->Source->GetLanguage(); + const std::string& lang = si.Source->GetLanguage(); if (lang == "C" || lang == "CXX") { tool = "ClCompile"; } else if (lang == "ASM_MASM" && @@ -2013,16 +1984,16 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() if (!tool.empty()) { // Compute set of configurations to exclude, if any. - std::vector<size_t> const& include_configs = si->Configs; + std::vector<size_t> const& include_configs = si.Configs; std::vector<size_t> exclude_configs; std::set_difference(all_configs.begin(), all_configs.end(), include_configs.begin(), include_configs.end(), std::back_inserter(exclude_configs)); - if (si->Kind == cmGeneratorTarget::SourceKindObjectSource) { + if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) { // FIXME: refactor generation to avoid tracking XML syntax state. - this->WriteSource(tool, si->Source, " "); - bool have_nested = this->OutputSourceSpecificFlags(si->Source); + this->WriteSource(tool, si.Source, " "); + bool have_nested = this->OutputSourceSpecificFlags(si.Source); if (!exclude_configs.empty()) { if (!have_nested) { (*this->BuildFileStream) << ">\n"; @@ -2037,12 +2008,12 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() (*this->BuildFileStream) << " />\n"; } } else if (!exclude_configs.empty()) { - this->WriteSource(tool, si->Source, ">\n"); + this->WriteSource(tool, si.Source, ">\n"); this->WriteExcludeFromBuild(exclude_configs); this->WriteString("</", 2); (*this->BuildFileStream) << tool << ">\n"; } else { - this->WriteSource(tool, si->Source); + this->WriteSource(tool, si.Source); } } } @@ -2113,10 +2084,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( (*this->BuildFileStream) << "$(IntDir)/" << objectName << "</ObjectFileName>\n"; } - for (std::vector<std::string>::const_iterator config = - this->Configurations.begin(); - config != this->Configurations.end(); ++config) { - std::string configUpper = cmSystemTools::UpperCase(*config); + for (std::string const& config : this->Configurations) { + std::string configUpper = cmSystemTools::UpperCase(config); std::string configDefines = defines; std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; @@ -2152,7 +2121,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( flagtable = gg->GetCSharpFlagTable(); } cmGeneratorExpressionInterpreter genexInterpreter( - this->LocalGenerator, this->GeneratorTarget, *config, + this->LocalGenerator, this->GeneratorTarget, config, this->GeneratorTarget->GetName(), lang); cmVisualStudioGeneratorOptions clOptions( this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, @@ -2182,7 +2151,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } else { clOptions.AddDefines(configDefines.c_str()); } - clOptions.SetConfiguration((*config).c_str()); + clOptions.SetConfiguration(config.c_str()); clOptions.PrependInheritedString("AdditionalOptions"); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", @@ -2224,12 +2193,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( std::vector<size_t> const& exclude_configs) { - for (std::vector<size_t>::const_iterator ci = exclude_configs.begin(); - ci != exclude_configs.end(); ++ci) { + for (size_t ci : exclude_configs) { this->WriteString("", 3); (*this->BuildFileStream) << "<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='" - << cmVS10EscapeXML(this->Configurations[*ci]) << "|" + << cmVS10EscapeXML(this->Configurations[ci]) << "|" << cmVS10EscapeXML(this->Platform) << "'\">true</ExcludedFromBuild>\n"; } } @@ -2248,11 +2216,9 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() this->WriteString("<_ProjectFileVersion>10.0.20506.1" "</_ProjectFileVersion>\n", 2); - for (std::vector<std::string>::const_iterator config = - this->Configurations.begin(); - config != this->Configurations.end(); ++config) { + for (std::string const& config : this->Configurations) { if (ttype >= cmStateEnums::UTILITY) { - this->WritePlatformConfigTag("IntDir", *config, 2); + this->WritePlatformConfigTag("IntDir", config, 2); *this->BuildFileStream << "$(Platform)\\$(Configuration)\\$(ProjectName)\\" << "</IntDir>\n"; @@ -2260,7 +2226,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() std::string intermediateDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); intermediateDir += "/"; - intermediateDir += *config; + intermediateDir += config; intermediateDir += "/"; std::string outDir; std::string targetNameFull; @@ -2269,22 +2235,22 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() targetNameFull = this->GeneratorTarget->GetName(); targetNameFull += ".lib"; } else { - outDir = this->GeneratorTarget->GetDirectory(*config) + "/"; - targetNameFull = this->GeneratorTarget->GetFullName(*config); + outDir = this->GeneratorTarget->GetDirectory(config) + "/"; + targetNameFull = this->GeneratorTarget->GetFullName(config); } this->ConvertToWindowsSlash(intermediateDir); this->ConvertToWindowsSlash(outDir); - this->WritePlatformConfigTag("OutDir", *config, 2); + this->WritePlatformConfigTag("OutDir", config, 2); *this->BuildFileStream << cmVS10EscapeXML(outDir) << "</OutDir>\n"; - this->WritePlatformConfigTag("IntDir", *config, 2); + this->WritePlatformConfigTag("IntDir", config, 2); *this->BuildFileStream << cmVS10EscapeXML(intermediateDir) << "</IntDir>\n"; if (const char* workingDir = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_WORKING_DIRECTORY")) { - this->WritePlatformConfigTag("LocalDebuggerWorkingDirectory", *config, + this->WritePlatformConfigTag("LocalDebuggerWorkingDirectory", config, 2); *this->BuildFileStream << cmVS10EscapeXML(workingDir) << "</LocalDebuggerWorkingDirectory>\n"; @@ -2292,7 +2258,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() std::string name = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); - this->WritePlatformConfigTag("TargetName", *config, 2); + this->WritePlatformConfigTag("TargetName", config, 2); *this->BuildFileStream << cmVS10EscapeXML(name) << "</TargetName>\n"; std::string ext = @@ -2302,10 +2268,10 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() // A single "." appears to be treated as an empty extension. ext = "."; } - this->WritePlatformConfigTag("TargetExt", *config, 2); + this->WritePlatformConfigTag("TargetExt", config, 2); *this->BuildFileStream << cmVS10EscapeXML(ext) << "</TargetExt>\n"; - this->OutputLinkIncremental(*config); + this->OutputLinkIncremental(config); } } this->WriteString("</PropertyGroup>\n", 1); @@ -2355,10 +2321,8 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental( bool cmVisualStudio10TargetGenerator::ComputeClOptions() { - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeClOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeClOptions(i)) { return false; } } @@ -2582,10 +2546,8 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( bool cmVisualStudio10TargetGenerator::ComputeRcOptions() { - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeRcOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeRcOptions(i)) { return false; } } @@ -2643,10 +2605,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions() if (!this->GlobalGenerator->IsCudaEnabled()) { return true; } - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeCudaOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeCudaOptions(i)) { return false; } } @@ -2758,10 +2718,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions() if (!this->GlobalGenerator->IsCudaEnabled()) { return true; } - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeCudaLinkOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeCudaLinkOptions(i)) { return false; } } @@ -2829,10 +2787,8 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() if (!this->GlobalGenerator->IsMasmEnabled()) { return true; } - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeMasmOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeMasmOptions(i)) { return false; } } @@ -2887,10 +2843,8 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions() if (!this->GlobalGenerator->IsNasmEnabled()) { return true; } - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeNasmOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeNasmOptions(i)) { return false; } } @@ -2997,10 +2951,8 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions( if (!manifest_srcs.empty()) { this->WriteString("<Manifest>\n", 2); this->WriteString("<AdditionalManifestFiles>", 3); - for (std::vector<cmSourceFile const*>::const_iterator mi = - manifest_srcs.begin(); - mi != manifest_srcs.end(); ++mi) { - std::string m = this->ConvertPath((*mi)->GetFullPath(), false); + for (cmSourceFile const* mi : manifest_srcs) { + std::string m = this->ConvertPath(mi->GetFullPath(), false); this->ConvertToWindowsSlash(m); (*this->BuildFileStream) << m << ";"; } @@ -3018,12 +2970,10 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( { std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); - for (std::vector<cmSourceFile const*>::const_iterator si = - extraSources.begin(); - si != extraSources.end(); ++si) { + for (cmSourceFile const* si : extraSources) { if ("androidmanifest.xml" == - cmSystemTools::LowerCase((*si)->GetLocation().GetName())) { - rootDir = (*si)->GetLocation().GetDirectory(); + cmSystemTools::LowerCase(si->GetLocation().GetName())) { + rootDir = si->GetLocation().GetDirectory(); break; } } @@ -3142,10 +3092,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE || this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeLinkOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeLinkOptions(i)) { return false; } } @@ -3242,19 +3190,17 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( linkOptions.AddFlag("AdditionalDependencies", libVec); // Populate TargetsFileAndConfigsVec - for (std::vector<std::string>::iterator ti = vsTargetVec.begin(); - ti != vsTargetVec.end(); ++ti) { - this->AddTargetsFileAndConfigPair(*ti, config); + for (std::string const& ti : vsTargetVec) { + this->AddTargetsFileAndConfigPair(ti, config); } std::vector<std::string> const& ldirs = cli.GetDirectories(); std::vector<std::string> linkDirs; - for (std::vector<std::string>::const_iterator d = ldirs.begin(); - d != ldirs.end(); ++d) { + for (std::string const& d : ldirs) { // first just full path - linkDirs.push_back(*d); + linkDirs.push_back(d); // next path with configuration type Debug, Release, etc - linkDirs.push_back(*d + "/$(Configuration)"); + linkDirs.push_back(d + "/$(Configuration)"); } linkDirs.push_back("%(AdditionalLibraryDirectories)"); linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs); @@ -3374,10 +3320,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( bool cmVisualStudio10TargetGenerator::ComputeLibOptions() { if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - if (!this->ComputeLibOptions(*i)) { + for (std::string const& i : this->Configurations) { + if (!this->ComputeLibOptions(i)) { return false; } } @@ -3402,10 +3346,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions( const ItemVector& libs = cli.GetItems(); std::string currentBinDir = this->LocalGenerator->GetCurrentBinaryDirectory(); - for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { - if (l->IsPath && cmVS10IsTargetsFile(l->Value)) { + for (cmComputeLinkInformation::Item const& l : libs) { + if (l.IsPath && cmVS10IsTargetsFile(l.Value)) { std::string path = - this->LocalGenerator->ConvertToRelativePath(currentBinDir, l->Value); + this->LocalGenerator->ConvertToRelativePath(currentBinDir, l.Value); this->ConvertToWindowsSlash(path); this->AddTargetsFileAndConfigPair(path, config); } @@ -3448,19 +3392,19 @@ void cmVisualStudio10TargetGenerator::AddLibraries( ItemVector const& libs = cli.GetItems(); std::string currentBinDir = this->LocalGenerator->GetCurrentBinaryDirectory(); - for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { - if (l->IsPath) { + for (cmComputeLinkInformation::Item const& l : libs) { + if (l.IsPath) { std::string path = - this->LocalGenerator->ConvertToRelativePath(currentBinDir, l->Value); + this->LocalGenerator->ConvertToRelativePath(currentBinDir, l.Value); this->ConvertToWindowsSlash(path); - if (cmVS10IsTargetsFile(l->Value)) { + if (cmVS10IsTargetsFile(l.Value)) { vsTargetVec.push_back(path); } else { libVec.push_back(path); } - } else if (!l->Target || - l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - libVec.push_back(l->Value); + } else if (!l.Target || + l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + libVec.push_back(l.Value); } } } @@ -3468,13 +3412,11 @@ void cmVisualStudio10TargetGenerator::AddLibraries( void cmVisualStudio10TargetGenerator::AddTargetsFileAndConfigPair( std::string const& targetsFile, std::string const& config) { - for (std::vector<TargetsFileAndConfigs>::iterator i = - this->TargetsFileAndConfigsVec.begin(); - i != this->TargetsFileAndConfigsVec.end(); ++i) { - if (cmSystemTools::ComparePath(targetsFile, i->File)) { - if (std::find(i->Configs.begin(), i->Configs.end(), config) == - i->Configs.end()) { - i->Configs.push_back(config); + for (TargetsFileAndConfigs& i : this->TargetsFileAndConfigsVec) { + if (cmSystemTools::ComparePath(targetsFile, i.File)) { + if (std::find(i.Configs.begin(), i.Configs.end(), config) == + i.Configs.end()) { + i.Configs.push_back(config); } return; } @@ -3512,9 +3454,8 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions( // on the CMake side? this->WriteString("<Midl>\n", 2); this->WriteString("<AdditionalIncludeDirectories>", 3); - for (std::vector<std::string>::const_iterator i = includes.begin(); - i != includes.end(); ++i) { - *this->BuildFileStream << cmVS10EscapeXML(*i) << ";"; + for (std::string const& i : includes) { + *this->BuildFileStream << cmVS10EscapeXML(i) << ";"; } this->WriteString("%(AdditionalIncludeDirectories)" "</AdditionalIncludeDirectories>\n", @@ -3536,44 +3477,41 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() if (this->ProjectType == csproj) { return; } - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { + for (std::string const& i : this->Configurations) { std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories( - includes, this->GeneratorTarget, "C", *i); - for (std::vector<std::string>::iterator ii = includes.begin(); - ii != includes.end(); ++ii) { - this->ConvertToWindowsSlash(*ii); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, "C", i); + for (std::string& ii : includes) { + this->ConvertToWindowsSlash(ii); } - this->WritePlatformConfigTag("ItemDefinitionGroup", *i, 1); + this->WritePlatformConfigTag("ItemDefinitionGroup", i, 1); *this->BuildFileStream << "\n"; // output cl compile flags <ClCompile></ClCompile> if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { - this->WriteClOptions(*i, includes); + this->WriteClOptions(i, includes); // output rc compile flags <ResourceCompile></ResourceCompile> - this->WriteRCOptions(*i, includes); - this->WriteCudaOptions(*i, includes); - this->WriteMasmOptions(*i, includes); - this->WriteNasmOptions(*i, includes); + this->WriteRCOptions(i, includes); + this->WriteCudaOptions(i, includes); + this->WriteMasmOptions(i, includes); + this->WriteNasmOptions(i, includes); } // output midl flags <Midl></Midl> - this->WriteMidlOptions(*i, includes); + this->WriteMidlOptions(i, includes); // write events if (this->ProjectType != csproj) { - this->WriteEvents(*i); + this->WriteEvents(i); } // output link flags <Link></Link> - this->WriteLinkOptions(*i); - this->WriteCudaLinkOptions(*i); + this->WriteLinkOptions(i); + this->WriteCudaLinkOptions(i); // output lib flags <Lib></Lib> - this->WriteLibOptions(*i); + this->WriteLibOptions(i); // output manifest flags <Manifest></Manifest> - this->WriteManifestOptions(*i); + this->WriteManifestOptions(i); if (this->NsightTegra && this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE && this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { - this->WriteAntBuildOptions(*i); + this->WriteAntBuildOptions(i); } this->WriteString("</ItemDefinitionGroup>\n", 1); } @@ -3616,9 +3554,8 @@ void cmVisualStudio10TargetGenerator::WriteEvent( std::string script; const char* pre = ""; std::string comment; - for (std::vector<cmCustomCommand>::const_iterator i = commands.begin(); - i != commands.end(); ++i) { - cmCustomCommandGenerator ccg(*i, configName, this->LocalGenerator); + for (cmCustomCommand const& i : commands) { + cmCustomCommandGenerator ccg(i, configName, this->LocalGenerator); if (!ccg.HasOnlyEmptyCommandLines()) { comment += pre; comment += lg->ConstructComment(ccg); @@ -3658,9 +3595,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() OrderedTargetDependSet; OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET); this->WriteString("<ItemGroup>\n", 1); - for (OrderedTargetDependSet::const_iterator i = depends.begin(); - i != depends.end(); ++i) { - cmGeneratorTarget const* dt = *i; + for (cmTargetDepend const& i : depends) { + cmGeneratorTarget const* dt = i; if (dt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -3755,10 +3691,9 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences); this->WriteString("<ItemGroup>\n", 1); hasWrittenItemGroup = true; - for (std::vector<std::string>::iterator ri = sdkReferences.begin(); - ri != sdkReferences.end(); ++ri) { + for (std::string const& ri : sdkReferences) { this->WriteString("<SDKReference Include=\"", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\"/>\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(ri) << "\"/>\n"; } } @@ -3813,10 +3748,8 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() std::string pfxFile; std::vector<cmSourceFile const*> certificates; this->GeneratorTarget->GetCertificates(certificates, ""); - for (std::vector<cmSourceFile const*>::const_iterator si = - certificates.begin(); - si != certificates.end(); ++si) { - pfxFile = this->ConvertPath((*si)->GetFullPath(), false); + for (cmSourceFile const* si : certificates) { + pfxFile = this->ConvertPath(si->GetFullPath(), false); this->ConvertToWindowsSlash(pfxFile); break; } @@ -4028,12 +3961,10 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); bool foundManifest = false; - for (std::vector<cmSourceFile const*>::const_iterator si = - extraSources.begin(); - si != extraSources.end(); ++si) { + for (cmSourceFile const* si : extraSources) { // Need to do a lowercase comparison on the filename if ("wmappmanifest.xml" == - cmSystemTools::LowerCase((*si)->GetLocation().GetName())) { + cmSystemTools::LowerCase(si->GetLocation().GetName())) { foundManifest = true; break; } @@ -4495,13 +4426,12 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties( { if (this->ProjectType == csproj) { const cmPropertyMap& props = sf->GetProperties(); - for (cmPropertyMap::const_iterator p = props.begin(); p != props.end(); - ++p) { + for (auto const& p : props) { static const std::string propNamePrefix = "VS_CSHARP_"; - if (p->first.find(propNamePrefix) == 0) { - std::string tagName = p->first.substr(propNamePrefix.length()); + if (p.first.find(propNamePrefix) == 0) { + std::string tagName = p.first.substr(propNamePrefix.length()); if (!tagName.empty()) { - const std::string val = props.GetPropertyValue(p->first); + const std::string val = props.GetPropertyValue(p.first); if (!val.empty()) { tags[tagName] = val; } else { @@ -4517,11 +4447,10 @@ void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties( const std::map<std::string, std::string>& tags) { if (!tags.empty()) { - for (std::map<std::string, std::string>::const_iterator i = tags.begin(); - i != tags.end(); ++i) { + for (const auto& i : tags) { this->WriteString("<", 3); - (*this->BuildFileStream) << i->first << ">" << cmVS10EscapeXML(i->second) - << "</" << i->first << ">\n"; + (*this->BuildFileStream) << i.first << ">" << cmVS10EscapeXML(i.second) + << "</" << i.first << ">\n"; } } } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 4f3d737..9a5986c 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -317,7 +317,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() continue; } - // unknwon sub option + // unknown sub option } AddFlag(ENABLE_UAC, "true"); diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index c890acf..7bae21e 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -108,7 +108,7 @@ private: * It would be tempting to convert a time_point to number of seconds by * using time_since_epoch(). Unfortunately the C++11 standard does not * specify what the epoch of the system_clock must be. - * Therefore we must assume it is an arbitary point in time. Instead of this + * Therefore we must assume it is an arbitrary point in time. Instead of this * method, it is recommended to convert it by means of the to_time_t method. */ static std::time_t SafeContent( diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index 71bcb18..b4b1286 100644 --- a/Tests/CMakeBuildTest.cmake.in +++ b/Tests/CMakeBuildTest.cmake.in @@ -29,11 +29,10 @@ if(RESULT) message(FATAL_ERROR "Error running cmake --build") endif() -# check for configuration types -set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@) -# run the executable out of the Debug directory if there -# are configuration types -if(CMAKE_CONFIGURATION_TYPES) +# run the executable out of the Debug directory if using a +# multi-config generator +set(_isMultiConfig @_isMultiConfig@) +if(_isMultiConfig) set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/@CMAKE_BUILD_TEST_EXE@") else() set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/@CMAKE_BUILD_TEST_EXE@") diff --git a/Tests/CMakeInstall.cmake b/Tests/CMakeInstall.cmake index fda8c54..d9d85f7 100644 --- a/Tests/CMakeInstall.cmake +++ b/Tests/CMakeInstall.cmake @@ -14,7 +14,18 @@ if(CMake_TEST_INSTALL) set(CMake_TEST_INSTALL_PREFIX ${CMake_BINARY_DIR}/Tests/CMakeInstall) set(CMAKE_INSTALL_PREFIX "${CMake_TEST_INSTALL_PREFIX}") - if(CMAKE_CONFIGURATION_TYPES) + # 3.9 or later provides a definitive answer to whether we are multi-config + # through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set + # is assumed to mean multi-config, but developers might modify it so it is + # technically not as reliable. + if(NOT CMAKE_VERSION VERSION_LESS 3.9) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + elseif(CMAKE_CONFIGURATION_TYPES) + set(_isMultiConfig True) + else() + set(_isMultiConfig False) + endif() + if(_isMultiConfig) # There are multiple configurations. Make sure the tested # configuration is the one that is installed. set(CMake_TEST_INSTALL_CONFIG --config $<CONFIGURATION>) diff --git a/Tests/CMakeLib/testEncoding.cxx b/Tests/CMakeLib/testEncoding.cxx index 5e40638..11f6409 100644 --- a/Tests/CMakeLib/testEncoding.cxx +++ b/Tests/CMakeLib/testEncoding.cxx @@ -31,7 +31,7 @@ int main(int argc, char* argv[]) } const std::string encoding(argv[1]); #ifdef _WIN32 - if (encoding == "UTF8") { + if ((encoding == "UTF8") || (encoding == "UTF-8")) { setEncoding(consoleOut, CP_UTF8); } else if (encoding == "ANSI") { setEncoding(consoleOut, CP_ACP); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5d8c2fe..fb7313f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -38,9 +38,21 @@ set(ENV{HOME} \"${TEST_HOME}\") ") endif() +# 3.9 or later provides a definitive answer to whether we are multi-config +# through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set +# is assumed to mean multi-config, but developers might modify it so it is +# technically not as reliable. +if(NOT CMAKE_VERSION VERSION_LESS 3.9) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +elseif(CMAKE_CONFIGURATION_TYPES) + set(_isMultiConfig True) +else() + set(_isMultiConfig False) +endif() + # Choose a default configuration for CTest tests. set(CTestTest_CONFIG Debug) -if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) +if(NOT _isMultiConfig AND CMAKE_BUILD_TYPE) set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE}) endif() @@ -3190,7 +3202,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result ) if(_result EQUAL 0) - if(CMAKE_CONFIGURATION_TYPES) + if(_isMultiConfig) set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>) else() set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah) diff --git a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt index 6d1628a..3676b17 100644 --- a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt +++ b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.9) project(SelectLibraryConfigurations NONE) @@ -15,7 +15,8 @@ macro(check_slc basename expect) endif () endmacro(check_slc) -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if (NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE) set(NOTYPE_RELONLY_LIBRARY_RELEASE "opt") check_slc(NOTYPE_RELONLY "opt") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake index 1fe9258..ec75d61 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake @@ -4,7 +4,7 @@ endif() include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake) -# TODO: currently debian doens't produce lower cased names +# TODO: currently debian doesn't produce lower cased names set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb") set(expected_count 3) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake index 13a626a..8c0bc4b 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake @@ -4,7 +4,7 @@ endif() include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake) -# TODO: currently debian doens't produce lower cased names +# TODO: currently debian doesn't produce lower cased names set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2_*.deb") set(expected_count 1) diff --git a/Tests/CTestConfig/CMakeLists.txt b/Tests/CTestConfig/CMakeLists.txt index f46d89a..8c19adb 100644 --- a/Tests/CTestConfig/CMakeLists.txt +++ b/Tests/CTestConfig/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.9) project(CTestConfig) include(CTest) @@ -8,32 +8,41 @@ include(CTest) # 'ctest -S script.cmake' call. # # In either case, we expect CMAKE_BUILD_TYPE to be defined for single-configuration -# build trees and not defined for multi-configuration build trees. +# build trees and not defined for multi-configuration build trees. The value of +# CMAKE_CONFIGURATION_TYPES should not be relied upon to determine whether we +# are using a multi-config generator or not, the GENERATOR_IS_MULTI_CONFIG +# global property is the canonical way to do that as of CMake 3.9. # -if(CMAKE_CONFIGURATION_TYPES) - # multi-configuration: expect not defined, error if defined +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + if(NOT DEFINED CMAKE_CONFIGURATION_TYPES OR CMAKE_CONFIGURATION_TYPES STREQUAL "") + message(FATAL_ERROR "CMAKE_CONFIGURATION_TYPES is not defined or is empty " + "(but must be defined and non-empty for a multi-configuration generator)") + endif() if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "") - message(FATAL_ERROR "CMAKE_CONFIGURATION_TYPES='${CMAKE_CONFIGURATION_TYPES}' CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' is defined and non-empty (but should not be for a multi-configuration generator)") + message(FATAL_ERROR "CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' is defined and non-empty " + "(but should not be for a multi-configuration generator)") endif() + set(_configs ${CMAKE_CONFIGURATION_TYPES}) else() - # single-configuration: expect defined, error if not defined + # Populating CMAKE_CONFIGURATION_TYPES even for single config generators is + # common enough for user projects that we don't want to consider it an error. + # We just need CMAKE_BUILD_TYPE to be set and ignore CMAKE_CONFIGURATION_TYPES. if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") - message(FATAL_ERROR "CMAKE_BUILD_TYPE is not defined or is empty (but should be defined and non-empty for a single-configuration generator)") + message(FATAL_ERROR "CMAKE_BUILD_TYPE is not defined or is empty " + "(but should be defined and non-empty for a single-configuration generator)") endif() -endif() - - -if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "") add_definitions(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}") + set(_configs ${CMAKE_BUILD_TYPE}) endif() add_executable(ctc CTestConfig.cxx) -foreach(cfg ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) +foreach(cfg ${_configs}) add_test(NAME ctc-${cfg} CONFIGURATIONS ${cfg} COMMAND ctc --config $<CONFIGURATION>) - if(CMAKE_CONFIGURATION_TYPES) + if(_isMultiConfig) set_property(TEST ctc-${cfg} PROPERTY PASS_REGULAR_EXPRESSION "CMAKE_INTDIR is ${cfg}") set_property(TEST ctc-${cfg} diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in index 143fe71..4bb1262 100644 --- a/Tests/CTestConfig/dashboard.cmake.in +++ b/Tests/CTestConfig/dashboard.cmake.in @@ -1,4 +1,4 @@ -set(CMAKE_CONFIGURATION_TYPES "@CMAKE_CONFIGURATION_TYPES@") +set(_isMultiConfig "@_isMultiConfig@") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestConfig") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-dashboard") @@ -11,7 +11,7 @@ message("CMAKE_COMMAND='${CMAKE_COMMAND}'") message("CMAKE_CTEST_COMMAND='${CMAKE_CTEST_COMMAND}'") set(arg "") -if(NOT CMAKE_CONFIGURATION_TYPES) +if(NOT _isMultiConfig) set(arg "-DCMAKE_BUILD_TYPE:STRING=@cfg@") endif() diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in index bb6346b..589bd44 100644 --- a/Tests/CTestTest/test.cmake.in +++ b/Tests/CTestTest/test.cmake.in @@ -62,7 +62,7 @@ COVERAGE_COMMAND:FILEPATH=@COVERAGE_COMMAND@ set (CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@/Tests/CTestTest") -# set any extra envionment varibles here +# set any extra environment varibles here set (CTEST_ENVIRONMENT ) diff --git a/Tests/CTestTestTimeout/timeout.cmake b/Tests/CTestTestTimeout/timeout.cmake index 0989b65..ba2f58b 100644 --- a/Tests/CTestTestTimeout/timeout.cmake +++ b/Tests/CTestTestTimeout/timeout.cmake @@ -1,6 +1,6 @@ # Remove the log file. file(REMOVE ${Log}) -# Run a child that sleeps longer than the timout of this test. +# Run a child that sleeps longer than the timeout of this test. # Log its output so check.cmake can verify it dies. execute_process(COMMAND ${Sleep} ERROR_FILE ${Log}) diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index a7137e3..f4e1923 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -12,7 +12,7 @@ project (CudaComplex CXX CUDA) #lastly build a cpp executable that uses this last cuda dynamic library #this tests that we can properly handle linking cuda and cpp together -#and also bulding cpp targets that need cuda implicit libraries +#and also building cpp targets that need cuda implicit libraries #verify that we can pass explicit cuda arch flags string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt index 3289e8f..d0bf648 100644 --- a/Tests/CustomCommandByproducts/CMakeLists.txt +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.9) +cmake_policy(SET CMP0058 OLD) project(CustomCommandByproducts C) # Generate a byproduct in a rule that runs in the target consuming it. @@ -81,7 +82,8 @@ add_custom_command(OUTPUT timestamp8.txt # Generate the library file of an imported target as a byproduct # of an external project. -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(cfg /${CMAKE_CFG_INTDIR}) else() set(cfg) @@ -105,7 +107,7 @@ add_dependencies(ExternalLibrary ExternalTarget) # Generate the library file of an imported target as a byproduct # of an external project. The byproduct uses <BINARY_DIR> that is substituted # by the real binary path -if(CMAKE_CONFIGURATION_TYPES) +if(_isMultiConfig) set(cfg /${CMAKE_CFG_INTDIR}) else() set(cfg) diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index eaad3d4..dc621eb 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.7.20090711) +cmake_minimum_required (VERSION 3.9) project(ExportImport C CXX) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") @@ -15,7 +15,8 @@ set_property( PROPERTY SYMBOLIC 1 ) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") else() if(CMAKE_BUILD_TYPE) diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt index 458c88b..4ff75b8 100644 --- a/Tests/ExternalOBJ/CMakeLists.txt +++ b/Tests/ExternalOBJ/CMakeLists.txt @@ -55,7 +55,7 @@ message("${EXTERNAL_OBJECT}") # Build an executable using the external object file. add_executable(ExternalOBJ executable.cxx ${CUSTOM_OBJECT}) # A bug showed up in VS2010 where an object file that was -# part of a custom commad output worked, but ones that were +# part of a custom command output worked, but ones that were # not didn't work. So, repeat the executable using the object # directly and not from the output of the copy. add_executable(ExternalOBJ2 executable.cxx ${EXTERNAL_OBJECT}) diff --git a/Tests/FindDoxygen/CMakeLists.txt b/Tests/FindDoxygen/CMakeLists.txt index daceaa3..69b9eed 100644 --- a/Tests/FindDoxygen/CMakeLists.txt +++ b/Tests/FindDoxygen/CMakeLists.txt @@ -8,6 +8,16 @@ add_test(NAME FindDoxygen.SimpleTest COMMAND --build-options ${build_options} ) +add_test(NAME FindDoxygen.QuotingTest COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindDoxygen/QuotingTest" + "${CMake_BINARY_DIR}/Tests/FindDoxygen/QuotingTest" + --build-target allDocTargets + ${build_generator_args} + --build-options ${build_options} +) + if(CMake_TEST_FindDoxygen_Dot) add_test(NAME FindDoxygen.DotComponentTest COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> diff --git a/Tests/FindDoxygen/QuotingTest/CMakeLists.txt b/Tests/FindDoxygen/QuotingTest/CMakeLists.txt new file mode 100644 index 0000000..26bf090 --- /dev/null +++ b/Tests/FindDoxygen/QuotingTest/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindDoxygen VERSION 1.0 LANGUAGES NONE) + +find_package(Doxygen REQUIRED) + +set(DOXYGEN_PROJECT_BRIEF "String with spaces") +set(DOXYGEN_ALIASES + [[somealias="@some_command param"]] + "anotherAlias=@foobar" +) + +set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES) + +doxygen_add_docs(docsQuoting) +if(NOT EXISTS "${PROJECT_BINARY_DIR}/Doxyfile.docsQuoting") + message(FATAL_ERROR "Missing generated file: Doxyfile.docsQuoting") +endif() + +file(STRINGS "${PROJECT_BINARY_DIR}/Doxyfile.docsQuoting" matches + REGEX [[^PROJECT_BRIEF *= *"String with spaces"]] +) +if(NOT matches) + message(FATAL_ERROR "PROJECT_BRIEF does not match expected contents") +endif() + +file(STRINGS "${PROJECT_BINARY_DIR}/Doxyfile.docsQuoting" matches + REGEX [[^ALIASES *= *somealias="@some_command param" anotherAlias=@foobar]] +) +if(NOT matches) + message(FATAL_ERROR "ALIASES does not match expected contents") +endif() + +add_custom_target(allDocTargets) +add_dependencies(allDocTargets docsQuoting) diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 740e6f5..52623d0 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -123,7 +123,7 @@ else() message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") message("C = ${CMAKE_C_COMPILER_ID}") # hack to make g77 work after CL has been enabled - # as a languge, cmake needs language specific versions + # as a language, cmake needs language specific versions # of these variables.... if(WIN32 AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_CREATE_CONSOLE_EXE ) diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 3996600..d056b43 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1) +cmake_minimum_required (VERSION 3.9) project(FortranModules Fortran) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") @@ -56,7 +56,8 @@ add_executable(test_non_pp_include test_non_pp_include_main.f90) # Build the external project separately using a custom target. # Make sure it uses the same build configuration as this test. -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(External_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") set(External_BUILD_TYPE) else() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index 9bf0303..59e6d59 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -28,7 +28,7 @@ add_custom_target(checktestf2 ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checktestf2.cmake) -# create a custom target that runs FortranOnly1 exectuable and creates +# create a custom target that runs FortranOnly1 executable and creates # a file out.txt that should have hello world in it. add_custom_target(sayhello ALL COMMAND FortranOnly1 > out.txt @@ -38,7 +38,7 @@ add_dependencies(checktestf2 FortranOnly2) add_dependencies(sayhello FortranOnly1) add_dependencies(FortranOnly2 FortranOnly1) -# add a custom target that checkes that out.txt has the correct +# add a custom target that checks that out.txt has the correct # content add_custom_target(checksayhello ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake diff --git a/Tests/JavaExportImport/CMakeLists.txt b/Tests/JavaExportImport/CMakeLists.txt index a075301..c70704a 100644 --- a/Tests/JavaExportImport/CMakeLists.txt +++ b/Tests/JavaExportImport/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.9) project(JavaExportImport) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") @@ -17,7 +17,8 @@ set_property( PROPERTY SYMBOLIC 1 ) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") else() if(CMAKE_BUILD_TYPE) diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt index 3e9ab8a..a3c6fd9 100644 --- a/Tests/MacRuntimePath/CMakeLists.txt +++ b/Tests/MacRuntimePath/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.9) project(MacRuntimePath) if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") @@ -18,7 +18,8 @@ set_property( configure_file(${MacRuntimePath_SOURCE_DIR}/InitialCache.cmake.in ${MacRuntimePath_BINARY_DIR}/InitialCache.cmake @ONLY) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") else() if(CMAKE_BUILD_TYPE) diff --git a/Tests/MissingInstall/CMakeLists.txt b/Tests/MissingInstall/CMakeLists.txt index 91624f7..365b31f 100644 --- a/Tests/MissingInstall/CMakeLists.txt +++ b/Tests/MissingInstall/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.9) project(TestMissingInstall) set(CMAKE_SKIP_INSTALL_RULES ON) @@ -8,11 +8,7 @@ set(CMAKE_SKIP_INSTALL_RULES ON) set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) -if(CMAKE_CONFIGURATION_TYPES) - set(MULTI_CONFIG ON) -else() - set(MULTI_CONFIG OFF) -endif() +get_property(MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) add_executable(mybin mybin.cpp) install(TARGETS mybin RUNTIME DESTINATION bin) diff --git a/Tests/OutDir/CMakeLists.txt b/Tests/OutDir/CMakeLists.txt index 88468c3..823ab08 100644 --- a/Tests/OutDir/CMakeLists.txt +++ b/Tests/OutDir/CMakeLists.txt @@ -1,7 +1,8 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.9) project(OutDir C) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER "${config}" CONFIG) list(APPEND configs "${CONFIG}") diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index a804538..58f4863 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.9) project(PrecompiledHeader C) # Make sure the proper compiler is in use. @@ -7,7 +7,8 @@ if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") endif() # Compute a custom name for the precompiled header. -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(PCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/PCH/${CMAKE_CFG_INTDIR}") foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/PCH/${cfg}) diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index 11fca45..a263061 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -11,7 +11,7 @@ set_source_files_properties(properties.h PROPERTIES TEST1 1) get_source_file_property(RESULT1 properties.h TEST1) # test properties on a headerfile in the source tree -# accessed without an extenion (also yuck) +# accessed without an extension (also yuck) set_source_files_properties(properties2 PROPERTIES TEST2 1) get_source_file_property(RESULT2 properties2 TEST2) diff --git a/Tests/Qt4Deploy/CMakeLists.txt b/Tests/Qt4Deploy/CMakeLists.txt index 646ea9f..c73a38c 100644 --- a/Tests/Qt4Deploy/CMakeLists.txt +++ b/Tests/Qt4Deploy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.9) project(Qt4Deploy) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install) @@ -10,7 +10,8 @@ add_executable(testdeploy MACOSX_BUNDLE testdeploy.cpp) target_link_libraries(testdeploy ${QT_LIBRARIES}) set_target_properties(testdeploy PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") -if(CMAKE_CONFIGURATION_TYPES AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG) # note: installing debug Qt libraries from a Qt installation configured with # -debug-and-release not yet supported (very low priority). install(CODE " @@ -58,7 +59,7 @@ if(QT_QSQLITE_PLUGIN_DEBUG OR QT_QSQLITE_PLUGIN_RELEASE) endif() # custom target to install and test the installation at build time - if(CMAKE_CONFIGURATION_TYPES) + if(_isMultiConfig) set(install_config "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") endif() diff --git a/Tests/QtAutogen/Complex/CMakeLists.txt b/Tests/QtAutogen/Complex/CMakeLists.txt index e9feea0..a18cc04 100644 --- a/Tests/QtAutogen/Complex/CMakeLists.txt +++ b/Tests/QtAutogen/Complex/CMakeLists.txt @@ -36,7 +36,8 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" ) -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig AND NOT CMAKE_GENERATOR STREQUAL Ninja) set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>) endif() diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt index 076de8b..8a89b38 100644 --- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -13,7 +13,7 @@ set(timeformat "%Y%j%H%M%S") set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocPlugin") set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocPlugin") -# Initial buid +# Initial build try_compile(MOC_PLUGIN "${mocPlugBinDir}" "${mocPlugSrcDir}" diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index 966f3b8..bc7c7e2 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -1,6 +1,6 @@ # Autogen build options set(Autogen_BUILD_OPTIONS "-DQT_TEST_VERSION=${QT_TEST_VERSION}") -if(NOT CMAKE_CONFIGURATION_TYPES) +if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>") endif() list(APPEND Autogen_BUILD_OPTIONS diff --git a/Tests/QtAutogen/UicInterface/CMakeLists.txt b/Tests/QtAutogen/UicInterface/CMakeLists.txt index a216aff..e0421a2 100644 --- a/Tests/QtAutogen/UicInterface/CMakeLists.txt +++ b/Tests/QtAutogen/UicInterface/CMakeLists.txt @@ -35,8 +35,8 @@ set_property(TARGET KI18n APPEND PROPERTY # END upstream -get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_GENERATOR_IS_MULTI_CONFIG) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(INC_DIR "include_$<CONFIG>" ) else() set(INC_DIR "include" ) diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index f268de7..27a609d 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -12,7 +12,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Watcom WMake|Borland Makefiles") endif() # we build debug so the say.exe will be found in Debug/say.exe for # Visual Studio generators -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(INTDIR "Debug/") endif() # build AutoExport diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 1bf8fbc..3445beb 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -11,7 +11,7 @@ function(run_BuildDepends CASE) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake index e0a56e6..06955ee 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake +++ b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake @@ -1,6 +1,7 @@ # Always build in a predictable configuration. For multi-config # generators we depend on RunCMakeTest.cmake to do this for us. -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt index f6cc978..e2c280e 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt @@ -12,5 +12,5 @@ will ask the linker to search for these by library name. Call Stack \(most recent call first\): CMP0060-WARN-ON.cmake:[0-9]+ \(include\) - CMakeLists.txt:3 \(include\) + CMakeLists.txt:4 \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0060/CMakeLists.txt b/Tests/RunCMake/CMP0060/CMakeLists.txt index db6b701..291d34d 100644 --- a/Tests/RunCMake/CMP0060/CMakeLists.txt +++ b/Tests/RunCMake/CMP0060/CMakeLists.txt @@ -1,3 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.9) +cmake_policy(VERSION 3.2) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index aa075b0..8eb8568 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,5 +1,8 @@ # See adjacent README.rst for documentation of this test infrastructure. +# Note that the _isMultiConfig variable is set in the parent directory's +# CMakeLists.txt (slightly complex logic to support CMake versions before 3.9) + macro(add_RunCMake_test test) set(TEST_ARGS ${ARGN}) if ("${ARGV1}" STREQUAL "TEST_DIR") @@ -14,6 +17,7 @@ macro(add_RunCMake_test test) endif() add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} @@ -47,6 +51,7 @@ function(add_RunCMake_test_group test types) add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} -DTEST_TYPE=${type} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index 2e2abdf..2165125 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -167,7 +167,7 @@ this step and must contain variable does not need to be set as it is implicitly set to package generator specific prefix. -Optional verification phase is generator specific and is optionaly executed. +Optional verification phase is generator specific and is optionally executed. This phase is executed if '<test_name>/VerifyResult.cmake' script exists. VerifyResult.cmake script also automatically prints out standard output and diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake index 32cc6d1..61ce752 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake @@ -13,7 +13,7 @@ if(NOT RPMBUILD_CAPS_RESULT) endif() # Only verify that suggests tag is present only if that tag is supported. -# If it is not supported the rpm package was corretly generated by ignoring +# If it is not supported the rpm package was correctly generated by ignoring # that tag and that was already checked by expected files test. if(should_contain_suggests_tag_) execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake index 1f76fd0..dcb992d 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake index 1b619c8..4b4b40e 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake index 192776b..2fb0705 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake index cd87403..d3494fd 100644 --- a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake +++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 616e210..94aaca8 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -5,7 +5,7 @@ run_cmake(CMP0070-OLD) run_cmake(CMP0070-WARN) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index 1defde8..d1d5385 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -29,7 +29,7 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS propertie + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 9423ef5..55625a8 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_GEH) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GEH-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake index 38e47f9..a66394b 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -3,7 +3,8 @@ enable_language(C) add_library(empty SHARED empty.c) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) endif() diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index 73014d1..209e769 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_GoogleTest) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake index a9a7f05..3f238f2 100644 --- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -5,7 +5,7 @@ function(run_SymlinkImplicit) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SymlinkImplicit-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.c b/Tests/RunCMake/XcodeProject/DeploymentTarget.c new file mode 100644 index 0000000..51af046 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.c @@ -0,0 +1,26 @@ +#include <Availability.h> +#include <TargetConditionals.h> + +#if TARGET_OS_OSX +#if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 +#error macOS deployment version mismatch +#endif +#elif TARGET_OS_IOS +#if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 +#error iOS deployment version mismatch +#endif +#elif TARGET_OS_WATCH +#if __WATCH_OS_VERSION_MIN_REQUIRED != __WATCHOS_2_0 +#error watchOS deployment version mismatch +#endif +#elif TARGET_OS_TV +#if __TV_OS_VERSION_MIN_REQUIRED != __TVOS_9_0 +#error tvOS deployment version mismatch +#endif +#else +#error unknown OS +#endif + +void foo() +{ +} diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake new file mode 100644 index 0000000..6281352 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.10) +project(DeploymentTarget C) + +# using Xcode 7.1 SDK versions for deployment targets + +if(SDK MATCHES iphone) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_ARCHITECTURES "armv7;x86_64") + set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +elseif(SDK MATCHES watch) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_ARCHITECTURES "armv7k;i386") + set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +elseif(SDK MATCHES appletv) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0") + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +else() + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11") +endif() + +add_library(myFramework STATIC DeploymentTarget.c) +set_target_properties(myFramework PROPERTIES FRAMEWORK TRUE) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 7eb624c..1313cb5 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -216,3 +216,21 @@ endfunction() if(NOT XCODE_VERSION VERSION_LESS 7) XcodeSchemaGeneration() endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + function(deploymeny_target_test SDK) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DSDK=${SDK}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(DeploymentTarget) + run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .) + endfunction() + + foreach(SDK macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator) + deploymeny_target_test(${SDK}) + endforeach() +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index 0b854d8..5d19ee8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.3) enable_language(C) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + if(TEST_IOS) set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_OSX_ARCHITECTURES "armv7") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index fc830b1..d7f3920 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake index b47d3a5..28ab883 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedPrune CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 4b5e7ce..5e7961a 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt b/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt new file mode 100644 index 0000000..0ac68de --- /dev/null +++ b/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt @@ -0,0 +1 @@ +यूनिकोड είναι very здорово! diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index 83589bb..cb40b40 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake_command(MergeOutputVars ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/Mer run_cmake(EncodingMissing) if(TEST_ENCODING_EXE) run_cmake_command(EncodingUTF8 ${CMAKE_COMMAND} -DTEST_ENCODING=UTF8 -DTEST_ENCODING_EXE=${TEST_ENCODING_EXE} -P ${RunCMake_SOURCE_DIR}/Encoding.cmake) + run_cmake_command(EncodingUTF-8 ${CMAKE_COMMAND} -DTEST_ENCODING=UTF-8 -DTEST_ENCODING_EXE=${TEST_ENCODING_EXE} -P ${RunCMake_SOURCE_DIR}/Encoding.cmake) endif() if(EXIT_CODE_EXE) diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 017990f..06a0c67 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -23,6 +23,10 @@ run_cmake(NoSource) run_cmake(NoProperty) run_cmake(NoCache) +# Since we are testing the GENERATOR_IS_MULTI_CONFIG property itself, +# don't rely on RunCMake_GENERATOR_IS_MULTI_CONFIG being set correctly +# and instead explicitly check for a match against those generators we +# expect to be multi-config if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(IsMultiConfig) else() diff --git a/Tests/RunCMake/project/ProjectDescription2-stderr.txt b/Tests/RunCMake/project/ProjectDescription2-stderr.txt index 558e2df..c65a997 100644 --- a/Tests/RunCMake/project/ProjectDescription2-stderr.txt +++ b/Tests/RunCMake/project/ProjectDescription2-stderr.txt @@ -1 +1 @@ - DESCRITPION may be specified at most once. + DESCRIPTION may be specified at most once. diff --git a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake index d1633e4..72056ae 100644 --- a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_TID) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TID-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index f8068b1..a07f687 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.9) project (TestSimpleInstall) set(CMAKE_VERBOSE_MAKEFILE 1) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY @@ -307,7 +307,8 @@ else() INSTALL_NAME_DIR @executable_path/../lib) endif() -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(SI_CONFIG --config $<CONFIGURATION>) else() set(SI_CONFIG) @@ -350,7 +351,7 @@ if(UNIX AND NOT APPLE) # message("output from file command: [${output}]") # list(APPEND CPACK_GENERATOR "TZ") # else() - # message("compress found, but it was a script so dont use it") + # message("compress found, but it was a script so don't use it") # message("output from file command: [${output}]") # endif() # endif() diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 4cf7355..22150ca 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.9) project (TestSimpleInstall) set(CMAKE_VERBOSE_MAKEFILE 1) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY @@ -307,7 +307,8 @@ else() INSTALL_NAME_DIR @executable_path/../lib) endif() -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(SI_CONFIG --config $<CONFIGURATION>) else() set(SI_CONFIG) @@ -350,7 +351,7 @@ if(UNIX AND NOT APPLE) # message("output from file command: [${output}]") # list(APPEND CPACK_GENERATOR "TZ") # else() - # message("compress found, but it was a script so dont use it") + # message("compress found, but it was a script so don't use it") # message("output from file command: [${output}]") # endif() # endif() diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt index 49ff7fe..64a3cd2 100644 --- a/Tests/StagingPrefix/CMakeLists.txt +++ b/Tests/StagingPrefix/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9) project(StagingPrefix) # Wipe out the install tree @@ -17,7 +17,8 @@ set_property( PROPERTY SYMBOLIC 1 ) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) set(NESTED_CONFIG_TYPE -C "${CMAKE_CFG_INTDIR}") else() if(CMAKE_BUILD_TYPE) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 2f8e4fb..184a7be 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -242,7 +242,7 @@ include(CheckCXXSourceCompiles) include(CheckCSourceRuns) include(CheckCXXSourceRuns) -CHECK_C_SOURCE_COMPILES("I dont build" C_BUILD_SHOULD_FAIL) +CHECK_C_SOURCE_COMPILES("I don't build" C_BUILD_SHOULD_FAIL) CHECK_C_SOURCE_COMPILES("int main() {return 0;}" C_BUILD_SHOULD_WORK) CHECK_C_SOURCE_RUNS("int main() {return 1;}" C_RUN_SHOULD_FAIL) CHECK_C_SOURCE_RUNS("int main() {return 0;}" C_RUN_SHOULD_WORK) @@ -252,7 +252,7 @@ TEST_ASSERT(C_BUILD_SHOULD_WORK "CHECK_C_SOURCE_COMPILES() failed") TEST_FAIL(C_RUN_SHOULD_FAIL "CHECK_C_SOURCE_RUNS() succeeded, but should have failed") TEST_ASSERT(C_RUN_SHOULD_WORK "CHECK_C_SOURCE_RUNS() failed") -CHECK_CXX_SOURCE_COMPILES("I dont build" CXX_BUILD_SHOULD_FAIL) +CHECK_CXX_SOURCE_COMPILES("I don't build" CXX_BUILD_SHOULD_FAIL) CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}" CXX_BUILD_SHOULD_WORK) CHECK_CXX_SOURCE_RUNS("int main() {return 2;}" CXX_RUN_SHOULD_FAIL) CHECK_CXX_SOURCE_RUNS("int main() {return 0;}" CXX_RUN_SHOULD_WORK) diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt index 229c315..993d0d6 100644 --- a/Tests/VSGNUFortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.9) project(VSGNUFortran) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") @@ -9,7 +9,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") # because gmake build of fortran will not be in a config # directory, and for easier testing we want the exe and .dll # to be in the same directory. -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER "${config}" config) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config} |