diff options
133 files changed, 977 insertions, 558 deletions
diff --git a/.clang-tidy b/.clang-tidy index dc60714..3ae249f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,7 +32,6 @@ readability-*,\ -readability-inconsistent-declaration-parameter-name,\ -readability-named-parameter,\ -readability-redundant-declaration,\ --readability-simplify-boolean-expr,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' CheckOptions: diff --git a/CompileFlags.cmake b/CompileFlags.cmake index ec9b31b..5d0e144 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -28,13 +28,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "AIX") endif() endif() -if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") - endif() -endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 937a930..cafef8c 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -23,9 +23,9 @@ Finds and loads settings from an external project. ``<PackageName>_FOUND`` will be set to indicate whether the package was found. When the package is found package-specific information is provided through variables and :ref:`Imported Targets` documented by the package itself. The -``QUIET`` option disables messages if the package cannot be found. The -``REQUIRED`` option stops processing with an error message if the package -cannot be found. +``QUIET`` option disables informational messages, including those indicating +that the package cannot be found if it is not ``REQUIRED``. The ``REQUIRED`` +option stops processing with an error message if the package cannot be found. A package-specific list of required components may be listed after the ``COMPONENTS`` option (or after the ``REQUIRED`` option if present). diff --git a/Help/command/set_directory_properties.rst b/Help/command/set_directory_properties.rst index cc71522..f02a8e6 100644 --- a/Help/command/set_directory_properties.rst +++ b/Help/command/set_directory_properties.rst @@ -9,5 +9,7 @@ Set properties of the current directory and subdirectories. Sets properties of the current directory and its subdirectories in key-value pairs. +See also the :command:`set_property(DIRECTORY)` command. + See :ref:`Directory Properties` for the list of properties known to CMake and their individual documentation for the behavior of each property. diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 2d270ec..2624b4b 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -24,17 +24,19 @@ It must be one of the following: Scope is unique and does not accept a name. ``DIRECTORY`` - Scope defaults to the current directory but another - directory (already processed by CMake) may be named by full or - relative path. + Scope defaults to the current directory but another directory + (already processed by CMake) may be named by full or relative path. + See also the :command:`set_directory_properties` command. ``TARGET`` Scope may name zero or more existing targets. + See also the :command:`set_target_properties` command. ``SOURCE`` Scope may name zero or more source files. Note that source file properties are visible only to targets added in the same directory (CMakeLists.txt). + See also the :command:`set_source_files_properties` command. ``INSTALL`` Scope may name zero or more installed file paths. @@ -54,6 +56,7 @@ It must be one of the following: ``TEST`` Scope may name zero or more existing tests. + See also the :command:`set_tests_properties` command. ``CACHE`` Scope must name zero or more cache existing entries. diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst index 8538a1e..91f995c 100644 --- a/Help/command/set_source_files_properties.rst +++ b/Help/command/set_source_files_properties.rst @@ -10,6 +10,10 @@ Source files can have properties that affect how they are built. [prop2 value2 [...]]) Sets properties associated with source files using a key/value paired -list. See :ref:`Source File Properties` for the list of properties known +list. + +See also the :command:`set_property(SOURCE)` command. + +See :ref:`Source File Properties` for the list of properties known to CMake. Source file properties are visible only to targets added in the same directory (CMakeLists.txt). diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst index 55fd635..9bc94ae 100644 --- a/Help/command/set_tests_properties.rst +++ b/Help/command/set_tests_properties.rst @@ -10,5 +10,8 @@ Set a property of the tests. Sets a property for the tests. If the test is not found, CMake will report an error. :manual:`Generator expressions <cmake-generator-expressions(7)>` will be -expanded the same as supported by the test's :command:`add_test` call. See -:ref:`Test Properties` for the list of properties known to CMake. +expanded the same as supported by the test's :command:`add_test` call. + +See also the :command:`set_property(TEST)` command. + +See :ref:`Test Properties` for the list of properties known to CMake. diff --git a/Help/generator/Visual Studio 16 2019.rst b/Help/generator/Visual Studio 16 2019.rst new file mode 100644 index 0000000..6f2bc56 --- /dev/null +++ b/Help/generator/Visual Studio 16 2019.rst @@ -0,0 +1,49 @@ +Visual Studio 16 2019 +--------------------- + +Generates Visual Studio 16 (VS 2019) project files. + +Project Types +^^^^^^^^^^^^^ + +Only Visual C++ and C# projects may be generated. Other types of +projects (JavaScript, Powershell, Python, etc.) are not supported. + +Instance Selection +^^^^^^^^^^^^^^^^^^ + +VS 2019 supports multiple installations on the same machine. +The :variable:`CMAKE_GENERATOR_INSTANCE` variable may be set as a +cache entry containing the absolute path to a Visual Studio instance. +If the value is not specified explicitly by the user or a toolchain file, +CMake queries the Visual Studio Installer to locate VS instances, chooses +one, and sets the variable as a cache entry to hold the value persistently. + +When CMake first chooses an instance, if the ``VS160COMNTOOLS`` environment +variable is set and points to the ``Common7/Tools`` directory within +one of the instances, that instance will be used. Otherwise, if more +than one instance is installed we do not define which one is chosen +by default. + +Platform Selection +^^^^^^^^^^^^^^^^^^ + +The default target platform name (architecture) is that of the host. + +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps +via the :manual:`cmake(1)` ``-A`` option, to specify a target platform +name (architecture). For example: + +* ``cmake -G "Visual Studio 16 2019" -A Win32`` +* ``cmake -G "Visual Studio 16 2019" -A x64`` +* ``cmake -G "Visual Studio 16 2019" -A ARM`` +* ``cmake -G "Visual Studio 16 2019" -A ARM64`` + +Toolset Selection +^^^^^^^^^^^^^^^^^ + +The ``v142`` toolset that comes with Visual Studio 16 2019 is selected by +default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps +via the :manual:`cmake(1)` ``-T`` option, to specify another toolset. + +.. include:: VS_TOOLSET_HOST_ARCH.txt diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 4fc484b..a1328f2 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -978,6 +978,7 @@ are: * Built-in properties matching ``COMPATIBLE_INTERFACE_*`` * ``EXPORT_NAME`` * ``IMPORTED`` +* ``MANUALLY_ADDED_DEPENDENCIES`` * ``NAME`` * Properties matching ``IMPORTED_LIBNAME_*`` * Properties matching ``MAP_IMPORTED_CONFIG_*`` diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 1de10c4..41f7652 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -87,6 +87,7 @@ Visual Studio Generators /generator/Visual Studio 12 2013 /generator/Visual Studio 14 2015 /generator/Visual Studio 15 2017 + /generator/Visual Studio 16 2019 Other Generators ^^^^^^^^^^^^^^^^ diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 940186a..71a8b00 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -28,6 +28,7 @@ These modules are loaded using the :command:`include` command. /module/CheckFortranCompilerFlag /module/CheckFortranFunctionExists /module/CheckFortranSourceCompiles + /module/CheckFortranSourceRuns /module/CheckFunctionExists /module/CheckIPOSupported /module/CheckIncludeFileCXX diff --git a/Help/module/CheckFortranSourceRuns.rst b/Help/module/CheckFortranSourceRuns.rst new file mode 100644 index 0000000..a1bff70 --- /dev/null +++ b/Help/module/CheckFortranSourceRuns.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CheckFortranSourceRuns.cmake diff --git a/Help/release/dev/check-fortran-run.rst b/Help/release/dev/check-fortran-run.rst new file mode 100644 index 0000000..b5f6558 --- /dev/null +++ b/Help/release/dev/check-fortran-run.rst @@ -0,0 +1,6 @@ +check-fortran-run +----------------- + +* A :module:`CheckFortranSourceRuns` module was added to provide a + :command:`check_fortran_source_runs` command to check if a Fortran + source snippet compiles and runs. diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst new file mode 100644 index 0000000..2c99780 --- /dev/null +++ b/Help/release/dev/deprecate-policy-old.rst @@ -0,0 +1,8 @@ +deprecate-policy-old +-------------------- + +* An explicit deprecation diagnostic was added for policies ``CMP0064`` + and ``CMP0065`` (``CMP0063`` and below were already deprecated). + The :manual:`cmake-policies(7)` manual explains that the OLD behaviors + of all policies are deprecated and that projects should port to the + NEW behaviors. diff --git a/Help/release/dev/rel-win7.rst b/Help/release/dev/rel-win7.rst new file mode 100644 index 0000000..f7a745c --- /dev/null +++ b/Help/release/dev/rel-win7.rst @@ -0,0 +1,6 @@ +rel-win7 +-------- + +* Support for running CMake on Windows XP and Windows Vista has been dropped. + The precompiled Windows binaries provided on ``cmake.org`` now require + Windows 7 or higher. diff --git a/Help/release/dev/vs2019.rst b/Help/release/dev/vs2019.rst new file mode 100644 index 0000000..1ffdeec --- /dev/null +++ b/Help/release/dev/vs2019.rst @@ -0,0 +1,13 @@ +vs2019 +------ + +* The :generator:`Visual Studio 16 2019` generator was added. This is + experimental and based on "Visual Studio 2019 Preview 1.1" because this + version of VS has not been released. + + The VS 2019 generator differs from generators for earlier versions + in that it does not provide variants that specify the target platform + in the generator name. Instead :variable:`CMAKE_GENERATOR_PLATFORM` + must be used, e.g. through the ``-A`` command-line option. Furthermore, + the default target platform (architecture) is now based on the *host* + platform. diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst index 4ef43d8..45df37f 100644 --- a/Help/variable/MSVC_VERSION.rst +++ b/Help/variable/MSVC_VERSION.rst @@ -18,6 +18,7 @@ Known version numbers are:: 1800 = VS 12.0 (v120 toolset) 1900 = VS 14.0 (v140 toolset) 1910-1919 = VS 15.0 (v141 toolset) + 1920-1929 = VS 16.0 (v142 toolset) See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` and :variable:`MSVC_TOOLSET_VERSION` variable. diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index 628b541..02744a9 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -22,9 +22,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) if(NOT CMAKE_COMPILER_IS_GNUCXX) include(TestCXXAcceptsFlag) set(CMAKE_TRY_ANSI_CXX_FLAGS "") - if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") - endif() if(CMAKE_SYSTEM_NAME MATCHES "OSF") set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") endif() diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 6f36b03..45532af 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -10,16 +10,10 @@ const char info_sizeof_dptr[] = { }; /* Application Binary Interface. */ -#if defined(__sgi) && defined(_ABIO32) -# define ABI_ID "ELF O32" -#elif defined(__sgi) && defined(_ABIN32) -# define ABI_ID "ELF N32" -#elif defined(__sgi) && defined(_ABI64) -# define ABI_ID "ELF 64" /* Check for (some) ARM ABIs. * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */ -#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) +#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) # define ABI_ID "ELF ARMEABI" #elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__) # define ABI_ID "ELF ARM" diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index f2d43b6..9b2a91f 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -135,9 +135,6 @@ function(compiler_id_detection outvar lang) /* These compilers are either not known or too old to define an identification macro. Try to identify the platform and guess that it is the native compiler. */ -#elif defined(__sgi) -# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\" - #elif defined(__hpux) || defined(__hpua) # define ${CID_PREFIX}COMPILER_ID \"HP\" diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 600d558..dc208c6 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -13,7 +13,6 @@ # BSD/OS BSD/OS # FreeBSD FreeBSD # HP-UX HP-UX -# IRIX IRIX # Linux Linux # GNU/kFreeBSD GNU/kFreeBSD # NetBSD NetBSD diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F index b34c284..f4a5489 100644 --- a/Modules/CMakeFortranCompilerABI.F +++ b/Modules/CMakeFortranCompilerABI.F @@ -33,13 +33,7 @@ #if 0 ! Application Binary Interface #endif -#if defined(__sgi) && defined(_ABIO32) - PRINT *, 'INFO:abi[ELF O32]' -#elif defined(__sgi) && defined(_ABIN32) - PRINT *, 'INFO:abi[ELF N32]' -#elif defined(__sgi) && defined(_ABI64) - PRINT *, 'INFO:abi[ELF 64]' -#elif defined(__ELF__) +#if defined(__ELF__) PRINT *, 'INFO:abi[ELF]' #endif PRINT *, 'ABI Detection' diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index da3d953..5995694 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -105,8 +105,6 @@ # endif #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:compiler[VisualAge]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:compiler[MIPSpro]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:compiler[HP]' #elif defined(NAGFOR) @@ -114,11 +112,7 @@ #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10) #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10) #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD) -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:compiler[]' #endif #if defined(__CRAYXE) || defined(__CRAYXC) @@ -148,8 +142,6 @@ PRINT *, 'INFO:platform[SunOS]' #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:platform[AIX]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:platform[IRIX]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:platform[HP-UX]' #elif defined(__HAIKU__) @@ -178,11 +170,7 @@ PRINT *, 'INFO:platform[ULTRIX]' #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) PRINT *, 'INFO:platform[Xenix]' -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:platform[]' #endif #if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index dd77379..c2b5aa9 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -32,9 +32,6 @@ #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) # define PLATFORM_ID "AIX" -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index b3e83dd..1820407 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -26,7 +26,8 @@ Check if given Fortran source compiles and links into an executable. if anything in the output matches any of the specified regular expressions. By default, the test source file will be given a ``.F`` file extension. The - ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead. + ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead-- + ``.F90`` is a typical choice. The underlying check is performed by the :command:`try_compile` command. The compile and link commands can be influenced by setting any of the following diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake new file mode 100644 index 0000000..58d90d7 --- /dev/null +++ b/Modules/CheckFortranSourceRuns.cmake @@ -0,0 +1,158 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CheckFortranSourceRuns +---------------------- + +Check if given Fortran source compiles and links into an executable and can +subsequently be run. + +.. command:: check_fortran_source_runs + + .. code-block:: cmake + + check_fortran_source_runs(<code> <resultVar> + [SRC_EXT <extension>]) + + Check that the source supplied in ``<code>`` can be compiled as a Fortran source + file, linked as an executable and then run. The ``<code>`` must contain at + least ``program; end program`` statements. If the ``<code>`` could be built and run + successfully, the internal cache variable specified by ``<resultVar>`` will + be set to 1, otherwise it will be set to an value that evaluates to boolean + false (e.g. an empty string or an error message). + + By default, the test source file will be given a ``.F90`` file extension. The + ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead. + + The underlying check is performed by the :command:`try_run` command. The + compile and link commands can be influenced by setting any of the following + variables prior to calling ``check_fortran_source_runs()``: + + ``CMAKE_REQUIRED_FLAGS`` + Additional flags to pass to the compiler. Note that the contents of + :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated + configuration-specific variable are automatically added to the compiler + command before the contents of ``CMAKE_REQUIRED_FLAGS``. + + ``CMAKE_REQUIRED_DEFINITIONS`` + A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form + ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by + ``<resultVar>`` will also be added automatically. + + ``CMAKE_REQUIRED_INCLUDES`` + A :ref:`;-list <CMake Language Lists>` of header search paths to pass to + the compiler. These will be the only header search paths used by + ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES` + directory property will be ignored. + + ``CMAKE_REQUIRED_LINK_OPTIONS`` + A :ref:`;-list <CMake Language Lists>` of options to add to the link + command (see :command:`try_run` for further details). + + ``CMAKE_REQUIRED_LIBRARIES`` + A :ref:`;-list <CMake Language Lists>` of libraries to add to the link + command. These can be the name of system libraries or they can be + :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for + further details). + + ``CMAKE_REQUIRED_QUIET`` + If this variable evaluates to a boolean true value, all status messages + associated with the check will be suppressed. + + The check is only performed once, with the result cached in the variable + named by ``<resultVar>``. Every subsequent CMake run will re-use this cached + value rather than performing the check again, even if the ``<code>`` changes. + In order to force the check to be re-evaluated, the variable named by + ``<resultVar>`` must be manually removed from the cache. + +#]=======================================================================] + +include_guard(GLOBAL) + +macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) + if(NOT DEFINED "${VAR}") + set(_SRC_EXT) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(SRC_EXT)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() + if(NOT _SRC_EXT) + set(_SRC_EXT F90) + endif() + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LINK_OPTIONS) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS + LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS) + endif() + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}" + "${SOURCE}\n") + + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() + try_run(${VAR}_EXITCODE ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_Fortran_SOURCE_COMPILES_ADD_LINK_OPTIONS} + ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} + "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}" + COMPILE_OUTPUT_VARIABLE OUTPUT) + + # if it did not compile make the return value fail code of 1 + if(NOT ${VAR}_COMPILED) + set(${VAR}_EXITCODE 1) + endif() + # if the return value was 0 then it worked + if("${${VAR}_EXITCODE}" EQUAL 0) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + else() + if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + set(${VAR} "${${VAR}_EXITCODE}") + else() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + endif() + + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}_EXITCODE}\n" + "Source file was:\n${SOURCE}\n") + endif() + endif() +endmacro() diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake deleted file mode 100644 index 12b0f37..0000000 --- a/Modules/Platform/IRIX.cmake +++ /dev/null @@ -1,53 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") - set (CMAKE_CXX_FLAGS_INIT "") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") - set (CMAKE_C_FLAGS_INIT "") -endif() -# set flags for gcc support -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUG77) - set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE - "<CMAKE_Fortran_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake deleted file mode 100644 index ee9b96e..0000000 --- a/Modules/Platform/IRIX64.cmake +++ /dev/null @@ -1,73 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -if(NOT CMAKE_COMPILER_IS_GNUCC) - # Set default flags init. - set(CMAKE_C_FLAGS_INIT "") - set(CMAKE_CXX_FLAGS_INIT "") - set(CMAKE_Fortran_FLAGS_INIT "") - set(CMAKE_EXE_LINKER_FLAGS_INIT "") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "") - - # If no -o32, -n32, or -64 flag is given, set a reasonable default. - if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") - else() - # Check if this is a 64-bit CMake. - if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") - exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) - set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL - "Output of file command on ${CMAKE_COMMAND}.") - endif() - - # Set initial flags to match cmake executable. - if(CMAKE_FILE_SELF MATCHES " 64-bit ") - set(CMAKE_C_FLAGS_INIT "-64") - set(CMAKE_CXX_FLAGS_INIT "-64") - set(CMAKE_Fortran_FLAGS_INIT "-64") - set(CMAKE_EXE_LINKER_FLAGS_INIT "-64") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") - endif() - endif() - - # Set remaining defaults. - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -endif() -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 05f56d8..e4b4e53 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -12,7 +12,7 @@ Determine the number of processors/cores and save value in ${var} Sets the variable named ${var} to the number of physical cores available on the machine if the information can be determined. Otherwise it is set to 0. Currently this functionality is implemented -for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and +for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and Windows. This function is guaranteed to return a positive integer (>=1) if it @@ -115,22 +115,6 @@ function(ProcessorCount var) endif() if(NOT count) - # IRIX (systems with hinv): - find_program(ProcessorCount_cmd_hinv hinv - PATHS /sbin) - mark_as_advanced(ProcessorCount_cmd_hinv) - if(ProcessorCount_cmd_hinv) - execute_process(COMMAND ${ProcessorCount_cmd_hinv} - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE hinv_output) - string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}") - set(count "${CMAKE_MATCH_1}") - #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'") - endif() - endif() - - if(NOT count) # AIX (systems with lsconf): find_program(ProcessorCount_cmd_lsconf lsconf PATHS /usr/sbin) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 91c45bc..c87ceba 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -696,10 +696,10 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio14Generator.h cmGlobalVisualStudio14Generator.cxx - cmGlobalVisualStudio15Generator.h - cmGlobalVisualStudio15Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h + cmGlobalVisualStudioVersionedGenerator.h + cmGlobalVisualStudioVersionedGenerator.cxx cmIDEFlagTable.h cmIDEOptions.cxx cmIDEOptions.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4a4f63f..7ae4417 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 13) -set(CMake_VERSION_PATCH 20190114) +set(CMake_VERSION_PATCH 20190115) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index d3de02b..4966d09 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -46,8 +46,7 @@ int main(int argc, char* argv[]) // get the file system path of the url as a cstring // in an encoding suitable for posix apis - if (CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX) == - false) { + if (!CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX)) { DebugError("CFURLGetFileSystemRepresentation failed"); return 1; } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index ee1070f..b43f1c9 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -10,6 +10,7 @@ #include "cmWorkingDirectory.h" #include <cstring> +#include <map> #include <ostream> #include <utility> #include <vector> diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 9f7b236..ff69418 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -13,6 +13,7 @@ #include "cmsys/FStream.hxx" +#include <map> #include <utility> #include <vector> diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 2fcd1a8..1e6b118 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -257,13 +257,8 @@ void cmCPackFreeBSDGenerator::write_manifest_fields( static bool ignore_file(const std::string& filename) { struct stat statbuf; - - if (!((stat(filename.c_str(), &statbuf) >= 0) && - ((statbuf.st_mode & S_IFMT) == S_IFREG))) { - return true; - } - // May be other reasons to return false - return false; + return stat(filename.c_str(), &statbuf) < 0 || + (statbuf.st_mode & S_IFMT) != S_IFREG; } // Write the given list of @p files to the manifest stream @p s, diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index ef0d118..e55ea87 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -6,6 +6,7 @@ #include <sstream> #include <stdio.h> #include <string> +#include <vector> #include "cmCPackGenerator.h" #include "cmCPackLog.h" diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 18412ba..488d237 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -9,6 +9,7 @@ #include <map> #include <string> #include <utility> +#include <vector> cmParseMumpsCoverage::cmParseMumpsCoverage( cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index c4cf046..7737f65 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -7,7 +7,6 @@ #include "cmCTestTestHandler.h" #include "cmsys/Process.h" -#include <algorithm> #include <fcntl.h> #include <iostream> #include <signal.h> @@ -15,6 +14,7 @@ #if !defined(_WIN32) # include <unistd.h> #endif +#include <utility> #define CM_PROCESS_BUF_SIZE 65536 diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx index 6b4fc85..c96f8b3 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.cxx +++ b/Source/LexerParser/cmCommandArgumentLexer.cxx @@ -664,6 +664,8 @@ Modify cmCommandArgumentLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ @@ -2246,3 +2248,5 @@ void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes) BEGIN(ESCAPES); } } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index 5927b9e..79275dd 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l @@ -18,6 +18,8 @@ Modify cmCommandArgumentLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmCommandArgumentParserHelper.h" /* Replace the lexer input function. */ @@ -145,3 +147,5 @@ void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes) BEGIN(ESCAPES); } } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx index 36cac61..ed6eea9 100644 --- a/Source/LexerParser/cmDependsJavaLexer.cxx +++ b/Source/LexerParser/cmDependsJavaLexer.cxx @@ -860,6 +860,8 @@ Modify cmDependsJavaLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include <iostream> #include "cmDependsJavaParserHelper.h" @@ -2811,3 +2813,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) } #define YYTABLES_NAME "yytables" + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l index 01a0fa3..b48d1bd 100644 --- a/Source/LexerParser/cmDependsJavaLexer.in.l +++ b/Source/LexerParser/cmDependsJavaLexer.in.l @@ -18,6 +18,8 @@ Modify cmDependsJavaLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include <iostream> #include "cmDependsJavaParserHelper.h" @@ -173,3 +175,7 @@ null { PRIMITIVE; return jp_NULLLITERAL; } } %% + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index cb24687..fd0f745 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -664,6 +664,8 @@ Modify cmExprLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmExprParserHelper.h" /* Replace the lexer input function. */ @@ -2223,3 +2225,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) } #define YYTABLES_NAME "yytables" + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 2197c2a..89d1381 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -18,6 +18,8 @@ Modify cmExprLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #include "cmExprParserHelper.h" /* Replace the lexer input function. */ @@ -61,3 +63,7 @@ Modify cmExprLexer.cxx: . { yyextra->UnexpectedChar(yytext[0]); } %% + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index 82048df..f12df29 100644 --- a/Source/LexerParser/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx @@ -838,6 +838,8 @@ Modify cmFortranLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #undef YY_NO_UNPUT #define cmFortranLexer_cxx @@ -2610,3 +2612,5 @@ YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index b7e837b..f752f37 100644 --- a/Source/LexerParser/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l @@ -27,6 +27,8 @@ Modify cmFortranLexer.cxx: /* IWYU pragma: no_forward_declare yyguts_t */ +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + #undef YY_NO_UNPUT #define cmFortranLexer_cxx @@ -183,3 +185,5 @@ YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return YY_CURRENT_BUFFER; } + +#endif /* __clang_analyzer__ */ diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 1f9f580..106e7a7 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -5,6 +5,7 @@ #include "cmsys/Directory.hxx" #include <algorithm> #include <stddef.h> +#include <utility> #include "cmAlgorithms.h" #include "cmMakefile.h" diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 8822942..54f08bb 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -10,7 +10,7 @@ #if defined(_WIN32) # include "cmAlgorithms.h" # include "cmGlobalGenerator.h" -# include "cmGlobalVisualStudio15Generator.h" +# include "cmGlobalVisualStudioVersionedGenerator.h" # include "cmSystemTools.h" # include "cmVSSetupHelper.h" # define HAVE_VS_SETUP_HELPER @@ -133,15 +133,31 @@ bool cmCMakeHostSystemInformationCommand::GetValue( // If generating for the VS 15 IDE, use the same instance. cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 15 ")) { - cmGlobalVisualStudio15Generator* vs15gen = - static_cast<cmGlobalVisualStudio15Generator*>(gg); + cmGlobalVisualStudioVersionedGenerator* vs15gen = + static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg); if (vs15gen->GetVSInstance(value)) { return true; } } // Otherwise, find a VS 15 instance ourselves. - cmVSSetupAPIHelper vsSetupAPIHelper; + cmVSSetupAPIHelper vsSetupAPIHelper(15); + if (vsSetupAPIHelper.GetVSInstanceInfo(value)) { + cmSystemTools::ConvertToUnixSlashes(value); + } + } else if (key == "VS_16_DIR") { + // If generating for the VS 16 IDE, use the same instance. + cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); + if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 16 ")) { + cmGlobalVisualStudioVersionedGenerator* vs16gen = + static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg); + if (vs16gen->GetVSInstance(value)) { + return true; + } + } + + // Otherwise, find a VS 16 instance ourselves. + cmVSSetupAPIHelper vsSetupAPIHelper(16); if (vsSetupAPIHelper.GetVSInstanceInfo(value)) { cmSystemTools::ConvertToUnixSlashes(value); } diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 27b8599..29483f9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -30,7 +30,7 @@ Notes about linking on various platforms: ------------------------------------------------------------------------------ -Linux, FreeBSD, macOS, IRIX, Sun, Windows: +Linux, FreeBSD, macOS, Sun, Windows: Linking to libraries using the full path works fine. diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 2dfba04..fafb079 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDocumentation.h" -#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmDocumentationSection.h" #include "cmRST.h" @@ -55,11 +54,6 @@ cmDocumentation::cmDocumentation() this->ShowGenerators = true; } -cmDocumentation::~cmDocumentation() -{ - cmDeleteAll(this->AllSections); -} - bool cmDocumentation::PrintVersion(std::ostream& os) { /* clang-format off */ @@ -174,20 +168,16 @@ void cmDocumentation::WarnFormFromFilename( void cmDocumentation::addCommonStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Options", "OPTIONS"); - sec->Append(cmDocumentationStandardOptions); - this->AllSections["Options"] = sec; + cmDocumentationSection sec{ "Options" }; + sec.Append(cmDocumentationStandardOptions); + this->AllSections.emplace("Options", std::move(sec)); } void cmDocumentation::addCMakeStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Generators", "GENERATORS"); - sec->Append(cmDocumentationGeneratorsHeader); - this->AllSections["Generators"] = sec; + cmDocumentationSection sec{ "Generators" }; + sec.Append(cmDocumentationGeneratorsHeader); + this->AllSections.emplace("Generators", std::move(sec)); } void cmDocumentation::addCTestStandardDocSections() @@ -199,11 +189,7 @@ void cmDocumentation::addCTestStandardDocSections() void cmDocumentation::addCPackStandardDocSections() { - cmDocumentationSection* sec; - - sec = new cmDocumentationSection("Generators", "GENERATORS"); - sec->Append(cmDocumentationGeneratorsHeader); - this->AllSections["Generators"] = sec; + addCMakeStandardDocSections(); } bool cmDocumentation::CheckOptions(int argc, const char* const* argv, @@ -364,91 +350,59 @@ void cmDocumentation::SetName(const std::string& name) } void cmDocumentation::SetSection(const char* name, - cmDocumentationSection* section) + cmDocumentationSection section) { - if (this->AllSections.find(name) != this->AllSections.end()) { - delete this->AllSections[name]; - } - this->AllSections[name] = section; + this->SectionAtName(name) = std::move(section); } void cmDocumentation::SetSection(const char* name, std::vector<cmDocumentationEntry>& docs) { - cmDocumentationSection* sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - sec->Append(docs); - this->SetSection(name, sec); + cmDocumentationSection sec{ name }; + sec.Append(docs); + this->SetSection(name, std::move(sec)); } void cmDocumentation::SetSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - sec->Append(docs); - this->SetSection(name, sec); + cmDocumentationSection sec{ name }; + sec.Append(docs); + this->SetSection(name, std::move(sec)); } void cmDocumentation::SetSections( - std::map<std::string, cmDocumentationSection*>& sections) + std::map<std::string, cmDocumentationSection> sections) { - for (auto const& s : sections) { - this->SetSection(s.first.c_str(), s.second); + for (auto& s : sections) { + this->SetSection(s.first.c_str(), std::move(s.second)); } } +cmDocumentationSection& cmDocumentation::SectionAtName(const char* name) +{ + return this->AllSections.emplace(name, cmDocumentationSection{ name }) + .first->second; +} void cmDocumentation::PrependSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Prepend(docs); + this->SectionAtName(name).Prepend(docs); } void cmDocumentation::PrependSection(const char* name, std::vector<cmDocumentationEntry>& docs) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Prepend(docs); + this->SectionAtName(name).Prepend(docs); } void cmDocumentation::AppendSection(const char* name, const char* docs[][2]) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Append(docs); + this->SectionAtName(name).Append(docs); } void cmDocumentation::AppendSection(const char* name, std::vector<cmDocumentationEntry>& docs) { - cmDocumentationSection* sec = nullptr; - if (this->AllSections.find(name) == this->AllSections.end()) { - sec = - new cmDocumentationSection(name, cmSystemTools::UpperCase(name).c_str()); - this->SetSection(name, sec); - } else { - sec = this->AllSections[name]; - } - sec->Append(docs); + this->SectionAtName(name).Append(docs); } void cmDocumentation::AppendSection(const char* name, @@ -631,11 +585,10 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os) bool cmDocumentation::PrintHelpListGenerators(std::ostream& os) { - std::map<std::string, cmDocumentationSection*>::iterator si; - si = this->AllSections.find("Generators"); + const auto si = this->AllSections.find("Generators"); if (si != this->AllSections.end()) { this->Formatter.SetIndent(" "); - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } return true; } @@ -661,29 +614,27 @@ bool cmDocumentation::PrintHelpListVariables(std::ostream& os) bool cmDocumentation::PrintUsage(std::ostream& os) { - std::map<std::string, cmDocumentationSection*>::iterator si; - si = this->AllSections.find("Usage"); + const auto si = this->AllSections.find("Usage"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } return true; } bool cmDocumentation::PrintHelp(std::ostream& os) { - std::map<std::string, cmDocumentationSection*>::iterator si; - si = this->AllSections.find("Usage"); + auto si = this->AllSections.find("Usage"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } si = this->AllSections.find("Options"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } if (this->ShowGenerators) { si = this->AllSections.find("Generators"); if (si != this->AllSections.end()) { - this->Formatter.PrintSection(os, *si->second); + this->Formatter.PrintSection(os, si->second); } } return true; diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 153bad6..b2ff01a 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -6,13 +6,13 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmDocumentationFormatter.h" +#include "cmDocumentationSection.h" #include <iosfwd> #include <map> #include <string> #include <vector> -class cmDocumentationSection; struct cmDocumentationEntry; /** Class to generate documentation. */ @@ -21,8 +21,6 @@ class cmDocumentation : public cmDocumentationEnums public: cmDocumentation(); - ~cmDocumentation(); - /** * Check command line arguments for documentation options. Returns * true if documentation options are found, and false otherwise. @@ -52,11 +50,11 @@ public: /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ - void SetSection(const char* sectionName, cmDocumentationSection* section); + void SetSection(const char* sectionName, cmDocumentationSection section); void SetSection(const char* sectionName, std::vector<cmDocumentationEntry>& docs); void SetSection(const char* sectionName, const char* docs[][2]); - void SetSections(std::map<std::string, cmDocumentationSection*>& sections); + void SetSections(std::map<std::string, cmDocumentationSection> sections); /** Add the documentation to the beginning/end of the section */ void PrependSection(const char* sectionName, const char* docs[][2]); @@ -110,7 +108,8 @@ private: bool ShowGenerators; std::string NameString; - std::map<std::string, cmDocumentationSection*> AllSections; + std::map<std::string, cmDocumentationSection> AllSections; + cmDocumentationSection& SectionAtName(const char* name); std::string CurrentArgument; diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index d9e8187..7031b52 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -19,7 +19,7 @@ class cmDocumentationSection { public: /** Create a cmSection, with a special name for man-output mode. */ - cmDocumentationSection(const char* name, const char*) + explicit cmDocumentationSection(const char* name) : Name(name) { } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 93115b6..3821144 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmAlgorithms.h" #include "cmExportSet.h" +#include "cmExportSetMap.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" @@ -21,8 +22,6 @@ #include <sstream> #include <utility> -class cmExportSetMap; - cmExportInstallFileGenerator::cmExportInstallFileGenerator( cmInstallExportGenerator* iegen) : IEGen(iegen) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index e7f3ada..84fcb95 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -5,6 +5,7 @@ #include "cmsys/RegularExpression.hxx" #include <algorithm> #include <assert.h> +#include <map> #include <sstream> #include <stdio.h> #include <utility> diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx index 799a047..5590bc2 100644 --- a/Source/cmFileAPICMakeFiles.cxx +++ b/Source/cmFileAPICMakeFiles.cxx @@ -12,6 +12,7 @@ #include "cm_jsoncpp_value.h" #include <string> +#include <vector> namespace { diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx index 074994a..f96bc90 100644 --- a/Source/cmFileAPICache.cxx +++ b/Source/cmFileAPICache.cxx @@ -10,6 +10,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> namespace { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index fc9c1d2..475eee4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -17,6 +17,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <utility> #include <vector> #include "cmAlgorithms.h" diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 5a5d036..bcf876d 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -7,6 +7,7 @@ #include <set> #include <stdio.h> #include <string.h> +#include <utility> #include "cmGlobalGenerator.h" #include "cmMakefile.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 56eb2bf..5d6f301 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -55,7 +55,7 @@ void cmGeneratorExpressionDAGChecker::Initialize() if (CheckResult == DAG && (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(clang-tidy) + TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*) #undef TEST_TRANSITIVE_PROPERTY_METHOD { std::map<cmGeneratorTarget const*, std::set<std::string>>::const_iterator diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index eb3df16..627e66d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1257,7 +1257,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode #define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME( - TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(clang-tidy) + TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(*) reportError( context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:...> expression in link libraries " diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index db72353..ceee500 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -7,6 +7,7 @@ #include <sstream> #include <utility> +#include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" @@ -494,6 +495,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( const std::string& targetName, const std::string& /*config*/, bool fast, int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions) { + std::unique_ptr<cmMakefile> mfu; cmMakefile* mf; if (!this->Makefiles.empty()) { mf = this->Makefiles[0]; @@ -504,7 +506,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( snapshot.GetDirectory().SetCurrentBinary( this->CMakeInstance->GetHomeOutputDirectory()); snapshot.SetDefaultDefinitions(); - mf = new cmMakefile(this, snapshot); + mfu = cm::make_unique<cmMakefile>(this, snapshot); + mf = mfu.get(); } makeCommand.push_back(this->SelectMakeProgram(makeProgram)); @@ -529,9 +532,6 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(std::move(tname)); } - if (this->Makefiles.empty()) { - delete mf; - } } void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a6bec4b..2932970 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1032,6 +1032,8 @@ const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const return "14.0"; case cmGlobalVisualStudioGenerator::VS15: return "15.0"; + case cmGlobalVisualStudioGenerator::VS16: + return "16.0"; } return ""; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index dc8de03..57510df 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -86,6 +86,8 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const return "14.0"; case cmGlobalVisualStudioGenerator::VS15: return "15.0"; + case cmGlobalVisualStudioGenerator::VS16: + return "16.0"; } return ""; } @@ -139,6 +141,15 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 15\n"; } break; + case cmGlobalVisualStudioGenerator::VS16: + // Visual Studio 16 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 16 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 16\n"; + } + break; } } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index d44f5a5..039191c 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -38,7 +38,8 @@ public: VS12 = 120, /* VS13 = 130 was skipped */ VS14 = 140, - VS15 = 150 + VS15 = 150, + VS16 = 160 }; virtual ~cmGlobalVisualStudioGenerator(); diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index eb49e87..f06c019 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -1,6 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmGlobalVisualStudio15Generator.h" +#include "cmGlobalVisualStudioVersionedGenerator.h" #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" @@ -8,6 +8,61 @@ #include "cmMakefile.h" #include "cmVSSetupHelper.h" +#if defined(_M_ARM64) +# define HOST_PLATFORM_NAME "ARM64"; +#elif defined(_M_ARM) +# define HOST_PLATFORM_NAME "ARM"; +#elif defined(_M_IA64) +# define HOST_PLATFORM_NAME "Itanium"; +#else +# include "cmsys/SystemInformation.hxx" +#endif + +static unsigned int VSVersionToMajor( + cmGlobalVisualStudioGenerator::VSVersion v) +{ + switch (v) { + case cmGlobalVisualStudioGenerator::VS9: + return 9; + case cmGlobalVisualStudioGenerator::VS10: + return 10; + case cmGlobalVisualStudioGenerator::VS11: + return 11; + case cmGlobalVisualStudioGenerator::VS12: + return 12; + case cmGlobalVisualStudioGenerator::VS14: + return 14; + case cmGlobalVisualStudioGenerator::VS15: + return 15; + case cmGlobalVisualStudioGenerator::VS16: + return 16; + } + return 0; +} + +static const char* VSVersionToToolset( + cmGlobalVisualStudioGenerator::VSVersion v) +{ + switch (v) { + case cmGlobalVisualStudioGenerator::VS9: + return "v90"; + case cmGlobalVisualStudioGenerator::VS10: + return "v100"; + case cmGlobalVisualStudioGenerator::VS11: + return "v110"; + case cmGlobalVisualStudioGenerator::VS12: + return "v120"; + case cmGlobalVisualStudioGenerator::VS14: + return "v140"; + case cmGlobalVisualStudioGenerator::VS15: + return "v141"; + case cmGlobalVisualStudioGenerator::VS16: + // FIXME: VS 2019 Preview 1.1 uses v141 but preview 2 will use v142. + return "v141"; + } + return ""; +} + static const char vs15generatorName[] = "Visual Studio 15 2017"; // Map generator name without year to name with year. @@ -25,7 +80,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName) return p; } -class cmGlobalVisualStudio15Generator::Factory +class cmGlobalVisualStudioVersionedGenerator::Factory15 : public cmGlobalGeneratorFactory { public: @@ -38,16 +93,19 @@ public: return 0; } if (!*p) { - return new cmGlobalVisualStudio15Generator(cm, genName, ""); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, ""); } if (*p++ != ' ') { return 0; } if (strcmp(p, "Win64") == 0) { - return new cmGlobalVisualStudio15Generator(cm, genName, "x64"); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, "x64"); } if (strcmp(p, "ARM") == 0) { - return new cmGlobalVisualStudio15Generator(cm, genName, "ARM"); + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS15, cm, genName, "ARM"); } return 0; } @@ -70,35 +128,122 @@ public: bool SupportsPlatform() const override { return true; } }; -cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() +cmGlobalGeneratorFactory* +cmGlobalVisualStudioVersionedGenerator::NewFactory15() +{ + return new Factory15; +} + +static const char vs16generatorName[] = "Visual Studio 16 2019"; + +// Map generator name without year to name with year. +static const char* cmVS16GenName(const std::string& name, std::string& genName) +{ + if (strncmp(name.c_str(), vs16generatorName, + sizeof(vs16generatorName) - 6) != 0) { + return 0; + } + const char* p = name.c_str() + sizeof(vs16generatorName) - 6; + if (cmHasLiteralPrefix(p, " 2019")) { + p += 5; + } + genName = std::string(vs16generatorName) + p; + return p; +} + +class cmGlobalVisualStudioVersionedGenerator::Factory16 + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const + { + std::string genName; + const char* p = cmVS16GenName(name, genName); + if (!p) { + return 0; + } + if (!*p) { + return new cmGlobalVisualStudioVersionedGenerator( + cmGlobalVisualStudioGenerator::VS16, cm, genName, ""); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = std::string(vs16generatorName); + entry.Brief = "Generates Visual Studio 2019 project files. " + "Use -A option to specify architecture."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs16generatorName); + } + + bool SupportsToolset() const override { return true; } + bool SupportsPlatform() const override { return true; } +}; + +cmGlobalGeneratorFactory* +cmGlobalVisualStudioVersionedGenerator::NewFactory16() { - return new Factory; + return new Factory16; } -cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( - cmake* cm, const std::string& name, +cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( + VSVersion version, cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) + , vsSetupAPIHelper(VSVersionToMajor(version)) { + this->Version = version; this->ExpressEdition = false; - this->DefaultPlatformToolset = "v141"; - this->DefaultCLFlagTableName = "v141"; - this->DefaultCSharpFlagTableName = "v141"; - this->DefaultLinkFlagTableName = "v141"; - this->Version = VS15; + this->DefaultPlatformToolset = VSVersionToToolset(this->Version); + this->DefaultCLFlagTableName = VSVersionToToolset(this->Version); + this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version); + this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); + if (this->Version >= cmGlobalVisualStudioGenerator::VS16) { +#ifdef HOST_PLATFORM_NAME + this->DefaultPlatformName = HOST_PLATFORM_NAME; +#else + cmsys::SystemInformation info; + if (info.Is64Bits()) { + this->DefaultPlatformName = "x64"; + } else { + this->DefaultPlatformName = "Win32"; + } +#endif + } } -bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( +bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( const std::string& name) const { std::string genName; - if (cmVS15GenName(name, genName)) { - return genName == this->GetName(); + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VS14: + break; + case cmGlobalVisualStudioGenerator::VS15: + if (cmVS15GenName(name, genName)) { + return genName == this->GetName(); + } + break; + case cmGlobalVisualStudioGenerator::VS16: + if (cmVS16GenName(name, genName)) { + return genName == this->GetName(); + } + break; } return false; } -bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( +bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( std::string const& i, cmMakefile* mf) { if (!i.empty()) { @@ -140,12 +285,13 @@ bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( return true; } -bool cmGlobalVisualStudio15Generator::GetVSInstance(std::string& dir) const +bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance( + std::string& dir) const { return vsSetupAPIHelper.GetVSInstanceInfo(dir); } -bool cmGlobalVisualStudio15Generator::IsDefaultToolset( +bool cmGlobalVisualStudioVersionedGenerator::IsDefaultToolset( const std::string& version) const { if (version.empty()) { @@ -166,7 +312,7 @@ bool cmGlobalVisualStudio15Generator::IsDefaultToolset( return false; } -std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const +std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const { const char* version = this->GetPlatformToolsetVersion(); if (version) { @@ -185,7 +331,7 @@ std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const return {}; } -bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf) +bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) { // If the Win 8.1 SDK is installed then we can select a SDK matching // the target Windows version. @@ -197,13 +343,13 @@ bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf) return this->SelectWindows10SDK(mf, false); } -bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( +bool cmGlobalVisualStudioVersionedGenerator::SelectWindowsStoreToolset( std::string& toolset) const { if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { if (this->IsWindowsStoreToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { - toolset = "v141"; // VS 15 uses v141 toolset + toolset = VSVersionToToolset(this->Version); return true; } else { return false; @@ -213,17 +359,19 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( toolset); } -bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWindowsDesktopToolsetInstalled() + const { - return vsSetupAPIHelper.IsVS2017Installed(); + return vsSetupAPIHelper.IsVSInstalled(); } -bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWindowsStoreToolsetInstalled() + const { return vsSetupAPIHelper.IsWin10SDKInstalled(); } -bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const +bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const { // Does the VS installer tool know about one? if (vsSetupAPIHelper.IsWin81SDKInstalled()) { @@ -245,18 +393,23 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const return false; } -std::string cmGlobalVisualStudio15Generator::GetWindows10SDKMaxVersion() const +std::string cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersion() + const { return std::string(); } -std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() +std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() { std::string msbuild; // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; @@ -267,7 +420,7 @@ std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() return msbuild; } -std::string cmGlobalVisualStudio15Generator::FindDevEnvCommand() +std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand() { std::string devenv; diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index da85d23..466816b 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmGlobalVisualStudio15Generator_h -#define cmGlobalVisualStudio15Generator_h +#ifndef cmGlobalVisualStudioVersionedGenerator_h +#define cmGlobalVisualStudioVersionedGenerator_h #include "cmConfigure.h" // IWYU pragma: keep @@ -14,11 +14,13 @@ class cmGlobalGeneratorFactory; class cmake; -/** \class cmGlobalVisualStudio15Generator */ -class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator +/** \class cmGlobalVisualStudioVersionedGenerator */ +class cmGlobalVisualStudioVersionedGenerator + : public cmGlobalVisualStudio14Generator { public: - static cmGlobalGeneratorFactory* NewFactory(); + static cmGlobalGeneratorFactory* NewFactory15(); + static cmGlobalGeneratorFactory* NewFactory16(); bool MatchesGeneratorName(const std::string& name) const override; @@ -30,8 +32,9 @@ public: std::string GetAuxiliaryToolset() const override; protected: - cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, - std::string const& platformInGeneratorName); + cmGlobalVisualStudioVersionedGenerator( + VSVersion version, cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -53,8 +56,10 @@ protected: std::string FindDevEnvCommand() override; private: - class Factory; - friend class Factory; + class Factory15; + friend class Factory15; + class Factory16; + friend class Factory16; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index caec67d..549a263 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -4,6 +4,7 @@ #include <algorithm> #include <set> +#include <utility> #include "cmGeneratorExpression.h" #include "cmMakefile.h" diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index d441e41..4cc081c 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -3,6 +3,7 @@ #include "cmInstallExportGenerator.h" #include <algorithm> +#include <map> #include <sstream> #include <utility> diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 0da6f4f..bb56714 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -14,6 +14,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" +#include "cmPropertyMap.h" #include "cmSourceFile.h" #include "cmState.h" #include "cmStateDirectory.h" diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 9b63d24..3644da1 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include <stdexcept> #include <stdio.h> #include <stdlib.h> // required for atoi +#include <utility> #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 7294c1c..7368812 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -52,10 +52,7 @@ bool peek(cmsys::ifstream& fin, T& v) template <typename T> bool read(cmsys::ifstream& fin, T& v) { - if (!fin.read(reinterpret_cast<char*>(&v), sizeof(T))) { - return false; - } - return true; + return !!fin.read(reinterpret_cast<char*>(&v), sizeof(T)); } // read from the file and fill multiple data structures where @@ -67,10 +64,7 @@ bool read(cmsys::ifstream& fin, std::vector<T>& v) if (v.empty()) { return true; } - if (!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size())) { - return false; - } - return true; + return !!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size()); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 68a5101..891ca61 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4232,7 +4232,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0063) { + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0065 && + !(this->GetCMakeInstance()->GetIsInTryCompile() && + ( + // Policies set by cmCoreTryCompile::TryCompileCode. + id == cmPolicies::CMP0065))) { this->IssueMessage(cmake::DEPRECATION_WARNING, cmPolicies::GetPolicyDeprecatedWarning(id)); } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 846b12c..92eeb2e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -6,6 +6,7 @@ #include <memory> // IWYU pragma: keep #include <sstream> #include <string> +#include <utility> #include <vector> #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2d2915c..0c2d7b3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -6,6 +6,7 @@ #include <memory> // IWYU pragma: keep #include <sstream> #include <stddef.h> +#include <utility> #include <vector> #include "cmGeneratedFileStream.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 324afbf..b62da66 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -9,6 +9,7 @@ #include <memory> // IWYU pragma: keep #include <set> #include <sstream> +#include <utility> #include "cmAlgorithms.h" #include "cmCustomCommandGenerator.h" diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 228c9fb..1ef12d0 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -10,6 +10,7 @@ #include <map> #include <memory> // IWYU pragma: keep #include <sstream> +#include <utility> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx index 3dab2f0..999d6f3 100644 --- a/Source/cmPipeConnection.cxx +++ b/Source/cmPipeConnection.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPipeConnection.h" -#include <algorithm> +#include <utility> #include "cmServer.h" diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 000529d..2786646 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -9,6 +9,7 @@ #include <algorithm> #include <iterator> #include <sstream> +#include <utility> // - Static variables diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 678ff14..f4cf3e0 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -13,6 +13,7 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmake.h" #include <memory> #include <utility> @@ -86,10 +87,43 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); bool const validQt = (qtVersion.Major == 4) || (qtVersion.Major == 5) || (qtVersion.Major == 6); - bool const mocIsValid = moc && (validQt || !mocExec.empty()); - bool const uicIsValid = uic && (validQt || !uicExec.empty()); - bool const rccIsValid = rcc && (validQt || !rccExec.empty()); + bool const mocAvailable = (validQt || !mocExec.empty()); + bool const uicAvailable = (validQt || !uicExec.empty()); + bool const rccAvailable = (validQt || !rccExec.empty()); + bool const mocIsValid = (moc && mocAvailable); + bool const uicIsValid = (uic && uicAvailable); + bool const rccIsValid = (rcc && uicAvailable); + // Disabled AUTOMOC/UIC/RCC warning + bool const mocDisabled = (moc && !mocAvailable); + bool const uicDisabled = (uic && !uicAvailable); + bool const rccDisabled = (rcc && !rccAvailable); + if (mocDisabled || uicDisabled || rccDisabled) { + std::string msg = "AUTOGEN: No valid Qt version found for target "; + msg += target->GetName(); + msg += ". "; + { + std::vector<std::string> lst; + if (mocDisabled) { + lst.emplace_back("AUTOMOC"); + } + if (uicDisabled) { + lst.emplace_back("AUTOUIC"); + } + if (rccDisabled) { + lst.emplace_back("AUTORCC"); + } + msg += cmJoin(lst, ", "); + } + msg += " disabled. Consider adding:\n"; + if (uicDisabled) { + msg += " find_package(Qt5 COMPONENTS Widgets)\n"; + } else { + msg += " find_package(Qt5 COMPONENTS Core)\n"; + } + msg += "to your CMakeLists.txt file."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + } if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e4d2c82..5ac080a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1231,11 +1231,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } // Write AUTORCC info files - if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) { - return false; - } - - return true; + return !this->Rcc.Enabled || this->SetupWriteRccInfo(); } bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 734b2d7..f2f4cad 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -14,6 +14,7 @@ #include "cmake.h" #include <algorithm> +#include <utility> // -- Class methods diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index e6ee85b..9658e97 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1,19 +1,21 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGeneratorMocUic.h" -#include "cmQtAutoGen.h" #include <algorithm> #include <array> +#include <cstddef> #include <functional> #include <list> #include <memory> +#include <set> #include <sstream> #include <utility> #include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmMakefile.h" +#include "cmQtAutoGen.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index edf597c..9ec1def 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -11,7 +11,6 @@ #include "cm_uv.h" #include "cmsys/RegularExpression.hxx" -#include <algorithm> #include <condition_variable> #include <cstddef> #include <deque> @@ -21,6 +20,7 @@ #include <set> #include <string> #include <thread> +#include <utility> #include <vector> class cmMakefile; diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index fe0bdc9..f7d3879 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -417,7 +417,7 @@ static void __start_thread(void* arg) auto server = static_cast<cmServerBase*>(arg); std::string error; bool success = server->Serve(&error); - if (!success || error.empty() == false) { + if (!success || !error.empty()) { std::cerr << "Error during serve: " << error << std::endl; } } diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index 1fc8cf8..5caa019 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -7,13 +7,13 @@ #include "cmServerDictionary.h" #include "cm_uv.h" -#include <algorithm> #ifdef _WIN32 # include "io.h" #else # include <unistd.h> #endif #include <cassert> +#include <utility> cmStdIoConnection::cmStdIoConnection( cmConnectionBufferStrategy* bufferStrategy) diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index c3df313..08f4d1a 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -254,16 +254,12 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args, bool cmSourceGroupCommand::checkArgumentsPreconditions( const ParsedArguments& parsedArguments, std::string& errorMsg) const { - if (!checkSingleParameterArgumentPreconditions(kPrefixOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kTreeOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kRegexOptionName, - parsedArguments, errorMsg)) { - return false; - } - - return true; + return checkSingleParameterArgumentPreconditions( + kPrefixOptionName, parsedArguments, errorMsg) && + checkSingleParameterArgumentPreconditions(kTreeOptionName, parsedArguments, + errorMsg) && + checkSingleParameterArgumentPreconditions(kRegexOptionName, + parsedArguments, errorMsg); } bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, @@ -286,12 +282,8 @@ bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, std::set<std::string> sourceGroupPaths = getSourceGroupFilesPaths(root, filesVector); - if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, - *(this->Makefile), errorMsg)) { - return false; - } - - return true; + return addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, + *(this->Makefile), errorMsg); } bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions( diff --git a/Source/cmString.hxx b/Source/cmString.hxx index e5ece52..49bad78 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -15,6 +15,7 @@ #include <ostream> #include <string> #include <type_traits> +#include <utility> namespace cm { diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index 06ce0b1..e1765ff 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -65,6 +65,7 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( builtIns.insert("EXPORT_NAME"); builtIns.insert("IMPORTED"); builtIns.insert("IMPORTED_GLOBAL"); + builtIns.insert("MANUALLY_ADDED_DEPENDENCIES"); builtIns.insert("NAME"); builtIns.insert("TYPE"); } diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index e4ced6e..1e2ddc7 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -11,12 +11,11 @@ #include "cmLocalGenerator.h" #include "cmOutputConverter.h" #include "cmProperty.h" +#include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" -class cmPropertyMap; - cmTestGenerator::cmTestGenerator( cmTest* test, std::vector<std::string> const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index d80b5a2..9187c29 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -57,8 +57,9 @@ std::string VSInstanceInfo::GetInstallLocation() const return loc; } -cmVSSetupAPIHelper::cmVSSetupAPIHelper() - : setupConfig(NULL) +cmVSSetupAPIHelper::cmVSSetupAPIHelper(unsigned int version) + : Version(version) + , setupConfig(NULL) , setupConfig2(NULL) , setupHelper(NULL) , initializationFailure(false) @@ -88,7 +89,7 @@ bool cmVSSetupAPIHelper::SetVSInstance(std::string const& vsInstallLocation) return this->EnumerateAndChooseVSInstance(); } -bool cmVSSetupAPIHelper::IsVS2017Installed() +bool cmVSSetupAPIHelper::IsVSInstalled() { return this->EnumerateAndChooseVSInstance(); } @@ -312,11 +313,11 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return false; std::string envVSCommonToolsDir; + std::string envVSCommonToolsDirEnvName = + "VS" + std::to_string(this->Version) + "0COMNTOOLS"; - // FIXME: When we support VS versions beyond 2017, the version - // to choose will be passed in by the caller. We need to map that - // to a per-version name of this environment variable. - if (cmSystemTools::GetEnv("VS150COMNTOOLS", envVSCommonToolsDir)) { + if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(), + envVSCommonToolsDir)) { cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir); } @@ -328,8 +329,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() return false; } - // FIXME: Add a way for caller to specify other versions. - std::wstring wantVersion = std::to_wstring(15) + L'.'; + std::wstring const wantVersion = std::to_wstring(this->Version) + L'.'; SmartCOMPtr<ISetupInstance> instance; while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) { diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index b9cca45..4748a7a 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -120,12 +120,12 @@ struct VSInstanceInfo class cmVSSetupAPIHelper { public: - cmVSSetupAPIHelper(); + cmVSSetupAPIHelper(unsigned int version); ~cmVSSetupAPIHelper(); bool SetVSInstance(std::string const& vsInstallLocation); - bool IsVS2017Installed(); + bool IsVSInstalled(); bool GetVSInstanceInfo(std::string& vsInstallLocation); bool GetVCToolsetVersion(std::string& vsToolsetVersion); bool IsWin10SDKInstalled(); @@ -140,6 +140,8 @@ private: int ChooseVSInstance(const std::vector<VSInstanceInfo>& vecVSInstances); bool EnumerateAndChooseVSInstance(); + unsigned int Version; + // COM ptrs to query about VS instances SmartCOMPtr<ISetupConfiguration> setupConfig; SmartCOMPtr<ISetupConfiguration2> setupConfig2; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b0e70ff..655d6f0 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -297,6 +297,11 @@ std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString( "$(UserRootDir)\\Microsoft.CSharp.$(Platform).user.props" #define VS10_CSharp_TARGETS "$(MSBuildToolsPath)\\Microsoft.CSharp.targets" +#define VS10_CSharp_NETCF_TARGETS \ + "$(MSBuildExtensionsPath)\\Microsoft\\$(TargetFrameworkIdentifier)\\" \ + "$(TargetFrameworkTargetsVersion)\\Microsoft.$(TargetFrameworkIdentifier)" \ + ".CSharp.targets" + void cmVisualStudio10TargetGenerator::Generate() { // do not generate external ms projects @@ -480,9 +485,31 @@ void cmVisualStudio10TargetGenerator::Generate() targetFrameworkVersion = this->GeneratorTarget->GetProperty( "DOTNET_TARGET_FRAMEWORK_VERSION"); } + if (!targetFrameworkVersion && this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE() && + this->GlobalGenerator->GetVersion() == + cmGlobalVisualStudioGenerator::VS12) { + // VS12 .NETCF default to .NET framework 3.9 + targetFrameworkVersion = "v3.9"; + } if (targetFrameworkVersion) { e1.Element("TargetFrameworkVersion", targetFrameworkVersion); } + if (this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE()) { + const char* targetFrameworkId = this->GeneratorTarget->GetProperty( + "VS_TARGET_FRAMEWORK_IDENTIFIER"); + if (!targetFrameworkId) { + targetFrameworkId = "WindowsEmbeddedCompact"; + } + e1.Element("TargetFrameworkIdentifier", targetFrameworkId); + const char* targetFrameworkVer = this->GeneratorTarget->GetProperty( + "VS_TARGET_FRAMEWORKS_TARGET_VERSION"); + if (!targetFrameworkVer) { + targetFrameworkVer = "v8.0"; + } + e1.Element("TargetFrameworkTargetsVersion", targetFrameworkVer); + } } // Disable the project upgrade prompt that is displayed the first time a @@ -638,7 +665,11 @@ void cmVisualStudio10TargetGenerator::Generate() Elem(e0, "Import").Attribute("Project", VS10_CXX_TARGETS); break; case csproj: - Elem(e0, "Import").Attribute("Project", VS10_CSharp_TARGETS); + if (this->GlobalGenerator->TargetsWindowsCE()) { + Elem(e0, "Import").Attribute("Project", VS10_CSharp_NETCF_TARGETS); + } else { + Elem(e0, "Import").Attribute("Project", VS10_CSharp_TARGETS); + } break; } @@ -1419,6 +1450,14 @@ void cmVisualStudio10TargetGenerator::WriteGroups() groupsUsed.insert(sourceGroup); } + if (cmSourceFile const* srcCMakeLists = + this->LocalGenerator->CreateVCProjBuildRule()) { + std::string const& source = srcCMakeLists->GetFullPath(); + cmSourceGroup* sourceGroup = + this->Makefile->FindSourceGroup(source, sourceGroups); + groupsUsed.insert(sourceGroup); + } + this->AddMissingSourceGroups(groupsUsed, sourceGroups); // Write out group file diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index afe9230..5c3e533 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -70,6 +70,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmGlobalVisualStudioGenerator::VS12: case cmGlobalVisualStudioGenerator::VS14: case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VS16: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e1bae34..dfdcf8a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -55,8 +55,8 @@ # include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" # include "cmGlobalVisualStudio14Generator.h" -# include "cmGlobalVisualStudio15Generator.h" # include "cmGlobalVisualStudio9Generator.h" +# include "cmGlobalVisualStudioVersionedGenerator.h" # include "cmVSSetupHelper.h" # define CMAKE_HAVE_VS_GENERATORS @@ -610,16 +610,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args) } // Parse the args -void cmake::SetArgs(const std::vector<std::string>& args, - bool directoriesSetBefore) +void cmake::SetArgs(const std::vector<std::string>& args) { - bool directoriesSet = directoriesSetBefore; bool haveToolset = false; bool havePlatform = false; for (unsigned int i = 1; i < args.size(); ++i) { std::string const& arg = args[i]; if (arg.find("-H", 0) == 0 || arg.find("-S", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -640,7 +637,6 @@ void cmake::SetArgs(const std::vector<std::string>& args, } else if (arg.find("-O", 0) == 0) { // There is no local generate anymore. Ignore -O option. } else if (arg.find("-B", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -802,16 +798,27 @@ void cmake::SetArgs(const std::vector<std::string>& args, this->SetGlobalGenerator(gen); } } - // no option assume it is the path to the source + // no option assume it is the path to the source or an existing build else { - directoriesSet = true; this->SetDirectoriesFromFile(arg.c_str()); } } - if (!directoriesSet) { - this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + + const bool haveSourceDir = !this->GetHomeDirectory().empty(); + const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty(); + + if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && + !haveBinaryDir) { + cmSystemTools::Error("No source or binary directory provided"); + return; + } + + if (!haveSourceDir) { this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); } + if (!haveBinaryDir) { + this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + } } void cmake::SetDirectoriesFromFile(const char* arg) @@ -1538,8 +1545,9 @@ void cmake::CreateDefaultGlobalGenerator() "\\Setup\\VC;ProductDir", // ";InstallDir" // }; - cmVSSetupAPIHelper vsSetupAPIHelper; - if (vsSetupAPIHelper.IsVS2017Installed()) { + if (cmVSSetupAPIHelper(16).IsVSInstalled()) { + found = "Visual Studio 16 2019"; + } else if (cmVSSetupAPIHelper(15).IsVSInstalled()) { found = "Visual Studio 15 2017"; } else { for (VSVersionedGenerator const* g = cm::cbegin(vsGenerators); @@ -1793,7 +1801,10 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) - this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudioVersionedGenerator::NewFactory16()); + this->Generators.push_back( + cmGlobalVisualStudioVersionedGenerator::NewFactory15()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); diff --git a/Source/cmake.h b/Source/cmake.h index d00acc7..3c06c56 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -277,8 +277,7 @@ public: int GetSystemInformation(std::vector<std::string>&); ///! Parse command line arguments - void SetArgs(const std::vector<std::string>&, - bool directoriesSetBefore = false); + void SetArgs(const std::vector<std::string>& args); ///! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() const; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 75dabde..e52f2b3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -285,12 +285,12 @@ int do_cmake(int ac, char const* const* av) } else if (cmHasLiteralPrefix(av[i], "-P")) { if (i == ac - 1) { cmSystemTools::Error("No script specified for argument -P"); - } else { - workingMode = cmake::SCRIPT_MODE; - args.push_back(av[i]); - i++; - args.push_back(av[i]); + return 1; } + workingMode = cmake::SCRIPT_MODE; + args.push_back(av[i]); + i++; + args.push_back(av[i]); } else if (cmHasLiteralPrefix(av[i], "--find-package")) { workingMode = cmake::FIND_PACKAGE_MODE; args.push_back(av[i]); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 930ced9..24e3dc8 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -44,6 +44,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <utility> class cmConnection; @@ -270,9 +271,12 @@ static int HandleCppLint(const std::string& runCmd, << "\n"; return 1; } - std::cerr << "Warning: cpplint diagnostics:\n"; - // Output the output from cpplint to stderr - std::cerr << stdOut; + if (!stdOut.empty()) { + std::cerr << "Warning: cpplint diagnostics:\n"; + // Output the output from cpplint to stderr + std::cerr << stdOut; + } + // always return 0 so the build can continue as cpplint returns non-zero // for any warning return 0; diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 094c2ee..f65690b 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1162,7 +1162,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, case KWSYSPE_PIPE_STDERR: wd->PipeId = kwsysProcess_Pipe_STDERR; break; - }; + } return 1; } } else if (n < 0 && errno == EAGAIN) { diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx index ef87436..15f9c02 100644 --- a/Source/kwsys/testCommandLineArguments.cxx +++ b/Source/kwsys/testCommandLineArguments.cxx @@ -165,25 +165,26 @@ int testCommandLineArguments(int argc, char* argv[]) } size_t cc; #define CompareTwoLists(list1, list_valid, lsize) \ - if (list1.size() != lsize) { \ - std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ - << " should be: " << lsize << std::endl; \ - res = 1; \ - } else { \ - std::cout << #list1 " argument set:"; \ - for (cc = 0; cc < lsize; ++cc) { \ - std::cout << " " << list1[cc]; \ - if (!CompareTwoItemsOnList(list1[cc], list_valid[cc])) { \ - std::cerr << "Problem setting " #list1 ". Value of " << cc \ - << " is: [" << list1[cc] << "] <> [" << list_valid[cc] \ - << "]" << std::endl; \ - res = 1; \ - break; \ + do { \ + if (list1.size() != lsize) { \ + std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ + << " should be: " << lsize << std::endl; \ + res = 1; \ + } else { \ + std::cout << #list1 " argument set:"; \ + for (cc = 0; cc < lsize; ++cc) { \ + std::cout << " " << list1[cc]; \ + if (!CompareTwoItemsOnList(list1[cc], list_valid[cc])) { \ + std::cerr << "Problem setting " #list1 ". Value of " << cc \ + << " is: [" << list1[cc] << "] <> [" << list_valid[cc] \ + << "]" << std::endl; \ + res = 1; \ + break; \ + } \ } \ + std::cout << std::endl; \ } \ - std::cout << std::endl; \ - } - + } while (0) CompareTwoLists(numbers_argument, valid_numbers, 10); CompareTwoLists(doubles_argument, valid_doubles, 3); CompareTwoLists(bools_argument, valid_bools, 3); diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx index e165ff7..1c1da76 100644 --- a/Tests/CMakeLib/testUVRAII.cxx +++ b/Tests/CMakeLib/testUVRAII.cxx @@ -1,9 +1,9 @@ #include "cmUVHandlePtr.h" -#include <algorithm> #include <chrono> #include <iostream> #include <thread> +#include <utility> #include "cm_uv.h" diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 803e5f0..6b166d6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -597,7 +597,6 @@ if(BUILD_TESTING) else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 9157c76..f01e616 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -415,78 +415,6 @@ set(hp_f90_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64") list(APPEND platforms hp_f90_64) #----------------------------------------------------------------------------- -# IRIX - -# cc -o32 dummy.c -v -set(irix64_cc_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lc /usr/lib/crtn.o") -set(irix64_cc_o32_libs "c") -set(irix64_cc_o32_dirs "/usr/lib") -list(APPEND platforms irix64_cc_o32) - -# cc -n32 dummy.c -v -set(irix64_cc_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_cc_n32_libs "c") -set(irix64_cc_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_cc_n32) - -# cc -64 dummy.c -v -set(irix64_cc_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_cc_64_libs "c") -set(irix64_cc_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_cc_64) - -# CC -o32 dummy.cxx -v -set(irix64_CC_o32_text "/usr/lib/ld -elf -cxx -woff 134 -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o /usr/lib/c++init.o -count dummy.o -nocount -dont_warn_unused -lC -warn_unused -lc /usr/lib/crtn.o") -set(irix64_CC_o32_libs "C;c") -set(irix64_CC_o32_dirs "/usr/lib") -list(APPEND platforms irix64_CC_o32) - -# CC -n32 dummy.cxx -v -set(irix64_CC_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 -cxx -woff 134 /usr/lib32/mips4/crt1.o /usr/lib32/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_CC_n32_libs "Csup;C;Cio;c") -set(irix64_CC_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_CC_n32) - -# CC -64 dummy.cxx -v -set(irix64_CC_64_text "/usr/lib32/cmplrs/ld64 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 -cxx -woff 134 /usr/lib64/mips4/crt1.o /usr/lib64/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_CC_64_libs "Csup;C;Cio;c") -set(irix64_CC_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_CC_64) - -# f77 -o32 dummy.f -v -set(irix64_f77_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lftn -lm -lc /usr/lib/crtn.o") -set(irix64_f77_o32_libs "ftn;m;c") -set(irix64_f77_o32_dirs "/usr/lib") -list(APPEND platforms irix64_f77_o32) - -# f77 -n32 dummy.f -v -set(irix64_f77_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f77_n32_libs "ftn;m;c") -set(irix64_f77_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f77_n32) - -# f77 -64 dummy.f -v -set(irix64_f77_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f77_64_libs "ftn;m;c") -set(irix64_f77_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f77_64) - -# f90 -o32 dummy.f -v -#f90 ERROR: specified abi -o32 not supported. - -# f90 -n32 dummy.f -v -set(irix64_f90_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f90_n32_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f90_n32) - -# f90 -64 dummy.f -v -set(irix64_f90_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f90_64_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f90_64) - -#----------------------------------------------------------------------------- # Cygwin # gcc dummy.c -v diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 67fcc02..811fff3 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -332,7 +332,6 @@ if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index 59e6d59..77f6041 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -70,8 +70,15 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) include(CheckFortranCompilerFlag) CHECK_Fortran_COMPILER_FLAG(-_this_is_not_a_flag_ Fortran_BOGUS_FLAG) if (Fortran_BOGUS_FLAG) - message (SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed") - endif () + message(SEND_ERROR "CHECK_Fortran_COMPILER_FLAG() succeeded, but should have failed") + endif() + + unset(Fortran_RUN_FLAG CACHE) + include(CheckFortranSourceRuns) + check_fortran_source_runs("program a; end program" Fortran_RUN_FLAG SRC_EXT F90) + if(NOT Fortran_RUN_FLAG) + message(SEND_ERROR "CHECK_Fortran_SOURCE_RUNS() failed") + endif() endif() # Test generation of preprocessed sources. diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 3db210a..6aae09a 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(item_real STATIC item.cpp) add_library(item_iface INTERFACE IMPORTED) set_property(TARGET item_iface PROPERTY IMPORTED_LIBNAME item_real) add_dependencies(item_iface item_real) +get_property(item_iface_dependencies TARGET item_iface PROPERTY MANUALLY_ADDED_DEPENDENCIES) link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(InterfaceLibrary definetestexe.cpp) diff --git a/Tests/RunCMake/Autogen/CMakeLists.txt b/Tests/RunCMake/Autogen/CMakeLists.txt new file mode 100644 index 0000000..9a66cde --- /dev/null +++ b/Tests/RunCMake/Autogen/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.13) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt new file mode 100644 index 0000000..6b4a933 --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTORCC disabled. Consider adding: + + find_package\(Qt5 COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/NoQt.cmake b/Tests/RunCMake/Autogen/NoQt.cmake new file mode 100644 index 0000000..b2d375a --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_executable(main empty.cpp) +set_property(TARGET main PROPERTY AUTOMOC 1) +set_property(TARGET main PROPERTY AUTORCC 1) +set_property(TARGET main PROPERTY AUTOUIC 1) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake new file mode 100644 index 0000000..e52f28d --- /dev/null +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(NoQt) diff --git a/Tests/RunCMake/Autogen/empty.cpp b/Tests/RunCMake/Autogen/empty.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Autogen/empty.cpp diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt new file mode 100644 index 0000000..987a503 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0064-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0064 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5afa242..358521b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -150,6 +150,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) +add_RunCMake_test(Autogen) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) @@ -334,7 +335,7 @@ if (GTK2_FOUND) endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - add_RunCMake_test(include_external_msproject) + add_RunCMake_test(include_external_msproject -DVS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio (9|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) set(NO_USE_FOLDERS 1) endif() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4cd34de..0e04ad1 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -4,17 +4,17 @@ include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) run_cmake_command(Wizard ${CMAKE_COMMAND} -i) -run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) -run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) -run_cmake_command(Cno-file ${CMAKE_COMMAND} -Cnosuchcachefile.txt) +run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C) +run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt) +run_cmake_command(Cno-file ${CMAKE_COMMAND} -B DummyBuildDir -Cnosuchcachefile.txt) run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) -run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) -run_cmake_command(D-no-src ${CMAKE_COMMAND} -D VAR=VALUE) -run_cmake_command(Dno-src ${CMAKE_COMMAND} -DVAR=VALUE) -run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) -run_cmake_command(U-no-src ${CMAKE_COMMAND} -U VAR) -run_cmake_command(Uno-src ${CMAKE_COMMAND} -UVAR) +run_cmake_command(D-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -D) +run_cmake_command(D-no-src ${CMAKE_COMMAND} -B DummyBuildDir -D VAR=VALUE) +run_cmake_command(Dno-src ${CMAKE_COMMAND} -B DummyBuildDir -DVAR=VALUE) +run_cmake_command(U-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -U) +run_cmake_command(U-no-src ${CMAKE_COMMAND} -B DummyBuildDir -U VAR) +run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) @@ -34,8 +34,8 @@ run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compi run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist) run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --) -run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) -run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) +run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) +run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) @@ -61,6 +61,7 @@ function(run_ExplicitDirs) file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") + run_cmake_command(no-S-B ${CMAKE_COMMAND} -DFOO=BAR) run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) @@ -330,9 +331,9 @@ set(RunCMake_TEST_OPTIONS -Wdev -Wno-dev) run_cmake(Wno-dev) unset(RunCMake_TEST_OPTIONS) -run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) -run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) -run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=) +run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -B DummyBuildDir -W) +run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -B DummyBuildDir -Wno-) +run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -B DummyBuildDir -Werror=) set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) diff --git a/Tests/RunCMake/CommandLine/no-S-B-result.txt b/Tests/RunCMake/CommandLine/no-S-B-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/no-S-B-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt new file mode 100644 index 0000000..7a94307 --- /dev/null +++ b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt @@ -0,0 +1 @@ +CMake Error: No source or binary directory provided diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake index 5d0577b..eef350c 100644 --- a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +unset(ENV{Boost_ROOT}) run_cmake(CMakePackage) run_cmake(NoCXX) diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 27250cb..27ede06 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_PLATFORM "") run_cmake(NoPlatform) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[012456])( 20[0-9][0-9])?$") set(RunCMake_GENERATOR_PLATFORM "x64") run_cmake(x64Platform) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -A "Extra Platform") run_cmake(TwoPlatforms) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[012456])( 20[0-9][0-9])?$") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestPlatform-toolchain.cmake) run_cmake(TestPlatformToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index d1738a0..ccf58b4 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=Test Cuda") @@ -12,7 +12,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") run_cmake(TestToolsetCudaOnly) set(RunCMake_GENERATOR_TOOLSET "cuda=Test Cuda") run_cmake(TestToolsetCudaOnly) - if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[245]") + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) set(RunCMake_GENERATOR_TOOLSET ",host=x64") @@ -25,7 +25,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]") run_cmake(BadToolsetHostArch) set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64,host=x64") run_cmake(BadToolsetHostArchTwice) - if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 15") + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[56]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,version=Test Toolset Version") run_cmake(TestToolsetVersionBoth) set(RunCMake_GENERATOR_TOOLSET ",version=Test Toolset Version") @@ -59,7 +59,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode") +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]|Xcode") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index db375ae..c796840 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -1,6 +1,7 @@ include(RunCMake) run_cmake(ExplicitCMakeLists) +run_cmake(SourceGroupCMakeLists) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake new file mode 100644 index 0000000..c2a94bb --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake @@ -0,0 +1,33 @@ +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +set(foundFileFilter 0) +set(foundFilter 0) +file(STRINGS "${vcFiltersFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<Filter>CMakeListsSourceGroup</Filter>") + set(rule "${CMAKE_MATCH_1}") + if(foundFileFilter) + set(RunCMake_TEST_FAILED "Multiple files listed with filter for CMakeListsSourceGroup.") + return() + endif() + set(foundFileFilter 1) + endif() + if(line MATCHES "<Filter.*Include=\"CMakeListsSourceGroup\"") + set(rule "${CMAKE_MATCH_1}") + if(foundFilter) + set(RunCMake_TEST_FAILED "Multiple copies of CMakeListsSourceGroup filter listed.") + return() + endif() + set(foundFilter 1) + endif() +endforeach() +if(NOT foundFileFilter) + set(RunCMake_TEST_FAILED "File filter for CMakeListsSourceGroup not found.") +endif() +if(NOT foundFilter) + set(RunCMake_TEST_FAILED "Filter CMakeListsSourceGroup not found.") +endif() diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists.cmake new file mode 100644 index 0000000..4ad87ec --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists.cmake @@ -0,0 +1,3 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) +add_custom_target(foo) +source_group("CMakeListsSourceGroup" FILES CMakeLists.txt) diff --git a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake index b35ee90..2c9067f 100644 --- a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake @@ -6,3 +6,4 @@ set(RunCMake_GENERATOR_INSTANCE "") set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=WindowsCE ) run_cmake(VsCEDebuggerDeploy) +run_cmake(VSCSharpCFProject) diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake new file mode 100644 index 0000000..618896e --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject-check.cmake @@ -0,0 +1,54 @@ +# +# Check C# Compact Framework project for required elements. +# +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() + +if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" ) + set(RunCMake_TEST_FAILED "Test only valid for WindowsCE") + return() +endif() + +set(FoundTargetFrameworkTargetsVersion FALSE) +set(FoundDotNetFrameworkVersion FALSE) +set(FoundTargetFrameworkIdentifier FALSE) +set(FoundCFTargetsImport FALSE) + + +file(STRINGS "${csProjectFile}" lines) +foreach(line IN LISTS lines) + #message(STATUS ${line}) + if(line MATCHES "^ *<TargetFrameworkIdentifier>WindowsEmbeddedCompact</TargetFrameworkIdentifier> *$") + set(FoundTargetFrameworkIdentifier TRUE) + elseif(line MATCHES " *<TargetFrameworkVersion>v3.9</TargetFrameworkVersion> *$") + set(FoundDotNetFrameworkVersion TRUE) + elseif(line MATCHES " *<TargetFrameworkTargetsVersion>v8.0</TargetFrameworkTargetsVersion> *$") + set(FoundTargetFrameworkTargetsVersion TRUE) + elseif( line MATCHES " *<Import Project=\"\\$\\(MSBuildExtensionsPath\\)\\\\Microsoft\\\\\\$\\(TargetFrameworkIdentifier\\)\\\\\\$\\(TargetFrameworkTargetsVersion\\)\\\\Microsoft\\.\\$\\(TargetFrameworkIdentifier\\)\\.CSharp\\.targets\" */> *" ) + set(FoundCFTargetsImport TRUE) + endif() +endforeach() + + +if(NOT FoundTargetFrameworkTargetsVersion) + set(RunCMake_TEST_FAILED "TargetFrameworkIdentifier not found or not set correctly.") + return() +endif() + +if(NOT FoundDotNetFrameworkVersion) + set(RunCMake_TEST_FAILED "TargetFrameworkVersion not found or not set correctly.") + return() +endif() + +if(NOT FoundTargetFrameworkIdentifier) + set(RunCMake_TEST_FAILED "TargetFrameworkTargetsVersion not found or not set correctly.") + return() +endif() + +if(NOT FoundCFTargetsImport) + set(RunCMake_TEST_FAILED "Import of Compact Framework targets file not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake new file mode 100644 index 0000000..fb2acbb --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCSharpCFProject.cmake @@ -0,0 +1,8 @@ +enable_language(CSharp) + +add_library(foo SHARED foo.cs ) + +set_target_properties(foo + PROPERTIES + DOTNET_TARGET_FRAMEWORK_VERSION "v3.9" +) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index e9e9cac..0a2ba63 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -100,6 +100,8 @@ function(check_project test name guid type platform imported_release_config_name set(platform "${RunCMake_GENERATOR_PLATFORM}") elseif("${RunCMake_GENERATOR}" MATCHES "Win64") set(platform "x64") + elseif(VS_PLATFORM_NAME) + set(platform "${VS_PLATFORM_NAME}") else() set(platform "Win32") endif() diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index 40c265e..0d45db8 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(SUBDIR) # Some systems do not seem to support rpath with spaces. -if(CMAKE_SYSTEM_NAME MATCHES "IRIX|QNX") +if(CMAKE_SYSTEM_NAME MATCHES "QNX") set(CMAKE_SKIP_BUILD_RPATH 1) endif() diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 7465243..8ca7252 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) project(VSExternalInclude) -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012456]") set(PROJECT_EXT vcxproj) else() set(PROJECT_EXT vcproj) @@ -55,7 +55,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012456]") add_dependencies(VSExternalInclude lib1) endif() diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index c5231bb..aee8a69 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -55,6 +55,9 @@ # HACK: iwyu wrongly thinks that <system_error> is needed for std::hash { symbol: [ "std::hash", private, "<functional>", public ] }, + # HACK: iwyu thinks we use a libstdc++ private type + { symbol: [ "__gnu_cxx::size_t", private, "<cstddef>", public ] }, + # __decay_and_strip is used internally in the C++11 standard library. # IWYU does not classify it as internal and suggests to add <type_traits>. # To ignore it, we simply map it to a file that is included anyway. diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index 2e817d9..c03c665 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -25,13 +25,13 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMAKE_C_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG CMAKE_CXX_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG -CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,5.01 +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,6.01 CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs} CMAKE_PREFIX_PATH:STRING=${qt_prefix} CMake_TEST_Qt4:BOOL=OFF CMake_TEST_Qt5:BOOL=OFF ") -set(ppflags "-D_WIN32_WINNT=0x501 -DNTDDI_VERSION=0x05010000 -D_USING_V110_SDK71_") +set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000 -D_USING_V110_SDK71_") set(CFLAGS "${ppflags}") set(CXXFLAGS "${ppflags}") set(ENV ". ~/rel/env32") diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 33af830..8417206 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -25,13 +25,13 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMAKE_C_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG CMAKE_CXX_FLAGS_RELEASE:STRING=-MT -O2 -Ob2 -DNDEBUG -CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,5.02 +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x64 -subsystem:console,6.01 CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING=${qt_win_libs} CMAKE_PREFIX_PATH:STRING=${qt_prefix} CMake_TEST_Qt4:BOOL=OFF CMake_TEST_Qt5:BOOL=OFF ") -set(ppflags "-D_WIN32_WINNT=0x502 -DNTDDI_VERSION=0x05020000 -D_USING_V110_SDK71_") +set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000 -D_USING_V110_SDK71_") set(CFLAGS "${ppflags}") set(CXXFLAGS "${ppflags}") set(ENV ". ~/rel/env64") diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 9ae7aa3..1c96497 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -29,7 +29,7 @@ set(DISABLED_THREADSAFE OFF CACHE INTERNAL "Curl can use thread-safe functions") set(ENABLE_ARES OFF CACHE INTERNAL "No curl c-ares support") set(ENABLE_CURLDEBUG OFF CACHE INTERNAL "No curl TrackMemory features") set(ENABLE_DEBUG OFF CACHE INTERNAL "No curl debug features") -set(ENABLE_IPV6 OFF CACHE INTERNAL "No curl IPv6 support") +set(ENABLE_IPV6 ON CACHE INTERNAL "Enable curl IPv6 support detection") set(ENABLE_MANUAL OFF CACHE INTERNAL "No curl built-in manual") set(ENABLE_THREADED_RESOLVER OFF CACHE INTERNAL "No curl POSIX threaded DNS lookup") set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support") diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c index 23d0c42..b38cebf 100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c @@ -97,7 +97,7 @@ x86_code(void *simple_ptr, uint32_t now_pos, bool is_encoder, if (!Test86MSByte(b)) break; - src = dest ^ ((1u << (32 - i * 8)) - 1); + src = dest ^ ((1ull << (32 - i * 8)) - 1); } buffer[buffer_pos + 4] diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c index 1bded8d..f2a5065 100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@ -334,7 +334,7 @@ static void uv__process_child_init(const uv_process_options_t* options, use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); close_fd = use_fd; - if (use_fd == -1) { + if (use_fd < 0) { uv__write_int(error_fd, UV__ERR(errno)); _exit(127); } |