diff options
486 files changed, 14266 insertions, 6583 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f4c111..c7d139b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,7 +264,6 @@ macro(CMAKE_SETUP_TESTING) ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY) endif() mark_as_advanced(DART_ROOT) - mark_as_advanced(CURL_TESTING) endmacro() diff --git a/Copyright.txt b/Copyright.txt index 19f3deb..b867d01 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -99,6 +99,7 @@ The following individuals and institutions are among the Contributors: * Sebastian Holtermann <sebholt@xwmw.org> * Stephen Kelly <steveire@gmail.com> * Sylvain Joubert <joubert.sy@gmail.com> +* The Qt Company Ltd. * Thomas Sondergaard <ts@medical-insight.com> * Tobias Hunger <tobias.hunger@qt.io> * Todd Gamblin <tgamblin@llnl.gov> diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index 5712fb4..e52e623 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -22,3 +22,9 @@ If neither ``FORCE`` nor ``CLEAR`` is specified, new values will be marked as advanced, but if a variable already has an advanced/non-advanced state, it will not be changed. + +.. note:: + + Policy :policy:`CMP0102` affects the behavior of the ``mark_as_advanced`` + call. When set to ``NEW``, variables passed to this command which are not + already in the cache are ignored. See policy :policy:`CMP0102`. diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst index 35320c2..cede0f2 100644 --- a/Help/cpack_gen/dmg.rst +++ b/Help/cpack_gen/dmg.rst @@ -54,10 +54,12 @@ on macOS: Directory where license and menu files for different languages are stored. Setting this causes CPack to look for a ``<language>.menu.txt`` and - ``<language>.license.txt`` file for every language defined in - ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and + ``<language>.license.txt`` or ``<language>.license.rtf`` file for every + language defined in ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu - files and use the same license file for all languages. + files and use the same license file for all languages. If both + ``<language>.license.txt`` and ``<language>.license.rtf`` exist, the ``.txt`` + file will be used. .. variable:: CPACK_DMG_SLA_LANGUAGES diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst index 81acb9d..c2a450e 100644 --- a/Help/cpack_gen/packagemaker.rst +++ b/Help/cpack_gen/packagemaker.rst @@ -3,6 +3,11 @@ CPack PackageMaker Generator PackageMaker CPack generator (macOS). +.. deprecated:: 3.17 + + Xcode no longer distributes the PackageMaker tools. + This CPack generator will be removed in a future version of CPack. + Variables specific to CPack PackageMaker generator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/generator/Ninja Multi-Config.rst b/Help/generator/Ninja Multi-Config.rst index 248eb05..11c59f2 100644 --- a/Help/generator/Ninja Multi-Config.rst +++ b/Help/generator/Ninja Multi-Config.rst @@ -11,30 +11,74 @@ Unlike the :generator:`Ninja` generator, ``Ninja Multi-Config`` generates multiple configurations at once with :variable:`CMAKE_CONFIGURATION_TYPES` instead of only one configuration with :variable:`CMAKE_BUILD_TYPE`. One ``build-<Config>.ninja`` file will be generated for each of these -configurations (with ``<Config>`` being the configuration name.) No -``build.ninja`` file is generated, unless -:variable:`CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE` is specified. You must specify -the desired ``build-<Config>.ninja`` file with ``ninja -f``. Running -``cmake --build . --config <Config> --target <target>`` will run Ninja with -``build-<Config>.ninja`` as the ``-f`` file and ``<target>`` as the build -target. - -If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is turned on, executables -and libraries of any configuration can be built regardless of which -``build-<Config>.ninja`` file is used, simply by specifying -``<target>:<OtherConfig>`` as the Ninja target. You can also specify -``<target>:all`` to build a target in all configurations. Each -``build-<Config>.ninja`` file will additionally have ``<target>`` targets which -are aliases for ``<target>:<Config>``. However, custom commands and custom -targets will always use the configuration specified in -``build-<Config>.ninja``. This is due to the fact that it is impossible in -Ninja for the same file to be output with different commands in the same build -graph. - -If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is not enabled, you can -still build any target in ``build-<Config>.ninja`` by specifying -``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or -``<target>:all``. +configurations (with ``<Config>`` being the configuration name.) These files +are intended to be run with ``ninja -f build-<Config>.ninja``. No +``build.ninja`` file is generated by default (see below for how to generate +it.) + +``cmake --build . --config <Config>`` will always use ``build-<Config>.ninja`` +to build. If no ``--config`` argument is specified, ``cmake --build .`` will +default to ``build-Debug.ninja``, unless a ``build.ninja`` is generated (see +below), in which case that will be used instead. + +Each ``build-<Config>.ninja`` file contains ``<target>`` targets as well as +``<target>:<Config>`` targets, where ``<Config>`` is the same as the +configuration specified in ``build-<Config>.ninja`` Additionally, if +cross-config mode is enabled, ``build-<Config>.ninja`` may contain +``<target>:<OtherConfig>`` targets, where ``<OtherConfig>`` is a cross-config, +as well as ``<target>:all``, which builds the target in all cross-configs. See +below for how to enable cross-config mode. + +The ``Ninja Multi-Config`` generator recognizes the following variables: + +:variable:`CMAKE_CONFIGURATION_TYPES` + Specifies the total set of configurations to build. See the variable's + documentation for more information. + +:variable:`CMAKE_NMC_CROSS_CONFIGS` + Specifies a :ref:`semicolon-separated list <CMake Language Lists>` of + configurations available from all ``build-<Config>.ninja`` files. + This variable activates cross-config mode. + Targets from each config specified in this variable can be built from any + ``build-<Config>.ninja`` file. Custom commands will use the configuration + native to ``build-<Config>.ninja``. If it is set to ``all``, all + configurations from :variable:`CMAKE_CONFIGURATION_TYPES` are cross-configs. + If it is not specified, or empty, each ``build-<Config>.ninja`` file will + only contain build rules for its own configuration. + + The value of this variable must be a subset of + :variable:`CMAKE_CONFIGURATION_TYPES`. + +:variable:`CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG` + Specifies the configuration to use by default in a ``build.ninja`` file. If + this variable is specified, a ``build.ninja`` file is generated which uses + build rules from ``build-<Config>.ninja`` by default. All custom commands are + executed with this configuration. If the variable is not specified, no + ``build.ninja`` file is generated. + + The value of this variable must be one of the items from + :variable:`CMAKE_CONFIGURATION_TYPES`. + +:variable:`CMAKE_NMC_DEFAULT_CONFIGS` + Specifies a :ref:`semicolon-separated list <CMake Language Lists>` of + configurations to build for a target in ``build.ninja`` + if no ``:<Config>`` suffix is specified. If it is set to ``all``, all + configurations from :variable:`CMAKE_NMC_CROSS_CONFIGS` are used. If + it is not specified, it defaults to + :variable:`CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG`. + + For example, if you set + :variable:`CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG` to ``Release``, but + set :variable:`CMAKE_NMC_DEFAULT_CONFIGS` to ``Debug`` or ``all``, + all ``<target>`` aliases in ``build.ninja`` will resolve to + ``<target>:Debug`` or ``<target>:all``, but custom commands will still use + the ``Release`` configuration. + + The value of this variable must be a subset of + :variable:`CMAKE_NMC_CROSS_CONFIGS` or be the same as + :variable:`CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG`. It must not be + specified if :variable:`CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG` or + :variable:`CMAKE_NMC_CROSS_CONFIGS` is not used. Consider the following example: @@ -60,7 +104,7 @@ This would build the ``Debug`` configuration of ``generator``, which would be used to generate ``generated.c``, which would be used to build the ``Debug`` configuration of ``generated``. -But if :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is enabled, and you +But if :variable:`CMAKE_NMC_CROSS_CONFIGS` is set to ``all``, and you run the following instead: .. code-block:: shell @@ -74,8 +118,3 @@ used to generate ``generated.c``, which would be used to build the ``Debug`` configuration of ``generated``. This is useful for running a release-optimized version of a generator utility while still building the debug version of the targets built with the generated code. - -As a convenience, ``Ninja Multi-Config`` offers a -:variable:`CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE` setting. If this variable is -specified, a ``build.ninja`` file will be generated which points to the -specified ``build-<Config>.ninja`` file. diff --git a/Help/manual/ID_RESERVE.txt b/Help/manual/ID_RESERVE.txt new file mode 100644 index 0000000..be2b163 --- /dev/null +++ b/Help/manual/ID_RESERVE.txt @@ -0,0 +1,7 @@ +.. note:: + + CMake reserves identifiers that: + + * begin with ``CMAKE_`` (upper-, lower-, or mixed-case), or + * begin with ``_CMAKE_`` (upper-, lower-, or mixed-case), or + * begin with ``_`` followed by the name of any :manual:`CMake Command <cmake-commands(7)>`. diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 4ca8e3a..b7f0861 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -567,6 +567,8 @@ The :manual:`cmake-variables(7)` manual documents the many variables that are provided by CMake or have meaning to CMake when set by project code. +.. include:: ID_RESERVE.txt + .. _`CMake Language Environment Variables`: Environment Variables diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 53cf264..c256250 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.17 .. toctree:: :maxdepth: 1 + CMP0102: mark_as_advanced() does nothing if a cache entry does not exist. </policy/CMP0102> CMP0101: target_compile_options honors BEFORE keyword in all scopes. </policy/CMP0101> CMP0100: Let AUTOMOC and AUTOUIC process .hh header files. </policy/CMP0100> CMP0099: Link properties are transitive over private dependency on static libraries. </policy/CMP0099> diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 393735e..fb84378 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -104,6 +104,7 @@ Properties on Targets :maxdepth: 1 /prop_tgt/ADDITIONAL_CLEAN_FILES + /prop_tgt/AIX_EXPORT_ALL_SYMBOLS /prop_tgt/ALIASED_TARGET /prop_tgt/ANDROID_ANT_ADDITIONAL_OPTIONS /prop_tgt/ANDROID_API @@ -173,6 +174,7 @@ Properties on Targets /prop_tgt/CUDA_PTX_COMPILATION /prop_tgt/CUDA_SEPARABLE_COMPILATION /prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS + /prop_tgt/CUDA_RUNTIME_LIBRARY /prop_tgt/CUDA_EXTENSIONS /prop_tgt/CUDA_STANDARD /prop_tgt/CUDA_STANDARD_REQUIRED @@ -185,6 +187,7 @@ Properties on Targets /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES /prop_tgt/DEPRECATION /prop_tgt/DISABLE_PRECOMPILE_HEADERS + /prop_tgt/DOTNET_TARGET_FRAMEWORK /prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/EchoString /prop_tgt/ENABLE_EXPORTS @@ -300,6 +303,8 @@ Properties on Targets /prop_tgt/OBJCXX_STANDARD_REQUIRED /prop_tgt/OSX_ARCHITECTURES_CONFIG /prop_tgt/OSX_ARCHITECTURES + /prop_tgt/OSX_CURRENT_VERSION + /prop_tgt/OSX_COMPATIBILITY_VERSION /prop_tgt/OUTPUT_NAME_CONFIG /prop_tgt/OUTPUT_NAME /prop_tgt/PDB_NAME_CONFIG diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index f233d08..e8badd4 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -233,6 +233,9 @@ value to those supported compilers when compiling: set(CMAKE_CXX_COMPILER QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) + set(CMAKE_SYSROOT $ENV{QNX_TARGET}) + + Cross Compiling for Windows CE ------------------------------ diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index a8fbc09..1023a66 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -14,6 +14,7 @@ For general information on variables, see the :ref:`Variables <CMake Language Variables>` section in the cmake-language manual. +.. include:: ID_RESERVE.txt Variables that Provide Information ================================== @@ -48,6 +49,7 @@ Variables that Provide Information /variable/CMAKE_DEBUG_TARGET_PROPERTIES /variable/CMAKE_DIRECTORY_LABELS /variable/CMAKE_DL_LIBS + /variable/CMAKE_DOTNET_TARGET_FRAMEWORK /variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION /variable/CMAKE_EDIT_COMMAND /variable/CMAKE_EXECUTABLE_SUFFIX @@ -321,6 +323,7 @@ Variables that Control the Build .. toctree:: :maxdepth: 1 + /variable/CMAKE_AIX_EXPORT_ALL_SYMBOLS /variable/CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS /variable/CMAKE_ANDROID_API /variable/CMAKE_ANDROID_API_MIN @@ -372,6 +375,7 @@ Variables that Control the Build /variable/CMAKE_CTEST_ARGUMENTS /variable/CMAKE_CUDA_SEPARABLE_COMPILATION /variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS + /variable/CMAKE_CUDA_RUNTIME_LIBRARY /variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_DISABLE_PRECOMPILE_HEADERS /variable/CMAKE_ENABLE_EXPORTS @@ -424,8 +428,9 @@ Variables that Control the Build /variable/CMAKE_MODULE_LINKER_FLAGS_INIT /variable/CMAKE_MSVCIDE_RUN_PATH /variable/CMAKE_MSVC_RUNTIME_LIBRARY - /variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE - /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE + /variable/CMAKE_NMC_CROSS_CONFIGS + /variable/CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG + /variable/CMAKE_NMC_DEFAULT_CONFIGS /variable/CMAKE_NINJA_OUTPUT_PATH_PREFIX /variable/CMAKE_NO_BUILTIN_CHRPATH /variable/CMAKE_NO_SYSTEM_FROM_IMPORTED diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 4315f0a..44b1f2f 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -279,7 +279,9 @@ Options "file": "/full/path/to/the/CMake/file.txt", "line": 0, "cmd": "add_executable", - "args": ["foo", "bar"] + "args": ["foo", "bar"], + "time": 1579512535.9687231, + "frame": 2 } The members are: @@ -288,8 +290,8 @@ Options The full path to the CMake source file where the function was called. - ``line`` - The line in `file` of the function call. + ``line`` + The line in ``file`` of the function call. ``cmd`` The name of the function that was called. @@ -297,6 +299,12 @@ Options ``args`` A string list of all function parameters. + ``time`` + Timestamp (seconds since epoch) of the function call. + + ``frame`` + Stack frame depth of the function that was called. + Additionally, the first JSON document outputted contains the ``version`` key for the current major and minor version of the diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 25cb639..2bfaafe 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -370,6 +370,14 @@ See `Build and Test Mode`_. This option will not run any tests, it will simply print the list of all labels associated with the test set. +``--no-tests=<[error|ignore]>`` + Regard no tests found either as error or ignore it. + + If no tests were found, the default behavior of CTest is to always log an + error message but to return an error code in script mode only. This option + unifies the behavior of CTest by either returning an error code if no tests + were found or by ignoring it. + .. include:: OPTIONS_HELP.txt .. _`Label and Subproject Summary`: diff --git a/Help/policy/CMP0102.rst b/Help/policy/CMP0102.rst new file mode 100644 index 0000000..9859006 --- /dev/null +++ b/Help/policy/CMP0102.rst @@ -0,0 +1,25 @@ +CMP0102 +------- + +The :command:`mark_as_advanced` command no longer creates a cache entry if one +does not already exist. + +In CMake 3.16 and below, if a variable was not defined at all or just defined +locally, the :command:`mark_as_advanced` command would create a new cache +entry with an ``UNINITIALIZED`` type and no value. When a :command:`find_path` +(or other similar ``find_`` command) would next run, it would find this +undefined cache entry and set it up with an empty string value. This process +would end up deleting the local variable in the process (due to the way the +cache works), effectively clearing any stored ``find_`` results that were only +available in the local scope. + +The ``OLD`` behavior for this policy is to create the empty cache definition. +The ``NEW`` behavior of this policy is to ignore variables which do not +already exist in the cache. + +This policy was introduced in CMake version 3.17. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/AIX_EXPORT_ALL_SYMBOLS.rst b/Help/prop_tgt/AIX_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 0000000..15ddc0b --- /dev/null +++ b/Help/prop_tgt/AIX_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,12 @@ +AIX_EXPORT_ALL_SYMBOLS +---------------------- + +On AIX, CMake automatically exports all symbols from shared libraries, and +from executables with the :prop_tgt:`ENABLE_EXPORTS` target property set. +Explicitly disable this boolean property to suppress the behavior and +export no symbols by default. In this case it is expected that the project +will use other means to export some symbols. + +This property is initialized by the value of +the :variable:`CMAKE_AIX_EXPORT_ALL_SYMBOLS` variable if it is set +when a target is created. diff --git a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst index 69957bf..6eda26c 100644 --- a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst +++ b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst @@ -26,6 +26,9 @@ See :prop_tgt:`AUTOGEN_TARGET_DEPENDS` for reference. By default :prop_tgt:`AUTOMOC_DEPEND_FILTERS` is initialized from :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`, which is empty by default. +From Qt 5.15.0 on this variable is ignored as moc is able to output the correct +dependencies. + See the :manual:`cmake-qt(7)` manual for more information on using CMake with Qt. diff --git a/Help/prop_tgt/CUDA_RUNTIME_LIBRARY-VALUES.txt b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY-VALUES.txt new file mode 100644 index 0000000..a6d7050 --- /dev/null +++ b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY-VALUES.txt @@ -0,0 +1,9 @@ +``None`` + Link with ``-cudart=none`` or equivalent flag(s) to use no CUDA + runtime library. +``Shared`` + Link with ``-cudart=shared`` or equivalent flag(s) to use a + dynamically-linked CUDA runtime library. +``Static`` + Link with ``-cudart=static`` or equivalent flag(s) to use a + statically-linked CUDA runtime library. diff --git a/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst new file mode 100644 index 0000000..0782765 --- /dev/null +++ b/Help/prop_tgt/CUDA_RUNTIME_LIBRARY.rst @@ -0,0 +1,21 @@ +CUDA_RUNTIME_LIBRARY +-------------------- + +Select the CUDA runtime library for use by compilers targeting the CUDA language. + +The allowed case insensitive values are: + +.. include:: CUDA_RUNTIME_LIBRARY-VALUES.txt + +Contents of ``CUDA_RUNTIME_LIBRARY`` may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. + +If this property is not set then CMake uses the default value +``Static`` to select the CUDA runtime library. + +.. note:: + + This property has effect only when the ``CUDA`` language is enabled. To + control the CUDA runtime linking when only using the CUDA SDK with the + ``C`` or ``C++`` language we recommend using the :module:`FindCUDAToolkit` + module. diff --git a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst new file mode 100644 index 0000000..8698eb6 --- /dev/null +++ b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst @@ -0,0 +1,13 @@ +DOTNET_TARGET_FRAMEWORK +----------------------- + +Specify the .NET target framework. + +Used to specify the .NET target framework for C++/CLI and C#. For +example: ``netcoreapp2.1``. + +This property is only evaluated for :ref:`Visual Studio Generators` +VS 2010 and above. + +Can be initialized for all targets using the variable +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK`. diff --git a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst index c100326..b33f4fb 100644 --- a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -3,11 +3,13 @@ DOTNET_TARGET_FRAMEWORK_VERSION Specify the .NET target framework version. -Used to specify the .NET target framework version for C++/CLI. For -example: ``v4.5``. +Used to specify the .NET target framework version for C++/CLI and C#. +For example: ``v4.5``. This property is only evaluated for :ref:`Visual Studio Generators` VS 2010 and above. -Can be initialized for all targets using the variable -:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`. +To initialize this variable for all targets set +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` or +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`. If both are set, +the latter is ignored. diff --git a/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst b/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst new file mode 100644 index 0000000..5432b9a7 --- /dev/null +++ b/Help/prop_tgt/OSX_COMPATIBILITY_VERSION.rst @@ -0,0 +1,14 @@ +OSX_COMPATIBILITY_VERSION +------------------------- + +What compatibility version number is this target for OSX. + +For shared libraries on Mach-O systems (e.g. macOS, iOS) +the ``OSX_COMPATIBILITY_VERSION`` property correspond to +``compatibility version`` and :prop_tgt:`OSX_CURRENT_VERSION` to +``current version``. +See the :prop_tgt:`FRAMEWORK` target property for an example. + +Versions of Mach-O binaries may be checked with the ``otool -L <binary>`` +command. If ``OSX_COMPATIBILITY_VERSION`` is not set, the value of +the :prop_tgt:``SOVERSION`` property will be used. diff --git a/Help/prop_tgt/OSX_CURRENT_VERSION.rst b/Help/prop_tgt/OSX_CURRENT_VERSION.rst new file mode 100644 index 0000000..609924d --- /dev/null +++ b/Help/prop_tgt/OSX_CURRENT_VERSION.rst @@ -0,0 +1,13 @@ +OSX_CURRENT_VERSION +------------------- + +What current version number is this target for OSX. + +For shared libraries on Mach-O systems (e.g. macOS, iOS) +the :prop_tgt:`OSX_COMPATIBILITY_VERSION` property correspond to +``compatibility version`` and ``OSX_CURRENT_VERSION`` to ``current version``. +See the :prop_tgt:`FRAMEWORK` target property for an example. + +Versions of Mach-O binaries may be checked with the ``otool -L <binary>`` +command. If ``OSX_CURRENT_VERSION`` is not set, the value of +the :prop_tgt:``VERSION`` property will be used. diff --git a/Help/prop_tgt/SOVERSION.rst b/Help/prop_tgt/SOVERSION.rst index b07c17c..1a66c8f 100644 --- a/Help/prop_tgt/SOVERSION.rst +++ b/Help/prop_tgt/SOVERSION.rst @@ -21,7 +21,9 @@ Mach-O Versions ^^^^^^^^^^^^^^^ For shared libraries and executables on Mach-O systems (e.g. macOS, iOS), -the ``SOVERSION`` property corresponds to *compatibility version* and -:prop_tgt:`VERSION` to *current version*. See the :prop_tgt:`FRAMEWORK` target -property for an example. Versions of Mach-O binaries may be checked with the -``otool -L <binary>`` command. +the ``SOVERSION`` property is a fallback to +:prop_tgt:`OSX_COMPATIBILITY_VERSION` property which corresponds to +*compatiblity version* and :prop_tgt:`VERSION` is a fallback to +:prop_tgt:`OSX_CURRENT_VERSION` which corresponds to *current version*. +See the :prop_tgt:`FRAMEWORK` target property for an example. Versions +of Mach-O binaries may be checked with the ``otool -L <binary>`` command. diff --git a/Help/prop_tgt/VERSION.rst b/Help/prop_tgt/VERSION.rst index ff3b303..a24b613 100644 --- a/Help/prop_tgt/VERSION.rst +++ b/Help/prop_tgt/VERSION.rst @@ -23,7 +23,9 @@ Mach-O Versions ^^^^^^^^^^^^^^^ For shared libraries and executables on Mach-O systems (e.g. macOS, iOS), -the :prop_tgt:`SOVERSION` property correspond to *compatibility version* and -``VERSION`` to *current version*. See the :prop_tgt:`FRAMEWORK` target +the ``VERSION`` property is a fallback to :prop_tgt:`OSX_CURRENT_VERSION` +property which corresponds to *current version* and :prop_tgt:`SOVERSION` +is a fallback to :prop_tgt:`OSX_COMPATIBILITY_VERSION` which corresponds +to *compatiblity version*. See the :prop_tgt:`FRAMEWORK` target property for an example. Versions of Mach-O binaries may be checked with the ``otool -L <binary>`` command. diff --git a/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst index 9f5a313..6cb8f86 100644 --- a/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -3,8 +3,9 @@ VS_DOTNET_TARGET_FRAMEWORK_VERSION Specify the .NET target framework version. -Used to specify the .NET target framework version for C++/CLI. For +Used to specify the .NET target framework version for C++/CLI. For example, "v4.5". This property is deprecated and should not be used anymore. Use +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` or :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` instead. diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst new file mode 100644 index 0000000..30e6cc3 --- /dev/null +++ b/Help/release/3.17.rst @@ -0,0 +1,316 @@ +CMake 3.17 Release Notes +************************ + +.. only:: html + + .. contents:: + +Changes made since CMake 3.16 include the following. + +New Features +============ + +Generators +---------- + +* :manual:`cmake(1)` gained a :generator:`Ninja Multi-Config` generator, + which is similar to the :generator:`Ninja` generator but can be used to build + multiple configurations at once. + +* :ref:`Visual Studio Generators` learned to support per-config sources. + Previously only :ref:`Command-Line Build Tool Generators` supported them. + +* :ref:`Visual Studio Generators` for VS 2010 and above now support + specifying the ``VCTargetsPath`` value for project files in + :variable:`CMAKE_GENERATOR_TOOLSET` setting. + +* :ref:`Visual Studio Generators` for VS 2010 and above learned to + support .NET Standard and .NET Core. See the + :prop_tgt:`DOTNET_TARGET_FRAMEWORK` target property and + associated :variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` variable. + +Languages +--------- + +* The :manual:`Compile Features <cmake-compile-features(7)>` functionality + now offers meta-features for the CUDA language standard levels + (e.g. ``cuda_std_03``, ``cuda_std_14``). See + :prop_gbl:`CMAKE_CUDA_KNOWN_FEATURES`. + +Compilers +--------- + +* The IBM XL Fortran compiler is now supported by the :generator:`Ninja` + generator. + +Command-Line +------------ + +* :manual:`cmake(1)` gained a ``--debug-find`` command-line option to + enable additional human-readable output on where find commands search. + +* :manual:`cmake(1)` gained a ``--trace-format`` command-line option that + can be used to set the ``--trace`` output format. Currently, the old + human readable and the new JSON format are supported. The new JSON format + is easier to parse automatically, than the existing format. + +* :manual:`cmake(1)` gained a ``-E rm`` command-line tool that can be + used to remove directories and files. This supersedes the existing + ``-E remove`` and ``-E remove_directory`` tools and has better semantics. + +Commands +-------- + +* The :command:`add_custom_command` command learned to interpret paths in + ``DEPENDS`` arguments that are specified relative to the current + binary directory. + +* The :command:`foreach` learned a new option ``ZIP_LISTS`` to iterate + over multiple lists simultaneously. + +* The :command:`load_cache(READ_WITH_PREFIX)` command mode is now allowed + when using ``cmake -P`` to :ref:`Run a Script <Script Processing Mode>`. + +* The :command:`message` command learned to output context provided in + the :variable:`CMAKE_MESSAGE_CONTEXT` variable for log levels + ``NOTICE`` and below. Enable this output with the new ``--log-context`` + command-line option or :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` variable. + +* The :command:`message` command gained new keywords ``CHECK_START``, + ``CHECK_PASS`` and ``CHECK_FAIL``. + +* :command:`target_compile_options` command now honors the ``BEFORE`` + keyword more consistently. See policy :policy:`CMP0101`. + +Variables +--------- + +* A :variable:`CMAKE_CTEST_ARGUMENTS` variable was added to specify a list + of command-line arguments passed to CTest when running through the + ``test`` (or ``RUN_TESTS``) target of the generated build system. + +* The following variables are now defined inside a :command:`function`: + + - :variable:`CMAKE_CURRENT_FUNCTION` + - :variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR` + - :variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE` + - :variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` + +* The :variable:`CMAKE_CUDA_RUNTIME_LIBRARY` variable and + :prop_tgt:`CUDA_RUNTIME_LIBRARY` target property were introduced to + select the CUDA runtime library used when linking targets that + use CUDA. + +* The :variable:`CMAKE_FIND_DEBUG_MODE` variable was introduced to + print extra find call information during the cmake run to standard + error. Output is designed for human consumption and not for parsing. + +* The :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable now takes its + initial value from the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment + variable if no explicit configuration is given. + +* The :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable, if not set + explicitly, now takes its initial value from the + :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER` environment variable. + +* The :variable:`CMAKE_MESSAGE_LOG_LEVEL` variable can now be used + to persist a log level between CMake runs, unlike the ``--log-level`` + command line option which only applies to that particular run. + +* The :variable:`CMAKE_XCODE_SCHEME_ENVIRONMENT` variable and + :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` target property were added to + tell the :generator:`Xcode` generator to set the value of the + ``Custom Working Directory`` schema option. + +Properties +---------- + +* The :prop_tgt:`AIX_EXPORT_ALL_SYMBOLS` target property and associated + :variable:`CMAKE_AIX_EXPORT_ALL_SYMBOLS` variable were created to + optionally explicitly disbale automatic export of symbols from shared + libraries on AIX. + +* The :prop_tgt:`DEPRECATION` target property was added to mark + a target as deprecated. If a linked target is marked as + deprecated, a warning with the deprecation message is issued + at generate time. + +* The :prop_tgt:`INSTALL_NAME_DIR` target property now supports + :manual:`generator expressions <cmake-generator-expressions(7)>`. + In particular, the ``$<INSTALL_PREFIX>`` generator expression can + be used to set the directory relative to the install-time prefix. + +* Target properties :prop_tgt:`OSX_COMPATIBILITY_VERSION` and + :prop_tgt:`OSX_CURRENT_VERSION` were added to set the + ``compatibility_version`` and ``curent_version`` respectively + on macOS. For backwards compatibility, if these properties + are not set, :prop_tgt:`SOVERSION` and :prop_tgt:`VERSION` + are used respectively as fallbacks. + +* The :prop_tgt:`VS_DOTNET_DOCUMENTATION_FILE` target property was added + to tell :ref:`Visual Studio Generators` to generate a ``DocumentationFile`` + reference in ``.csproj`` files. + +Modules +------- + +* The :module:`ExternalProject` module :command:`ExternalProject_Add` + command gained a ``GIT_SUBMODULES_RECURSE`` option to specify whether + Git submodules should be updated recursively. The default is on to + preserve existing behavior. + +* The :module:`FindCUDAToolkit` module was added to find the + CUDA Toolkit without enabling CUDA as a language. + +* The :module:`FindCURL` module learned to find CURL using + the ``CURLConfig.cmake`` package configuration file generated by + CURL's cmake buildsystem. It also gained a new ``CURL_NO_CURL_CMAKE`` + option to disable this behavior. + +* The :module:`FindFLEX` module's ``FLEX_TARGET`` command now runs ``flex`` + with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory. + See policy :policy:`CMP0098`. + +* The :module:`FindLibArchive` module now provides an imported target + for libarchive. + +* The :module:`FindPython` module has learned to find Python components + in active virtual environments managed by ``conda``. + +* The :module:`FindPython3` and :module:`FindPython` modules gained, + respectively, variable ``Python3_SOABI`` and ``Python_SOABI`` giving + the standard extension suffix for modules. + +* The :module:`FindLibXml2` module now provides an imported target for the + ``xmllint`` executable + +Autogen +------- + +* :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` learned to process headers + with a ``.hh`` extension. See policy :policy:`CMP0100`. + +CTest +----- + +* The :variable:`CTEST_CONFIGURATION_TYPE` variable is now set from the + command line when :manual:`ctest(1)` is invoked with ``-C <cfg>``. + +* The :manual:`ctest(1)` gained support for Dr. Memory to run + memcheck runs. + +* The :manual:`ctest(1)` tool gained a ``--no-tests=<[error|ignore]>`` option + to explicitly set and unify the behavior between direct invocation and + script mode if no tests were found. + +* The :manual:`ctest(1)` tool gained a ``--repeat <mode>:<n>`` option + to specify conditions in which to repeat tests. This generalizes + the existing ``--repeat-until-fail <n>`` option to add modes for + ``until-pass`` and ``after-timeout``. + +* The :command:`ctest_test` command gained a ``REPEAT <mode>:<n>`` option + to specify conditions in which to repeat tests. + +CPack +----- + +* The :cpack_gen:`CPack DragNDrop Generator` learned to use + the :variable:`CPACK_DMG_<component>_FILE_NAME` variable + to set a custom filename when packaging components into + their own DMGs. + +* The :cpack_gen:`CPack DragNDrop Generator` learned to handle + RTF formatted license files. When :variable:`CPACK_DMG_SLA_DIR` + variable is set, ``<language>.license.rtf`` is considered, but + only as a fallback when the plaintext (``.txt``) file is not found + in order to maintain backwards compatibility. + +* The :cpack_gen:`CPack NSIS Generator` gained a new variable + :variable:`CPACK_NSIS_MUI_HEADERIMAGE` to set the header image. + To not break existing setups, it still defaults to + :variable:`CPACK_PACKAGE_ICON` if the new variable is not set. + +* The :cpack_gen:`CPack NSIS Generator` now supports + :variable:`CPACK_NSIS_UNINSTALL_NAME`. + This can be used to specify the name of the Uninstall program. + +* The :cpack_gen:`CPack NSIS Generator` now supports + :variable:`CPACK_NSIS_WELCOME_TITLE` and + :variable:`CPACK_NSIS_WELCOME_TITLE_3LINES`. + These can be used to specify the welcome page title and display it in 3 lines. + +* The :cpack_gen:`CPack NSIS Generator` now supports + :variable:`CPACK_NSIS_FINISH_TITLE` and + :variable:`CPACK_NSIS_FINISH_TITLE_3LINES`. + These can be used to specify the finish page title and display it in 3 lines. + +* The :cpack_gen:`CPack productbuild Generator` gained option + :variable:`CPACK_PRODUCTBUILD_BACKGROUND` to specify a background image + for the macOS installer. + +Other +----- + +* :manual:`ccmake(1)` now displays cache values using colors + based on the entry type if the terminal supports color. + +* :manual:`ccmake(1)` now displays messages and a progress bar during + configure and generate. It will keep the output displayed if any + errors or warnings occurred. + +Deprecated and Removed Features +=============================== + +* An explicit deprecation diagnostic was added for policy ``CMP0068`` + and policy ``CMP0069`` (``CMP0067`` 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. + +* The :cpack_gen:`CPack PackageMaker Generator` generator has been + deprecated because Xcode no longer distributes the PackageMaker tools. + The undocumented ``OSXX11`` generator has also been deprecated. + +* The :manual:`cmake(1)` command-line ``-E remove`` and ``-E remove_directory`` + tools are deprecated in favor of the new ``-E rm`` tool. The older tools + always returned 0 if a named path did not exist even without the force + option and cannot be fixed without breaking compatibility, and so have + been superseded. + +Other Changes +============= + +* The :manual:`file API <cmake-file-api(7)>` index file now emits a + ``multiConfig`` flag specifying whether or not the generator supports + multiple output configurations. + +* Target link properties :prop_tgt:`INTERFACE_LINK_OPTIONS`, + :prop_tgt:`INTERFACE_LINK_DIRECTORIES` and + :prop_tgt:`INTERFACE_LINK_DEPENDS` are now transitive over private + dependencies on static libraries. + See policy :policy:`CMP0099`. + +* When using MinGW tools, the :command:`find_library` command no longer + finds ``.dll`` files by default. Instead it expects ``.dll.a`` import + libraries to be available. + +* The :generator:`MinGW Makefiles` generator no longer issues an error if + ``sh.exe`` is present in the environment's ``PATH``. + +* The :generator:`Ninja` generator now prefers the first ninja build + tool to appear in the ``PATH`` no matter whether it is called + ``ninja-build``, ``ninja``, or ``samu``. Previously the first + of those names to appear anywhere in the ``PATH`` would be preferred. + +* With SDCC the ``sdar`` tool is now preferred over ``sdcclib`` as librarian. + The latter was deprecated by SDCC 3.2.0 and removed in SDCC 3.8.6. + +* With SDCC the default flags no longer include any target-specific flags. + Previously the default flags were hard-coded for 8051. + +* The :variable:`CMAKE_VS_GLOBALS` variable value now applies during + compiler identification and in targets created by the + :command:`add_custom_target` command. + +* The :generator:`Xcode` generator no longer hard-codes ``-Wmost``, + ``-Wno-four-char-constants``, and ``-Wno-unknown-pragmas`` warning flags. diff --git a/Help/release/dev/CMAKE_CURRENT_FUNCTION.rst b/Help/release/dev/CMAKE_CURRENT_FUNCTION.rst deleted file mode 100644 index a15e63d..0000000 --- a/Help/release/dev/CMAKE_CURRENT_FUNCTION.rst +++ /dev/null @@ -1,9 +0,0 @@ -CMAKE_CURRENT_FUNCTION ----------------------- - -* Define the following variables inside a function: - - - :variable:`CMAKE_CURRENT_FUNCTION` - - :variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR` - - :variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE` - - :variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` diff --git a/Help/release/dev/ExternalProject-git-no-recurse.rst b/Help/release/dev/ExternalProject-git-no-recurse.rst deleted file mode 100644 index b9e09d3..0000000 --- a/Help/release/dev/ExternalProject-git-no-recurse.rst +++ /dev/null @@ -1,7 +0,0 @@ -ExternalProject-git-no-recurse ------------------------------- - -* The :module:`ExternalProject` module :command:`ExternalProject_Add` - command gained a ``GIT_SUBMODULES_RECURSE`` option to specify whether - Git submodules should be updated recursively. The default is on to - preserve existing behavior. diff --git a/Help/release/dev/FindCUDAToolkit-module.rst b/Help/release/dev/FindCUDAToolkit-module.rst deleted file mode 100644 index 53a69c6..0000000 --- a/Help/release/dev/FindCUDAToolkit-module.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindCUDAToolkit-module ----------------------- - -* The :module:`FindCUDAToolkit` module was added to find the CUDA Toolkit without enabling CUDA as a language. diff --git a/Help/release/dev/FindCURL-cmake-package.rst b/Help/release/dev/FindCURL-cmake-package.rst deleted file mode 100644 index 67c5bbc..0000000 --- a/Help/release/dev/FindCURL-cmake-package.rst +++ /dev/null @@ -1,7 +0,0 @@ -FindCURL-cmake-package ----------------------- - -* The :module:`FindCURL` module learned to find CURL using - the ``CURLConfig.cmake`` package configuration file generated by - CURL's cmake buildsystem. It also gained a new ``CURL_NO_CURL_CMAKE`` - option to disable this behavior. diff --git a/Help/release/dev/FindFLEX-work-dir.rst b/Help/release/dev/FindFLEX-work-dir.rst deleted file mode 100644 index 3569185..0000000 --- a/Help/release/dev/FindFLEX-work-dir.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindFLEX-work-dir ------------------ - -* The :module:`FindFLEX` module's ``FLEX_TARGET`` command now runs ``flex`` - with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory. - See policy :policy:`CMP0098`. diff --git a/Help/release/dev/FindLibArchive-target.rst b/Help/release/dev/FindLibArchive-target.rst deleted file mode 100644 index 8998dae..0000000 --- a/Help/release/dev/FindLibArchive-target.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindLibArchive-target ---------------------- - -* The :module:`FindLibArchive` module now returns an ``IMPORTED`` target - for libarchive. diff --git a/Help/release/dev/FindPython-SOABI.rst b/Help/release/dev/FindPython-SOABI.rst deleted file mode 100644 index 29f7292..0000000 --- a/Help/release/dev/FindPython-SOABI.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindPython-SOABI ----------------- - -* The :module:`FindPython3` and :module:`FindPython` modules gained, - respectively, variable ``Python3_SOABI`` and ``Python_SOABI`` giving - the standard extension suffix for modules. diff --git a/Help/release/dev/FindPythonConda-module.rst b/Help/release/dev/FindPythonConda-module.rst deleted file mode 100644 index d762fbf..0000000 --- a/Help/release/dev/FindPythonConda-module.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindPythonConda-module ----------------------- - -* The :module:`FindPython` module has learned to find Python components in active - virtual environments managed by ``conda``. diff --git a/Help/release/dev/Link-properties-transitive.rst b/Help/release/dev/Link-properties-transitive.rst deleted file mode 100644 index 535b40c..0000000 --- a/Help/release/dev/Link-properties-transitive.rst +++ /dev/null @@ -1,8 +0,0 @@ -Link-properties-transitive --------------------------- - -* Target link properties :prop_tgt:`INTERFACE_LINK_OPTIONS`, - :prop_tgt:`INTERFACE_LINK_DIRECTORIES` and - :prop_tgt:`INTERFACE_LINK_DEPENDS` are now transitive over private - dependency on static libraries. - See policy :policy:`CMP0099`. diff --git a/Help/release/dev/add_custom_command-depends-path.rst b/Help/release/dev/add_custom_command-depends-path.rst deleted file mode 100644 index 69a805b..0000000 --- a/Help/release/dev/add_custom_command-depends-path.rst +++ /dev/null @@ -1,8 +0,0 @@ -add_custom_command-depends-path -------------------------------- - -* The :command:`add_custom_command` command learned to detect paths in - ``DEPENDS`` arguments and convert them to paths relative to the current - binary directory. This only applies to paths which contain a ``/`` or ``\\`` - in them because names like ``filename.txt`` could also be target names and - cannot be coverted into absolute paths blindly. diff --git a/Help/release/dev/add_target_deprecation.rst b/Help/release/dev/add_target_deprecation.rst deleted file mode 100644 index b91eca9..0000000 --- a/Help/release/dev/add_target_deprecation.rst +++ /dev/null @@ -1,7 +0,0 @@ -add_target_deprecation ----------------------- - -* A :prop_tgt:`DEPRECATION` target property was added to mark - a target as deprecated. If a linked target is marked as - deprecated, a warning with the deprecation message is issued - at generate time. diff --git a/Help/release/dev/autogen_hh_headers.rst b/Help/release/dev/autogen_hh_headers.rst deleted file mode 100644 index 35ccd61..0000000 --- a/Help/release/dev/autogen_hh_headers.rst +++ /dev/null @@ -1,6 +0,0 @@ -autogen_hh_headers ------------------- - -* :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` learned to process headers with - a ``.hh`` extension. The new behavior is enabled by policy - :policy:`CMP0100`. diff --git a/Help/release/dev/ccmake-colored-values.rst b/Help/release/dev/ccmake-colored-values.rst deleted file mode 100644 index b00885d..0000000 --- a/Help/release/dev/ccmake-colored-values.rst +++ /dev/null @@ -1,5 +0,0 @@ -ccmake-colored-values ---------------------- - -* :manual:`ccmake(1)` now displays cache values using colors - based on the entry type if the terminal supports color. diff --git a/Help/release/dev/ccmake_progress_bar_and_log_display.rst b/Help/release/dev/ccmake_progress_bar_and_log_display.rst deleted file mode 100644 index 5c67c7d..0000000 --- a/Help/release/dev/ccmake_progress_bar_and_log_display.rst +++ /dev/null @@ -1,6 +0,0 @@ -ccmake_progress_bar_and_log_display ------------------------------------ - -* :manual:`ccmake(1)` now displays messages and a progress bar during - configure and generate. It will keep the output displayed if any - errors or warnings occurred. diff --git a/Help/release/dev/cmake-ctest-arguments.rst b/Help/release/dev/cmake-ctest-arguments.rst deleted file mode 100644 index 72a264a..0000000 --- a/Help/release/dev/cmake-ctest-arguments.rst +++ /dev/null @@ -1,6 +0,0 @@ -cmake-ctest-arguments ---------------------- - -* A :variable:`CMAKE_CTEST_ARGUMENTS` variable was added to specify a list - of command-line arguments passed to CTest when running through the - ``test`` (or ``RUN_TESTS``) target of the generated build system. diff --git a/Help/release/dev/cmake-gui-env-platform-defaults.rst b/Help/release/dev/cmake-gui-env-platform-defaults.rst new file mode 100644 index 0000000..0960ef1 --- /dev/null +++ b/Help/release/dev/cmake-gui-env-platform-defaults.rst @@ -0,0 +1,8 @@ +cmake-gui-env-platform-defaults +------------------------------- + +* :manual:`cmake-gui(1)` now populates its generator selection + widget default value from the :envvar:`CMAKE_GENERATOR` environment + variable. Additionally, environment variables + :envvar:`CMAKE_GENERATOR_PLATFORM` and :envvar:`CMAKE_GENERATOR_TOOLSET` + are used to populate their respective widget defaults. diff --git a/Help/release/dev/command_debug_find.rst b/Help/release/dev/command_debug_find.rst deleted file mode 100644 index 673852c..0000000 --- a/Help/release/dev/command_debug_find.rst +++ /dev/null @@ -1,10 +0,0 @@ -cmake-debug-find ----------------- - -* :manual:`cmake(1)` gained a ``--debug-find`` command line - option that can be used to provide information on where find - commands searched. - -* Variable :variable:`CMAKE_FIND_DEBUG_MODE` was introduced to - print extra find call information during the cmake run to standard - error. Output is designed for human consumption and not for parsing. diff --git a/Help/release/dev/command_rm.rst b/Help/release/dev/command_rm.rst deleted file mode 100644 index a58362e..0000000 --- a/Help/release/dev/command_rm.rst +++ /dev/null @@ -1,12 +0,0 @@ -Command-Line --------------------- - -* :manual:`cmake(1)` gained a ``rm`` command line - option that can be used to remove directories (with ``-r`` or ``-R`` flag) - and files. - If the ``-f`` flag is not specified, attempting to remove a file that - doesn't exist returns an non-zero error code. - This command deprecates ``remove`` and ``remove_directory``. - The ``remove`` implementation was buggy and always returned 0 when ``force`` - flag was not present and a file didn't exist. It cannot be fixed without - breaking backwards compatibility so we introduced ``rm``. diff --git a/Help/release/dev/compiler-launcher-env.rst b/Help/release/dev/compiler-launcher-env.rst deleted file mode 100644 index 58519d9..0000000 --- a/Help/release/dev/compiler-launcher-env.rst +++ /dev/null @@ -1,5 +0,0 @@ -compiler-launcher-env ---------------------- - -* The :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER` environment variable may now be - used to initialize the :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable. diff --git a/Help/release/dev/cpack-nsis-headerimage_var.rst b/Help/release/dev/cpack-nsis-headerimage_var.rst deleted file mode 100644 index d44686b..0000000 --- a/Help/release/dev/cpack-nsis-headerimage_var.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-nsis-headerimage_var --------------------------- - -* The :cpack_gen:`CPack NSIS Generator` gained a new variable - :variable:`CPACK_NSIS_MUI_HEADERIMAGE` to set the header image. - To not break existing setups, it still defaults to - :variable:`CPACK_PACKAGE_ICON` if the new variable is not set. diff --git a/Help/release/dev/cpack-nsis-uninstaller-name.rst b/Help/release/dev/cpack-nsis-uninstaller-name.rst deleted file mode 100644 index b7ceb4c..0000000 --- a/Help/release/dev/cpack-nsis-uninstaller-name.rst +++ /dev/null @@ -1,6 +0,0 @@ -cpack-nsis-uninstaller-name ---------------------------- - -* The :cpack_gen:`CPack NSIS Generator` now supports - :variable:`CPACK_NSIS_UNINSTALL_NAME`. - This can be used to specify the name of the Uninstall program. diff --git a/Help/release/dev/cpack-nsis-welcome-finish-page-title.rst b/Help/release/dev/cpack-nsis-welcome-finish-page-title.rst deleted file mode 100644 index 8091d31..0000000 --- a/Help/release/dev/cpack-nsis-welcome-finish-page-title.rst +++ /dev/null @@ -1,10 +0,0 @@ -cpack-nsis-welcome-finish-page-title ------------------------------------- - -* The :cpack_gen:`CPack NSIS Generator` now supports - :variable:`CPACK_NSIS_WELCOME_TITLE` and :variable:`CPACK_NSIS_WELCOME_TITLE_3LINES`. - These can be used to specify the welcome page title and display it in 3 lines. - -* The :cpack_gen:`CPack NSIS Generator` now supports - :variable:`CPACK_NSIS_FINISH_TITLE` and :variable:`CPACK_NSIS_FINISH_TITLE_3LINES`. - These can be used to specify the finish page title and display it in 3 lines. diff --git a/Help/release/dev/cpack-pkg-background.rst b/Help/release/dev/cpack-pkg-background.rst deleted file mode 100644 index 796f5d6..0000000 --- a/Help/release/dev/cpack-pkg-background.rst +++ /dev/null @@ -1,8 +0,0 @@ -cpack-pkg-background --------------------- - -* The :cpack_gen:`CPack productbuild Generator` and - :cpack_gen:`CPack PackageMaker Generator` gained options - :variable:`CPACK_PRODUCTBUILD_BACKGROUND` and - :variable:`CPACK_PACKAGEMAKER_BACKGROUND`, respectively, - to specify a background image for the macOS installer. diff --git a/Help/release/dev/ctest-configuration-type.rst b/Help/release/dev/ctest-configuration-type.rst deleted file mode 100644 index 89e36c4..0000000 --- a/Help/release/dev/ctest-configuration-type.rst +++ /dev/null @@ -1,5 +0,0 @@ -ctest-configuration-type ------------------------- - -* The :variable:`CTEST_CONFIGURATION_TYPE` variable is now set from the command - line when :manual:`ctest(1)` is invoked with ``-C <cfg>``. diff --git a/Help/release/dev/ctest-drmemory-support.rst b/Help/release/dev/ctest-drmemory-support.rst deleted file mode 100644 index b329995..0000000 --- a/Help/release/dev/ctest-drmemory-support.rst +++ /dev/null @@ -1,5 +0,0 @@ -ctest-drmemory-support ----------------------- - -* The :manual:`ctest(1)` gained support for Dr. Memory to run - memcheck runs. diff --git a/Help/release/dev/ctest-repeat.rst b/Help/release/dev/ctest-repeat.rst deleted file mode 100644 index b1ff59b..0000000 --- a/Help/release/dev/ctest-repeat.rst +++ /dev/null @@ -1,10 +0,0 @@ -ctest-repeat ------------- - -* The :manual:`ctest(1)` tool gained a ``--repeat <mode>:<n>`` option - to specify conditions in which to repeat tests. This generalizes - the existing ``--repeat-until-fail <n>`` option to add modes for - ``until-pass`` and ``after-timeout``. - -* The :command:`ctest_test` command gained a ``REPEAT <mode>:<n>`` option - to specify conditions in which to repeat tests. diff --git a/Help/release/dev/cuda-gains-meta-features.rst b/Help/release/dev/cuda-gains-meta-features.rst deleted file mode 100644 index e5e1022..0000000 --- a/Help/release/dev/cuda-gains-meta-features.rst +++ /dev/null @@ -1,7 +0,0 @@ -cuda-gains-meta-features ------------------------- - -* The :manual:`Compile Features <cmake-compile-features(7)>` functionality - now offers meta-features for the CUDA language standard levels - (e.g. ``cuda_std_03``, ``cuda_std_14``). See - :prop_gbl:`CMAKE_CUDA_KNOWN_FEATURES`. diff --git a/Help/release/dev/custom-dmg-names.rst b/Help/release/dev/custom-dmg-names.rst deleted file mode 100644 index 73a70a1..0000000 --- a/Help/release/dev/custom-dmg-names.rst +++ /dev/null @@ -1,7 +0,0 @@ -custom-dmg-names ----------------- - -* The :cpack_gen:`CPack DragNDrop Generator` learned to use - the :variable:`CPACK_DMG_<component>_FILE_NAME` variable - to set a custom filename when packaging components into - their own DMGs. diff --git a/Help/release/dev/deprecate-policy-old.rst b/Help/release/dev/deprecate-policy-old.rst deleted file mode 100644 index 401f4b2..0000000 --- a/Help/release/dev/deprecate-policy-old.rst +++ /dev/null @@ -1,8 +0,0 @@ -deprecate-policy-old --------------------- - -* An explicit deprecation diagnostic was added for policy ``CMP0068`` - and policy ``CMP0069`` (``CMP0067`` 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/export-compile-commands-environment-variable.rst b/Help/release/dev/export-compile-commands-environment-variable.rst deleted file mode 100644 index da9d66b..0000000 --- a/Help/release/dev/export-compile-commands-environment-variable.rst +++ /dev/null @@ -1,6 +0,0 @@ -export-compile-commands-environment-variable --------------------------------------------- - -* The :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable now takes its - initial value from the :envvar:`CMAKE_EXPORT_COMPILE_COMMANDS` environment - variable if no explicit configuration is given. diff --git a/Help/release/dev/feature-CMAKE_MESSAGE_CONTEXT.rst b/Help/release/dev/feature-CMAKE_MESSAGE_CONTEXT.rst deleted file mode 100644 index a6a5c71..0000000 --- a/Help/release/dev/feature-CMAKE_MESSAGE_CONTEXT.rst +++ /dev/null @@ -1,11 +0,0 @@ -feature-CMAKE_MESSAGE_CONTEXT ------------------------------ - -* The :variable:`CMAKE_MESSAGE_LOG_LEVEL` variable can now be used - to persist a log level between CMake runs, unlike the ``--log-level`` - command line option which only applies to that particular run. - -* The :command:`message` command learned to output context provided in - the :variable:`CMAKE_MESSAGE_CONTEXT` variable for log levels - ``NOTICE`` and below. Enable this output with the new ``--log-context`` - command-line option or :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` variable. diff --git a/Help/release/dev/fileapi-multi-config.rst b/Help/release/dev/fileapi-multi-config.rst deleted file mode 100644 index e0e2e16..0000000 --- a/Help/release/dev/fileapi-multi-config.rst +++ /dev/null @@ -1,6 +0,0 @@ -fileapi-multi-config --------------------- - -* The :manual:`file API <cmake-file-api(7)>` index file now emits a - ``multiConfig`` flag specifying whether or not the generator supports - multiple output configurations. diff --git a/Help/release/dev/foreach-ZIP_LISTS.rst b/Help/release/dev/foreach-ZIP_LISTS.rst deleted file mode 100644 index d45d9b9..0000000 --- a/Help/release/dev/foreach-ZIP_LISTS.rst +++ /dev/null @@ -1,5 +0,0 @@ -foreach-ZIP_LISTS ------------------ - -* The :command:`foreach` learned a new option ``ZIP_LISTS`` to iterate - over multiple lists simultaneously. diff --git a/Help/release/dev/fphsa-detect-name-mismatch.rst b/Help/release/dev/fphsa-detect-name-mismatch.rst deleted file mode 100644 index be51a43..0000000 --- a/Help/release/dev/fphsa-detect-name-mismatch.rst +++ /dev/null @@ -1,5 +0,0 @@ -fphsa-name-mismatch -------------------- - -* The :module:`FindPackageHandleStandardArgs` module learned to check the - package name passed in for typo mistakes. diff --git a/Help/release/dev/install-name-dir-genex.rst b/Help/release/dev/install-name-dir-genex.rst deleted file mode 100644 index 0cb41f0..0000000 --- a/Help/release/dev/install-name-dir-genex.rst +++ /dev/null @@ -1,7 +0,0 @@ -install-name-dir-genex ----------------------- - -* The :prop_tgt:`INSTALL_NAME_DIR` target property now supports - :manual:`generator expressions <cmake-generator-expressions(7)>`. - In particular, the ``$<INSTALL_PREFIX>`` generator expression can - be used to set the directory relative to the install-time prefix. diff --git a/Help/release/dev/json_trace.rst b/Help/release/dev/json_trace.rst deleted file mode 100644 index 69a1fb7..0000000 --- a/Help/release/dev/json_trace.rst +++ /dev/null @@ -1,7 +0,0 @@ -json-trace ----------- - -* :manual:`cmake(1)` gained a ``--trace-format`` command line option that - can be used to set the ``--trace`` output format. Currently, the old - human readable and the new JSON format are supported. The new JSON format - is easier to parse automatically, than the existing format. diff --git a/Help/release/dev/load_cache-script-mode.rst b/Help/release/dev/load_cache-script-mode.rst deleted file mode 100644 index d84b08a..0000000 --- a/Help/release/dev/load_cache-script-mode.rst +++ /dev/null @@ -1,5 +0,0 @@ -load_cache-script-mode ----------------------- - -* The :command:`load_cache(READ_WITH_PREFIX)` command mode is now allowed - when using ``cmake -P`` to :ref:`Run a Script <Script Processing Mode>`. diff --git a/Help/release/dev/mingw-find-no-dll.rst b/Help/release/dev/mingw-find-no-dll.rst deleted file mode 100644 index 84e7431..0000000 --- a/Help/release/dev/mingw-find-no-dll.rst +++ /dev/null @@ -1,6 +0,0 @@ -mingw-find-no-dll ------------------ - -* When using MinGW tools, the :command:`find_library` command no longer - finds ``.dll`` files by default. Instead it expects ``.dll.a`` import - libraries to be available. diff --git a/Help/release/dev/mingw_no_sh.rst b/Help/release/dev/mingw_no_sh.rst deleted file mode 100644 index 7008865..0000000 --- a/Help/release/dev/mingw_no_sh.rst +++ /dev/null @@ -1,5 +0,0 @@ -mingw-no-sh ------------ - -* The :generator:`MinGW Makefiles` generator no longer issues an error if - ``sh.exe`` is present in the environment's ``PATH``. diff --git a/Help/release/dev/multi-configuration-ninja.rst b/Help/release/dev/multi-configuration-ninja.rst deleted file mode 100644 index d9f72cb..0000000 --- a/Help/release/dev/multi-configuration-ninja.rst +++ /dev/null @@ -1,6 +0,0 @@ -multi-configuration-ninja -------------------------- - -* :manual:`cmake(1)` gained a :generator:`Ninja Multi-Config` generator, - which is similar to the :generator:`Ninja` generator but can be used to build - multiple configurations at once. diff --git a/Help/release/dev/new-message-types.rst b/Help/release/dev/new-message-types.rst deleted file mode 100644 index 8f164b9..0000000 --- a/Help/release/dev/new-message-types.rst +++ /dev/null @@ -1,5 +0,0 @@ -new-message-types ------------------ - -* The :command:`message` command gained new keywords ``CHECK_START``, - ``CHECK_PASS`` and ``CHECK_FAIL``. diff --git a/Help/release/dev/ninja-postgen-commands.rst b/Help/release/dev/ninja-postgen-commands.rst deleted file mode 100644 index 85b60dc..0000000 --- a/Help/release/dev/ninja-postgen-commands.rst +++ /dev/null @@ -1,5 +0,0 @@ -ninja-postgen-commands ----------------------- - -* The :generator:`Ninja` generator learned to perform some post-processing on - the generated files for more consistent builds. diff --git a/Help/release/dev/ninja-tool.rst b/Help/release/dev/ninja-tool.rst deleted file mode 100644 index aa0292e..0000000 --- a/Help/release/dev/ninja-tool.rst +++ /dev/null @@ -1,7 +0,0 @@ -ninja-tool ----------- - -* The :generator:`Ninja` generator now prefers the first ninja build - tool to appear in the ``PATH`` no matter whether it is called - ``ninja-build``, ``ninja``, or ``samu``. Previously the first - of those names to appear anywhere in the ``PATH`` would be preferred. diff --git a/Help/release/dev/sdcc-new-librarian.rst b/Help/release/dev/sdcc-new-librarian.rst deleted file mode 100644 index 93961ce..0000000 --- a/Help/release/dev/sdcc-new-librarian.rst +++ /dev/null @@ -1,6 +0,0 @@ -sdcc-new-librarian ------------------- - -* Since sdcc 3.2.0, sdcclib has been deprecated in favor of sdar as librarian. - Since sdcc 3.8.6, it has been removed from the distribution. - Use sdar if found, else use sdcclib to keep older compatibility. diff --git a/Help/release/dev/target_compile_options-BEFORE-keyword.rst b/Help/release/dev/target_compile_options-BEFORE-keyword.rst deleted file mode 100644 index 8dafddd..0000000 --- a/Help/release/dev/target_compile_options-BEFORE-keyword.rst +++ /dev/null @@ -1,5 +0,0 @@ -target_compile_options-BEFORE-keyword -------------------------------------- - -* :command:`target_compile_options` command learns to honor ``BEFORE`` keyword - in all scopes. See policy :policy:`CMP0101`. diff --git a/Help/release/dev/vs-per-config-sources.rst b/Help/release/dev/vs-per-config-sources.rst deleted file mode 100644 index bf7572b..0000000 --- a/Help/release/dev/vs-per-config-sources.rst +++ /dev/null @@ -1,5 +0,0 @@ -vs-per-config-sources ---------------------- - -* :ref:`Visual Studio Generators` learned to support per-config sources. - Previously only :ref:`Command-Line Build Tool Generators` supported them. diff --git a/Help/release/dev/vs-vctargetspath.rst b/Help/release/dev/vs-vctargetspath.rst deleted file mode 100644 index d40af34..0000000 --- a/Help/release/dev/vs-vctargetspath.rst +++ /dev/null @@ -1,10 +0,0 @@ -vs-vctargetspath ----------------- - -* With :ref:`Visual Studio Generators` for VS 2010 and above, - the :variable:`CMAKE_GENERATOR_TOOLSET` setting gained an option - to specify the ``VCTargetsPath`` value for project files. - -* The :variable:`CMAKE_VS_GLOBALS` variable value now applies during - compiler identification and in targets created by the - :command:`add_custom_target` command. diff --git a/Help/release/dev/vs_dotnet_documentation_file.rst b/Help/release/dev/vs_dotnet_documentation_file.rst deleted file mode 100644 index fdffb1c..0000000 --- a/Help/release/dev/vs_dotnet_documentation_file.rst +++ /dev/null @@ -1,6 +0,0 @@ -vs_dotnet_documentation_file ----------------------------- - -* The :prop_tgt:`VS_DOTNET_DOCUMENTATION_FILE` target property was added - to tell :ref:`Visual Studio Generators` to generate a ``DocumentationFile`` - reference in ``.csproj`` files. diff --git a/Help/release/dev/xcode-default-warnings.rst b/Help/release/dev/xcode-default-warnings.rst deleted file mode 100644 index a9a2e49..0000000 --- a/Help/release/dev/xcode-default-warnings.rst +++ /dev/null @@ -1,5 +0,0 @@ -xcode-default-warnings ----------------------- - -* The :generator:`Xcode` generator no longer hard-codes ``-Wmost``, - ``-Wno-four-char-constants``, and ``-Wno-unknown-pragmas`` warning flags. diff --git a/Help/release/dev/xcode-scheme-env.rst b/Help/release/dev/xcode-scheme-env.rst deleted file mode 100644 index 238cb61..0000000 --- a/Help/release/dev/xcode-scheme-env.rst +++ /dev/null @@ -1,5 +0,0 @@ -xcode-scheme-env ----------------- - -* The :variable:`CMAKE_XCODE_SCHEME_ENVIRONMENT` variable was added - to initialize the :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` target property. diff --git a/Help/release/dev/xcode-scheme-workdir.rst b/Help/release/dev/xcode-scheme-workdir.rst deleted file mode 100644 index 8eb5ed8..0000000 --- a/Help/release/dev/xcode-scheme-workdir.rst +++ /dev/null @@ -1,7 +0,0 @@ -xcode-scheme-workdir --------------------- - -* The Xcode generator learnt to set the value of the - ``Custom Working Directory`` schema - option with the :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` - target property. diff --git a/Help/release/dev/xlf-ninja.rst b/Help/release/dev/xlf-ninja.rst deleted file mode 100644 index 916e713..0000000 --- a/Help/release/dev/xlf-ninja.rst +++ /dev/null @@ -1,5 +0,0 @@ -xlf-ninja ---------- - -* The IBM XL Fortran compiler is now supported by the :generator:`Ninja` - generator. diff --git a/Help/release/dev/xmllint-target.rst b/Help/release/dev/xmllint-target.rst deleted file mode 100644 index 19c69bf..0000000 --- a/Help/release/dev/xmllint-target.rst +++ /dev/null @@ -1,4 +0,0 @@ -xmllint-target --------------- - -* The :module:`FindLibXml2` module now provides an imported target for the xmllint executable diff --git a/Help/release/index.rst b/Help/release/index.rst index a4585a5..22b1a09 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -15,6 +15,7 @@ Releases .. toctree:: :maxdepth: 1 + 3.17 <3.17> 3.16 <3.16> 3.15 <3.15> 3.14 <3.14> diff --git a/Help/variable/CMAKE_AIX_EXPORT_ALL_SYMBOLS.rst b/Help/variable/CMAKE_AIX_EXPORT_ALL_SYMBOLS.rst new file mode 100644 index 0000000..c64dd48 --- /dev/null +++ b/Help/variable/CMAKE_AIX_EXPORT_ALL_SYMBOLS.rst @@ -0,0 +1,6 @@ +CMAKE_AIX_EXPORT_ALL_SYMBOLS +---------------------------- + +Default value for :prop_tgt:`AIX_EXPORT_ALL_SYMBOLS` target property. +This variable is used to initialize the property on each target as it is +created. diff --git a/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst b/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst new file mode 100644 index 0000000..ea1c1b8 --- /dev/null +++ b/Help/variable/CMAKE_CUDA_RUNTIME_LIBRARY.rst @@ -0,0 +1,24 @@ +CMAKE_CUDA_RUNTIME_LIBRARY +-------------------------- + +Select the CUDA runtime library for use by compilers targeting the MSVC ABI. +This variable is used to initialize the :prop_tgt:`CUDA_RUNTIME_LIBRARY` +property on all targets as they are created. + +The allowed case insensitive values are: + +.. include:: ../prop_tgt/CUDA_RUNTIME_LIBRARY-VALUES.txt + +Contents of ``CMAKE_CUDA_RUNTIME_LIBRARY`` may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. + +If this variable is not set then the :prop_tgt:`CUDA_RUNTIME_LIBRARY` target +property will not be set automatically. If that property is not set then +CMake uses the default value ``Static`` to select the CUDA runtime library. + +.. note:: + + This property has effect only when the ``CUDA`` language is enabled. To + control the CUDA runtime linking when only using the CUDA SDK with the + ``C`` or ``C++`` language we recommend using the :module:`FindCUDAToolkit` + module. diff --git a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst new file mode 100644 index 0000000..8edcd1e --- /dev/null +++ b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst @@ -0,0 +1,16 @@ +CMAKE_DOTNET_TARGET_FRAMEWORK +----------------------------- + +Default value for :prop_tgt:`DOTNET_TARGET_FRAMEWORK` property of +targets. + +This variable is used to initialize the +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` property on all targets. See that +target property for additional information. + +Setting ``CMAKE_DOTNET_TARGET_FRAMEWORK`` may be necessary +when working with ``C#`` and newer .NET framework versions to +avoid referencing errors with the ``ALL_BUILD`` CMake target. + +This variable is only evaluated for :ref:`Visual Studio Generators` +VS 2010 and above. diff --git a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst index 124fefe..c2eef9e 100644 --- a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -6,7 +6,11 @@ property of targets. This variable is used to initialize the :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` property on all -targets. See that target property for additional information. +targets. See that target property for additional information. When set, +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` takes precednece over this +variable. See that variable or the associated target property +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` for additional information. + Setting ``CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`` may be necessary when working with ``C#`` and newer .NET framework versions to diff --git a/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE.rst b/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE.rst deleted file mode 100644 index 0571d52..0000000 --- a/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE.rst +++ /dev/null @@ -1,10 +0,0 @@ -CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE -------------------------------------- - -If this variable is enabled, cross-configuration building is enabled in the -:generator:`Ninja Multi-Config` generator. See the generator's description for -more details. This variable is ``OFF`` by default. - -This variable is meant to be set from the command line (via -``-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE:BOOL=ON``) and should not be set from -project code. diff --git a/Help/variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE.rst b/Help/variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE.rst deleted file mode 100644 index 2b950e1..0000000 --- a/Help/variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE.rst +++ /dev/null @@ -1,7 +0,0 @@ -CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE ------------------------------------- - -Specifies a configuration type to use as the default in ``build.ninja`` for the -:generator:`Ninja Multi-Config` generator. - -If this variable is not specified, no ``build.ninja`` file is generated. diff --git a/Help/variable/CMAKE_NMC_CROSS_CONFIGS.rst b/Help/variable/CMAKE_NMC_CROSS_CONFIGS.rst new file mode 100644 index 0000000..6eb6494 --- /dev/null +++ b/Help/variable/CMAKE_NMC_CROSS_CONFIGS.rst @@ -0,0 +1,7 @@ +CMAKE_NMC_CROSS_CONFIGS +------------------------------- + +Specifies a :ref:`semicolon-separated list <CMake Language Lists>` of +configurations available from all ``build-<Config>.ninja`` files in the +:generator:`Ninja Multi-Config` generator. See the generator's +documentation for more details. diff --git a/Help/variable/CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG.rst b/Help/variable/CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG.rst new file mode 100644 index 0000000..c0eab56 --- /dev/null +++ b/Help/variable/CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG.rst @@ -0,0 +1,6 @@ +CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG +------------------------------------------- + +Specifies the configuration to use by default in a ``build.ninja`` file in the +:generator:`Ninja Multi-Config` generator. See the generator's documentation +for more details. diff --git a/Help/variable/CMAKE_NMC_DEFAULT_CONFIGS.rst b/Help/variable/CMAKE_NMC_DEFAULT_CONFIGS.rst new file mode 100644 index 0000000..e2bb017 --- /dev/null +++ b/Help/variable/CMAKE_NMC_DEFAULT_CONFIGS.rst @@ -0,0 +1,7 @@ +CMAKE_NMC_DEFAULT_CONFIGS +--------------------------------- + +Specifies a :ref:`semicolon-separated list <CMake Language Lists>` of configurations +to build for a target in ``build.ninja`` if no ``:<Config>`` suffix is specified in +the :generator:`Ninja Multi-Config` generator. +See the generator's documentation for more details. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index fc52e7b..de71d0e 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -23,6 +23,8 @@ warn by default: policy :policy:`CMP0082`. * ``CMAKE_POLICY_WARNING_CMP0089`` controls the warning for policy :policy:`CMP0089`. +* ``CMAKE_POLICY_WARNING_CMP0102`` controls the warning for + policy :policy:`CMP0102`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index c02aa2c..69a8417 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -149,17 +149,9 @@ function(cmake_add_fortran_subdirectory subdir) -P ${build_dir}/config_mingw.cmake BUILD_COMMAND ${CMAKE_COMMAND} -P ${build_dir}/build_mingw.cmake + BUILD_ALWAYS 1 INSTALL_COMMAND "" ) - # make the external project always run make with each build - externalproject_add_step(${project_name}_build forcebuild - COMMAND ${CMAKE_COMMAND} - -E rm -f - ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build - DEPENDEES configure - DEPENDERS build - ALWAYS 1 - ) # create imported targets for all libraries foreach(lib ${libraries}) add_library(${lib} SHARED IMPORTED GLOBAL) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index c5611b5..e1b3c52 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -32,6 +32,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) endif() __TestCompiler_setTryCompileTargetType() + # Avoid failing ABI detection on warnings. + string(REGEX REPLACE "(^| )-Werror(=[^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}") + # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables # and set them to "C" that way GCC's "search starts here" text is in # English and we can grok it. @@ -161,6 +164,18 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) break() endif() endforeach() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL QCC) + foreach(dir ${implicit_dirs}) + if (dir MATCHES "/lib$") + get_filename_component(assumedArchDir "${dir}" DIRECTORY) + get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY) + if (archParentDir STREQUAL CMAKE_SYSROOT) + get_filename_component(archDirName "${assumedArchDir}" NAME) + set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${archDirName}" PARENT_SCOPE) + break() + endif() + endif() + endforeach() endif() else() diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 672d3f8..848934c 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -17,6 +17,8 @@ if(CMAKE_Swift_COMPILER_ID) include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL) endif() +set(CMAKE_EXE_EXPORTS_Swift_FLAG "-emit-module -emit-module-path <SWIFT_MODULE> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS}") + set(CMAKE_INCLUDE_FLAG_Swift "-I ") if(CMAKE_SYSTEM_NAME STREQUAL Darwin) set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ") @@ -81,7 +83,7 @@ if(NOT CMAKE_Swift_CREATE_SHARED_MODULE) endif() if(NOT CMAKE_Swift_LINK_EXECUTABLE) - set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>") + set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>") endif() if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY) diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index a0f6bc9..05811a8 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -67,6 +67,29 @@ else() set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}") endif() + # Remove the following libraries from CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES and + # CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES + # + # - cudart + # - cudart_static + # - cudadevrt + # + # These are controlled by CMAKE_CUDA_RUNTIME_LIBRARY + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt) + list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES cudart cudart_static cudadevrt) + + # Remove the CUDA Toolkit include directories from the set of + # implicit system include directories. + # This resolves the issue that NVCC doesn't specify these + # includes as SYSTEM includes when compiling device code, and sometimes + # they contain headers that generate warnings, so let users mark them + # as SYSTEM explicitly + if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES) + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} + ) + endif() + # Re-configure to save learned information. configure_file( ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index e4f75d5..684edae 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -458,12 +458,13 @@ if(NOT DEFINED CPACK_PACKAGE_VERSION) endif() _cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME} built using CMake") if(CMAKE_PROJECT_DESCRIPTION) _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_DESCRIPTION}") else() _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "${CMAKE_PROJECT_NAME} built using CMake") + "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY}") endif() if(CMAKE_PROJECT_HOMEPAGE_URL) _cpack_set_default(CPACK_PACKAGE_HOMEPAGE_URL @@ -562,11 +563,19 @@ if(NOT CPACK_GENERATOR) if(APPLE) option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) - option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF) - option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF) + option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages (deprecated)" OFF) + option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages (deprecated)" OFF) option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF) + mark_as_advanced( + CPACK_BINARY_BUNDLE + CPACK_BINARY_DRAGNDROP + CPACK_BINARY_OSXX11 + CPACK_BINARY_PACKAGEMAKER + CPACK_BINARY_PRODUCTBUILD + ) else() option(CPACK_BINARY_TZ "Enable to build TZ packages" ON) + mark_as_advanced(CPACK_BINARY_TZ) endif() option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF) option(CPACK_BINARY_FREEBSD "Enable to build FreeBSD packages" OFF) @@ -576,6 +585,16 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF) option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON) option(CPACK_BINARY_TXZ "Enable to build TXZ packages" OFF) + mark_as_advanced( + CPACK_BINARY_DEB + CPACK_BINARY_FREEBSD + CPACK_BINARY_NSIS + CPACK_BINARY_RPM + CPACK_BINARY_STGZ + CPACK_BINARY_TBZ2 + CPACK_BINARY_TGZ + CPACK_BINARY_TXZ + ) endif() else() option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) @@ -583,8 +602,16 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF) option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) + mark_as_advanced( + CPACK_BINARY_7Z + CPACK_BINARY_NSIS + CPACK_BINARY_NUGET + CPACK_BINARY_WIX + CPACK_BINARY_ZIP + ) endif() option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF) + mark_as_advanced(CPACK_BINARY_IFW) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_7Z 7Z) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) @@ -614,6 +641,7 @@ if(NOT CPACK_SOURCE_GENERATOR) if(UNIX) if(CYGWIN) option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON) + mark_as_advanced(CPACK_SOURCE_CYGWIN) else() option(CPACK_SOURCE_RPM "Enable to build RPM source packages" OFF) option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON) @@ -621,10 +649,22 @@ if(NOT CPACK_SOURCE_GENERATOR) option(CPACK_SOURCE_TXZ "Enable to build TXZ source packages" ON) option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF) + mark_as_advanced( + CPACK_SOURCE_RPM + CPACK_SOURCE_TBZ2 + CPACK_SOURCE_TGZ + CPACK_SOURCE_TXZ + CPACK_SOURCE_TZ + CPACK_SOURCE_ZIP + ) endif() else() option(CPACK_SOURCE_7Z "Enable to build 7-Zip source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON) + mark_as_advanced( + CPACK_SOURCE_7Z + CPACK_SOURCE_ZIP + ) endif() cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_7Z 7Z) @@ -637,38 +677,6 @@ if(NOT CPACK_SOURCE_GENERATOR) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP) endif() -# mark the above options as advanced -mark_as_advanced( - CPACK_BINARY_7Z - CPACK_BINARY_BUNDLE - CPACK_BINARY_CYGWIN - CPACK_BINARY_DEB - CPACK_BINARY_DRAGNDROP - CPACK_BINARY_FREEBSD - CPACK_BINARY_IFW - CPACK_BINARY_NSIS - CPACK_BINARY_NUGET - CPACK_BINARY_OSXX11 - CPACK_BINARY_PACKAGEMAKER - CPACK_BINARY_PRODUCTBUILD - CPACK_BINARY_RPM - CPACK_BINARY_STGZ - CPACK_BINARY_TBZ2 - CPACK_BINARY_TGZ - CPACK_BINARY_TXZ - CPACK_BINARY_TZ - CPACK_BINARY_WIX - CPACK_BINARY_ZIP - CPACK_SOURCE_7Z - CPACK_SOURCE_CYGWIN - CPACK_SOURCE_RPM - CPACK_SOURCE_TBZ2 - CPACK_SOURCE_TGZ - CPACK_SOURCE_TXZ - CPACK_SOURCE_TZ - CPACK_SOURCE_ZIP - ) - # Set some other variables _cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/") diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 1a51bc8..8109108 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -243,7 +243,6 @@ if(BUILD_TESTING) mark_as_advanced( BZRCOMMAND - BZR_UPDATE_OPTIONS COVERAGE_COMMAND COVERAGE_EXTRA_FLAGS CTEST_SUBMIT_RETRY_DELAY @@ -257,13 +256,10 @@ if(BUILD_TESTING) MAKECOMMAND MEMORYCHECK_COMMAND MEMORYCHECK_SUPPRESSIONS_FILE - PURIFYCOMMAND - SCPCOMMAND SLURM_SBATCH_COMMAND SLURM_SRUN_COMMAND SITE SVNCOMMAND - SVN_UPDATE_OPTIONS ) if(NOT RUN_FROM_DART) set(RUN_FROM_CTEST_OR_DART 1) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index a337926..997cc8d 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -63,12 +63,18 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" else() set(_D_CMAKE_GENERATOR_INSTANCE "") endif() + if(CMAKE_GENERATOR MATCHES "^(Xcode$|Green Hills MULTI$|Visual Studio)") + set(_D_CMAKE_MAKE_PROGRAM "") + else() + set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") + endif() execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang} COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} -A "${CMAKE_GENERATOR_PLATFORM}" -T "${CMAKE_GENERATOR_TOOLSET}" ${_D_CMAKE_GENERATOR_INSTANCE} + ${_D_CMAKE_MAKE_PROGRAM} OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE result diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 0448965..7c4a263 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -6,6 +6,10 @@ if(APPLE AND NOT appleClangPolicy STREQUAL NEW) return() endif() +if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") +endif() + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 61709f8..cb240f9 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -10,6 +10,9 @@ if(APPLE AND NOT appleClangPolicy STREQUAL NEW) return() endif() +if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl") +endif() if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index e9e59a2..ec3bfd8 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -9,6 +9,8 @@ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index b630a6b..1ed1b08 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -9,6 +9,8 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17") diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index 20787a3..bca9764 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -11,6 +11,8 @@ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") # There is no meaningful default for this set(CMAKE_C_STANDARD_DEFAULT "") +set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") + # There are no C compiler modes so we hard-code the known compiler supported # features. Override the default macro for this special case. Pretend that # all language standards are available so that at least compilation diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 915295d..1dfc760 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -3,6 +3,8 @@ include(Compiler/CMakeCommonCompilerMacros) +set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl") + if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017) diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index fb1fc20..a786fb9 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -43,6 +43,11 @@ endif() set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared) set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=) +set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") + if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "") set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index 9df8269..10e1389 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -10,6 +10,9 @@ macro(__compiler_qcc lang) # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + set(CMAKE_PREFIX_LIBRARY_ARCHITECTURE "ON") + + set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "-Wc,-isysroot,") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") set(CMAKE_DEPFILE_FLAGS_${lang} "-Wp,-MD,<DEPFILE> -Wp,-MT,<OBJECT> -Wp,-MF,<DEPFILE>") diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index dc73f16..9b6d09c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -8,8 +8,9 @@ FindBLAS Find Basic Linear Algebra Subprograms (BLAS) library This module finds an installed Fortran library that implements the -BLAS linear-algebra interface (see http://www.netlib.org/blas/). The -list of libraries searched for is taken from the ``autoconf`` macro file, +BLAS linear-algebra interface (see http://www.netlib.org/blas/). + +The approach follows that taken for the ``autoconf`` macro file, ``acx_blas.m4`` (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). @@ -25,28 +26,29 @@ The following variables may be set to influence this module's behavior: If set, checks only the specified vendor, if not set checks all the possibilities. List of vendors valid in this module: - * Goto - * OpenBLAS - * FLAME - * ATLAS PhiPACK - * CXML - * DXML - * SunPerf - * SCSL - * SGIMATH - * IBMESSL - * Intel10_32 (intel mkl v10 32 bit) - * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) - * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) - * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) - * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) - * Intel (obsolete versions of mkl 32 and 64 bit) - * ACML - * ACML_MP - * ACML_GPU - * Apple - * NAS - * Generic + * ``Goto`` + * ``OpenBLAS`` + * ``FLAME`` + * ``ATLAS PhiPACK`` + * ``CXML`` + * ``DXML`` + * ``SunPerf`` + * ``SCSL`` + * ``SGIMATH`` + * ``IBMESSL`` + * ``Intel10_32`` (intel mkl v10 32 bit) + * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) + * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) + * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) + * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * ``Intel10_64_dyn`` (intel mkl v10+ 64 bit, single dynamic library) + * ``Intel`` (obsolete versions of mkl 32 and 64 bit) + * ``ACML`` + * ``ACML_MP`` + * ``ACML_GPU`` + * ``Apple`` + * ``NAS`` + * ``Generic`` ``BLA_F95`` if ``ON`` tries to find the BLAS95 interfaces @@ -75,7 +77,8 @@ This module defines the following variables: .. note:: - C or CXX must be enabled to use Intel Math Kernel Library (MKL) + C, CXX or Fortran must be enabled to detect a BLAS library. + C or CXX must be enabled to use Intel Math Kernel Library (MKL). For example, to use Intel MKL libraries and/or Intel compiler: @@ -87,22 +90,15 @@ This module defines the following variables: Hints ^^^^^ -Set ``MKLROOT`` environment variable to a directory that contains an MKL -installation. +Set the ``MKLROOT`` environment variable to a directory that contains an MKL +installation, or add the directory to the dynamic library loader environment +variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or +``LD_LIBRARY_PATH``). #]=======================================================================] -include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) - -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - # Check the language being used -if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) +if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED)) if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") else() @@ -111,6 +107,16 @@ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_C endif() endif() +if(CMAKE_Fortran_COMPILER_LOADED) + include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) +endif() +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) + if(BLA_PREFER_PKGCONFIG) find_package(PkgConfig) pkg_check_modules(PKGC_BLAS blas) @@ -121,7 +127,23 @@ if(BLA_PREFER_PKGCONFIG) endif() endif() -macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) +set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() +endif() + +# TODO: move this stuff to a separate module + +macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs) # This macro checks for the existence of the combination of fortran libraries # given by _list. If the combination is found, this macro checks (using the # Check_Fortran_Function_Exists macro) whether can link against that library @@ -132,59 +154,51 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) # N.B. _prefix is the prefix applied to the names of all cached variables that # are generated internally and marked advanced by this macro. - - set(_libdir ${ARGN}) + # _addlibdir is a list of additional search paths. _subdirs is a list of path + # suffixes to be used by find_library(). set(_libraries_work TRUE) set(${LIBRARIES}) set(_combined_name) - if (NOT _libdir) - if (WIN32) - set(_libdir ENV LIB) - elseif (APPLE) - set(_libdir ENV DYLD_LIBRARY_PATH) - else () - set(_libdir ENV LD_LIBRARY_PATH) - endif () - endif () - - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") + + set(_extaddlibdir "${_addlibdir}") + if(WIN32) + list(APPEND _extaddlibdir ENV LIB) + elseif(APPLE) + list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH) + else() + list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH) + endif() + list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - if(NOT "${_thread}" STREQUAL "") - set(_combined_name ${_combined_name}_thread) - endif() - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - PATHS ${_libdir} + if(_library MATCHES "^-Wl,--(start|end)-group$") + # Respect linker flags like --start/end-group (required by MKL) + set(${LIBRARIES} ${${LIBRARIES}} "${_library}") + else() + set(_combined_name ${_combined_name}_${_library}) + if(NOT "${_threadlibs}" STREQUAL "") + set(_combined_name ${_combined_name}_threadlibs) + endif() + if(_libraries_work) + find_library(${_prefix}_${_library}_LIBRARY + NAMES ${_library} + PATHS ${_extaddlibdir} + PATH_SUFFIXES ${_subdirs} ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + #message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}") + mark_as_advanced(${_prefix}_${_library}_LIBRARY) + set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + endif() endif() endforeach() + if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) - # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (CMAKE_Fortran_COMPILER_LOADED) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threadlibs}) + #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) @@ -192,11 +206,12 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) set(CMAKE_REQUIRED_LIBRARIES) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) endif() + if(_libraries_work) if("${_list}" STREQUAL "") set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") else() - set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) # for static link + set(${LIBRARIES} ${${LIBRARIES}} ${_threadlibs}) endif() else() set(${LIBRARIES} FALSE) @@ -207,91 +222,96 @@ endmacro() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) -if (NOT $ENV{BLA_VENDOR} STREQUAL "") +if(NOT $ENV{BLA_VENDOR} STREQUAL "") set(BLA_VENDOR $ENV{BLA_VENDOR}) -else () +else() if(NOT BLA_VENDOR) set(BLA_VENDOR "All") endif() -endif () +endif() -if (BLA_VENDOR STREQUAL "All") +# Implicitly linked BLAS libraries? +if(BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - # Implicitly linked BLAS libraries - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "" "" + "" + "" ) endif() -endif () - -#BLAS in intel mkl 10+ library? (em64t 64bit) -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if (NOT BLAS_LIBRARIES) +endif() - # System-specific settings - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - else() - # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it) - if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) - set(BLAS_mkl_INTFACE "gf") - set(BLAS_mkl_THREADING "gnu") - set(BLAS_mkl_OMP "gomp") +# BLAS in the Intel MKL 10+ library? +if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) + # System-specific settings + if(WIN32) + if(BLA_STATIC) + set(BLAS_mkl_DLL_SUFFIX "") + else() + set(BLAS_mkl_DLL_SUFFIX "_dll") + endif() else() - set(BLAS_mkl_INTFACE "intel") - set(BLAS_mkl_THREADING "intel") - set(BLAS_mkl_OMP "iomp5") + if(BLA_STATIC) + set(BLAS_mkl_START_GROUP "-Wl,--start-group") + set(BLAS_mkl_END_GROUP "-Wl,--end-group") + else() + set(BLAS_mkl_START_GROUP "") + set(BLAS_mkl_END_GROUP "") + endif() + # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it) + if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) + set(BLAS_mkl_INTFACE "gf") + set(BLAS_mkl_THREADING "gnu") + set(BLAS_mkl_OMP "gomp") + else() + set(BLAS_mkl_INTFACE "intel") + set(BLAS_mkl_THREADING "intel") + set(BLAS_mkl_OMP "iomp5") + endif() + set(BLAS_mkl_LM "-lm") + set(BLAS_mkl_LDL "-ldl") endif() - set(BLAS_mkl_LM "-lm") - set(BLAS_mkl_LDL "-ldl") - endif() - - if (BLA_VENDOR MATCHES "_64ilp") - set(BLAS_mkl_ILP_MODE "ilp64") - else () - set(BLAS_mkl_ILP_MODE "lp64") - endif () - if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) else() find_package(Threads REQUIRED) endif() + if(BLA_VENDOR MATCHES "_64ilp") + set(BLAS_mkl_ILP_MODE "ilp64") + else() + set(BLAS_mkl_ILP_MODE "lp64") + endif() + set(BLAS_SEARCH_LIBS "") if(BLA_F95) - set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95) + set(BLAS_mkl_SEARCH_SYMBOL "sgemm_f95") set(_LIBRARIES BLAS95_LIBRARIES) - if (WIN32) + if(WIN32) # Find the main file (32-bit or 64-bit) set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") + + if(BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX} mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}") - endif () + endif() # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -299,56 +319,60 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") endif() + if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD + "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") + endif() # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) + foreach(MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) + foreach(THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) list(APPEND BLAS_SEARCH_LIBS "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") endforeach() endforeach() - else () - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + else() + if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") + "${BLAS_mkl_START_GROUP} mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + endif() + if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") + "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + endif() + if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core") - endif () - endif () - else () + "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core ${BLAS_mkl_END_GROUP}") + endif() + endif() + else() set(BLAS_mkl_SEARCH_SYMBOL sgemm) set(_LIBRARIES BLAS_LIBRARIES) - if (WIN32) + if(WIN32) # Find the main file (32-bit or 64-bit) set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}") - endif () + endif() # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -356,96 +380,118 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") endif() # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) + foreach(MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) + foreach(THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) list(APPEND BLAS_SEARCH_LIBS "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") endforeach() endforeach() - else () - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + else() + if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") + "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + endif() + if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") + "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + endif() + if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core") - endif () + "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core ${BLAS_mkl_END_GROUP}") + endif() #older vesions of intel mkl libs - if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS "mkl") list(APPEND BLAS_SEARCH_LIBS "mkl_ia32") list(APPEND BLAS_SEARCH_LIBS "mkl_em64t") - endif () - endif () - endif () - - if (DEFINED ENV{MKLROOT}) - if (BLA_VENDOR STREQUAL "Intel10_32") - set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/ia32") - elseif (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$") - set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/intel64") - endif () - endif () - if (_BLAS_MKLROOT_LIB_DIR) - if (WIN32) - string(APPEND _BLAS_MKLROOT_LIB_DIR "_win") - elseif (APPLE) - string(APPEND _BLAS_MKLROOT_LIB_DIR "_mac") - else () - string(APPEND _BLAS_MKLROOT_LIB_DIR "_lin") - endif () - endif () - - foreach (IT ${BLAS_SEARCH_LIBS}) + endif() + endif() + endif() + + if(BLA_VENDOR MATCHES "^Intel10_64_dyn$" OR BLA_VENDOR STREQUAL "All") + # mkl >= 10.3 with single dynamic library + list(APPEND BLAS_SEARCH_LIBS + "mkl_rt") + endif() + + # MKL uses a multitude of partially platform-specific subdirectories: + if(BLA_VENDOR STREQUAL "Intel10_32") + set(BLAS_mkl_ARCH_NAME "ia32") + else() + set(BLAS_mkl_ARCH_NAME "intel64") + endif() + if(WIN32) + set(BLAS_mkl_OS_NAME "win") + elseif(APPLE) + set(BLAS_mkl_OS_NAME "mac") + else() + set(BLAS_mkl_OS_NAME "lin") + endif() + if(DEFINED ENV{MKLROOT}) + set(BLAS_mkl_MKLROOT "$ENV{MKLROOT}") + # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead + # so we can better detect other relevant libraries in 'compiler' or 'tbb': + get_filename_component(BLAS_mkl_MKLROOT_LAST_DIR "${BLAS_mkl_MKLROOT}" NAME) + if(BLAS_mkl_MKLROOT_LAST_DIR STREQUAL "mkl") + get_filename_component(BLAS_mkl_MKLROOT "${BLAS_mkl_MKLROOT}" DIRECTORY) + endif() + endif() + set(BLAS_mkl_LIB_PATH_SUFFIXES + "compiler/lib" "compiler/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}" + "mkl/lib" "mkl/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}" + "lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}") + + foreach(IT ${BLAS_SEARCH_LIBS}) string(REPLACE " " ";" SEARCH_LIBS ${IT}) - if (NOT ${_LIBRARIES}) - check_fortran_libraries( + if(NOT ${_LIBRARIES}) + check_blas_libraries( ${_LIBRARIES} BLAS ${BLAS_mkl_SEARCH_SYMBOL} "" "${SEARCH_LIBS}" "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}" - "${_BLAS_MKLROOT_LIB_DIR}" + "${BLAS_mkl_MKLROOT}" + "${BLAS_mkl_LIB_PATH_SUFFIXES}" ) - endif () - endforeach () - - endif () - unset(BLAS_mkl_ILP_MODE) - unset(BLAS_mkl_INTFACE) - unset(BLAS_mkl_THREADING) - unset(BLAS_mkl_OMP) - unset(BLAS_mkl_DLL_SUFFIX) - unset(BLAS_mkl_LM) - unset(BLAS_mkl_LDL) - endif () -endif () + endif() + endforeach() + + unset(BLAS_mkl_ILP_MODE) + unset(BLAS_mkl_INTFACE) + unset(BLAS_mkl_THREADING) + unset(BLAS_mkl_OMP) + unset(BLAS_mkl_DLL_SUFFIX) + unset(BLAS_mkl_LM) + unset(BLAS_mkl_LDL) + unset(BLAS_mkl_MKLROOT) + unset(BLAS_mkl_MKLROOT_LAST_DIR) + unset(BLAS_mkl_ARCH_NAME) + unset(BLAS_mkl_OS_NAME) + unset(BLAS_mkl_LIB_PATH_SUFFIXES) + endif() + endif() +endif() if(BLA_F95) find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES) @@ -455,30 +501,34 @@ if(BLA_F95) endif() endif() -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") +# gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) +if(BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "goto2" "" + "" + "" ) endif() -endif () +endif() -if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") +# OpenBLAS? (http://www.openblas.net) +if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - # OpenBLAS (http://www.openblas.net) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "openblas" "" + "" + "" ) endif() if(NOT BLAS_LIBRARIES AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)) @@ -487,246 +537,265 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") else() find_package(Threads REQUIRED) endif() - # OpenBLAS (http://www.openblas.net) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "openblas" "${CMAKE_THREAD_LIBS_INIT}" + "" + "" ) endif() -endif () +endif() -if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") +# FLAME's blis library? (https://github.com/flame/blis) +if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - # FLAME's blis library (https://github.com/flame/blis) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "blis" "" + "" + "" ) endif() -endif () +endif() -if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") +# BLAS in the ATLAS library? (http://math-atlas.sourceforge.net/) +if(BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS dgemm "" "blas;f77blas;atlas" "" + "" + "" ) endif() -endif () +endif() # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "sgemm;dgemm;blas" "" + "" + "" ) endif() -endif () +endif() # BLAS in Alpha CXML library? -if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "cxml" "" + "" + "" ) endif() -endif () +endif() # BLAS in Alpha DXML library? (now called CXML, see above) -if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "dxml" "" + "" + "" ) endif() -endif () +endif() # BLAS in Sun Performance library? -if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "-xlic_lib=sunperf" "sunperf;sunmath" "" + "" + "" ) if(BLAS_LIBRARIES) set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") endif() endif() -endif () +endif() # BLAS in SCSL library? (SGI/Cray Scientific Library) -if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "scsl" "" + "" + "" ) endif() -endif () +endif() # BLAS in SGIMATH library? -if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "complib.sgimath" "" + "" + "" ) endif() -endif () +endif() # BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "essl;blas" "" + "" + "" ) endif() -endif () +endif() -#BLAS in acml library? -if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR +# BLAS in acml library? +if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") + if(((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) ) # try to find acml in "standard" paths - if( WIN32 ) - file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) + if(WIN32) + file(GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt") else() - file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) + file(GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt") endif() - if( WIN32 ) - file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) + if(WIN32) + file(GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples") else() - file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) + file(GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples") endif() list(GET _ACML_ROOT 0 _ACML_ROOT) list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) - if( _ACML_ROOT ) - get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) - if( SIZEOF_INTEGER EQUAL 8 ) - set( _ACML_PATH_SUFFIX "_int64" ) + if(_ACML_ROOT) + get_filename_component(_ACML_ROOT ${_ACML_ROOT} PATH) + if(SIZEOF_INTEGER EQUAL 8) + set(_ACML_PATH_SUFFIX "_int64") else() - set( _ACML_PATH_SUFFIX "" ) + set(_ACML_PATH_SUFFIX "") endif() - if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) - set( _ACML_COMPILER32 "ifort32" ) - set( _ACML_COMPILER64 "ifort64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) - set( _ACML_COMPILER32 "sun32" ) - set( _ACML_COMPILER64 "sun64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) - set( _ACML_COMPILER32 "pgi32" ) - if( WIN32 ) - set( _ACML_COMPILER64 "win64" ) + if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + set(_ACML_COMPILER32 "ifort32") + set(_ACML_COMPILER64 "ifort64") + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro") + set(_ACML_COMPILER32 "sun32") + set(_ACML_COMPILER64 "sun64") + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI") + set(_ACML_COMPILER32 "pgi32") + if(WIN32) + set(_ACML_COMPILER64 "win64") else() - set( _ACML_COMPILER64 "pgi64" ) + set(_ACML_COMPILER64 "pgi64") endif() - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Open64") # 32 bit builds not supported on Open64 but for code simplicity # We'll just use the same directory twice - set( _ACML_COMPILER32 "open64_64" ) - set( _ACML_COMPILER64 "open64_64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) - set( _ACML_COMPILER32 "nag32" ) - set( _ACML_COMPILER64 "nag64" ) + set(_ACML_COMPILER32 "open64_64") + set(_ACML_COMPILER64 "open64_64") + elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") + set(_ACML_COMPILER32 "nag32") + set(_ACML_COMPILER64 "nag64") else() - set( _ACML_COMPILER32 "gfortran32" ) - set( _ACML_COMPILER64 "gfortran64" ) + set(_ACML_COMPILER32 "gfortran32") + set(_ACML_COMPILER64 "gfortran64") endif() - if( BLA_VENDOR STREQUAL "ACML_MP" ) + if(BLA_VENDOR STREQUAL "ACML_MP") set(_ACML_MP_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) + "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib") else() set(_ACML_LIB_DIRS "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) + "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib") endif() endif() elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) endif() -if( BLA_VENDOR STREQUAL "ACML_MP" ) - foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) - check_fortran_libraries ( +if(BLA_VENDOR STREQUAL "ACML_MP") + foreach(BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm - "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} + "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} "" ) - if( BLAS_LIBRARIES ) + if(BLAS_LIBRARIES) break() endif() endforeach() -elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) - foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) - check_fortran_libraries ( +elseif(BLA_VENDOR STREQUAL "ACML_GPU") + foreach(BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm - "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} + "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} "" ) - if( BLAS_LIBRARIES ) + if(BLAS_LIBRARIES) break() endif() endforeach() else() - foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) - check_fortran_libraries ( + foreach(BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS}) + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm - "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} + "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} "" ) - if( BLAS_LIBRARIES ) + if(BLAS_LIBRARIES) break() endif() endforeach() @@ -734,77 +803,90 @@ endif() # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv" "" + "" + "" ) endif() if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml_mp;acml_mv" "" + "" + "" ) endif() if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "acml;acml_mv;CALBLAS" "" + "" + "" ) endif() -endif () # ACML +endif() # ACML # Apple BLAS library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS dgemm "" "Accelerate" "" + "" + "" ) endif() -endif () +endif() -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT BLAS_LIBRARIES ) - check_fortran_libraries( +# Apple NAS (vecLib) library? +if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + if(NOT BLAS_LIBRARIES) + check_blas_libraries( BLAS_LIBRARIES BLAS dgemm "" "vecLib" "" + "" + "" ) - endif () -endif () + endif() +endif() # Generic BLAS library? -if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") +if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) - check_fortran_libraries( + check_blas_libraries( BLAS_LIBRARIES BLAS sgemm "" "blas" "" + "" + "" ) endif() -endif () +endif() if(NOT BLA_F95) find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES) @@ -812,7 +894,7 @@ endif() # On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines) # we used a placeholder for empty BLAS_LIBRARIES to get through our logic above. -if (BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") +if(BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") set(BLAS_LIBRARIES "") endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0e84fab..3c52466 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -248,6 +248,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # Save project's policies cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var) function(_boost_get_existing_target component target_var) set(names "${component}") @@ -441,7 +442,9 @@ if (NOT Boost_NO_BOOST_CMAKE) # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no # need to delegate them to this find_package call. find_package(Boost QUIET NO_MODULE) - mark_as_advanced(Boost_DIR) + if (DEFINED Boost_DIR) + mark_as_advanced(Boost_DIR) + endif () # If we found a boost cmake package, then we're done. Print out what we found. # Otherwise let the rest of the module try to find it. @@ -1467,43 +1470,6 @@ _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_ADDITIONAL_VERSIONS") _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_NO_SYSTEM_PATHS") -# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It -# will only contain any interface definitions on WIN32, but is created -# on all platforms to keep end user code free from platform dependent -# code. Also provide convenience targets to disable autolinking and -# enable dynamic linking. -if(NOT TARGET Boost::diagnostic_definitions) - add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) - add_library(Boost::disable_autolinking INTERFACE IMPORTED) - add_library(Boost::dynamic_linking INTERFACE IMPORTED) - set_target_properties(Boost::dynamic_linking PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") -endif() -if(WIN32) - # In windows, automatic linking is performed, so you do not have - # to specify the libraries. If you are linking to a dynamic - # runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You - # can alter this for a specific library "whatever" by defining - # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be - # linked dynamically. Alternatively you can force all Boost - # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by - # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining - # BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against - # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking - # code to emit a #pragma message each time a library is selected - # for linking. - set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") - set_target_properties(Boost::diagnostic_definitions PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") - set_target_properties(Boost::disable_autolinking PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") -endif() - cmake_policy(GET CMP0074 _Boost_CMP0074) if(NOT "x${_Boost_CMP0074}x" STREQUAL "xNEWx") _Boost_CHECK_SPELLING(Boost_ROOT) @@ -2296,6 +2262,43 @@ if(Boost_FOUND) endif() endif() endforeach() + + # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It + # will only contain any interface definitions on WIN32, but is created + # on all platforms to keep end user code free from platform dependent + # code. Also provide convenience targets to disable autolinking and + # enable dynamic linking. + if(NOT TARGET Boost::diagnostic_definitions) + add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) + add_library(Boost::disable_autolinking INTERFACE IMPORTED) + add_library(Boost::dynamic_linking INTERFACE IMPORTED) + set_target_properties(Boost::dynamic_linking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") + endif() + if(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::diagnostic_definitions PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::disable_autolinking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + endif() endif() # ------------------------------------------------------------------------ diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index f7f68ca..f251b41 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -105,6 +105,7 @@ of the following libraries that are part of the CUDAToolkit: - :ref:`cuRAND<cuda_toolkit_cuRAND>` - :ref:`cuSOLVER<cuda_toolkit_cuSOLVER>` - :ref:`cuSPARSE<cuda_toolkit_cuSPARSE>` +- :ref:`cuPTI<cuda_toolkit_cupti>` - :ref:`NPP<cuda_toolkit_NPP>` - :ref:`nvBLAS<cuda_toolkit_nvBLAS>` - :ref:`nvGRAPH<cuda_toolkit_nvGRAPH>` @@ -202,6 +203,18 @@ Targets Created: - ``CUDA::cusparse`` - ``CUDA::cusparse_static`` +.. _`cuda_toolkit_cupti`: + +cupti +""""" + +The `NVIDIA CUDA Profiling Tools Interface <https://developer.nvidia.com/CUPTI>`_. + +Targets Created: + +- ``CUDA::cupti`` +- ``CUDA::cupti_static`` + .. _`cuda_toolkit_NPP`: NPP @@ -333,8 +346,6 @@ Targets Created: - ``CUDA::nvml`` -.. _`cuda_toolkit_opencl`: - .. _`cuda_toolkit_nvToolsExt`: nvToolsExt @@ -347,6 +358,8 @@ Targets Created: - ``CUDA::nvToolsExt`` +.. _`cuda_toolkit_opencl`: + OpenCL """""" @@ -408,6 +421,11 @@ Result variables The path to the CUDA Toolkit library directory that contains the CUDA Runtime library ``cudart``. +``CUDAToolkit_TARGET_DIR`` + The path to the CUDA Toolkit directory including the target architecture + when cross-compiling. When not cross-compiling this will be equivalant to + ``CUDAToolkit_ROOT_DIR``. + ``CUDAToolkit_NVCC_EXECUTABLE`` The path to the NVIDIA CUDA compiler ``nvcc``. Note that this path may **not** be the same as @@ -641,8 +659,47 @@ endif() get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE) -# Now that we have the real ROOT_DIR, find components inside it. -list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR}) +# Handle cross compilation +if(CMAKE_CROSSCOMPILING) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") + # Support for NVPACK + set (CUDAToolkit_TARGET_NAME "armv7-linux-androideabi") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") + # Support for arm cross compilation + set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + # Support for aarch64 cross compilation + if (ANDROID_ARCH_NAME STREQUAL "arm64") + set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi") + else() + set(CUDAToolkit_TARGET_NAME "aarch64-linux") + endif (ANDROID_ARCH_NAME STREQUAL "arm64") + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(CUDAToolkit_TARGET_NAME "x86_64-linux") + endif() + + if (EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + # add known CUDA target root path to the set of directories we search for programs, libraries and headers + list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}") + + # Mark that we need to pop the root search path changes after we have + # found all cuda libraries so that searches for our cross-compilation + # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or + # PATh + set(_CUDAToolkit_Pop_ROOT_PATH True) + endif() +else() + # Not cross compiling + set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}") + # Now that we have the real ROOT_DIR, find components inside it. + list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR}) + + # Mark that we need to pop the prefix path changes after we have + # found the cudart library. + set(_CUDAToolkit_Pop_Prefix True) +endif() + # Find the include/ directory find_path(CUDAToolkit_INCLUDE_DIR @@ -652,14 +709,17 @@ find_path(CUDAToolkit_INCLUDE_DIR # And find the CUDA Runtime Library libcudart find_library(CUDA_CUDART NAMES cudart - PATH_SUFFIXES lib64 lib/x64 + PATH_SUFFIXES lib64 lib64/stubs lib/x64 ) if (NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY) message(STATUS "Unable to find cudart library.") endif() unset(CUDAToolkit_ROOT_DIR) -list(REMOVE_AT CMAKE_PREFIX_PATH -1) +if(_CUDAToolkit_Pop_Prefix) + list(REMOVE_AT CMAKE_PREFIX_PATH -1) + unset(_CUDAToolkit_Pop_Prefix) +endif() #----------------------------------------------------------------------------- # Perform version comparison and validate all required variables are set. @@ -684,77 +744,102 @@ endif() # Construct import targets if(CUDAToolkit_FOUND) - function(find_and_add_cuda_import_lib lib_name) + function(_CUDAToolkit_find_and_add_import_lib lib_name) + cmake_parse_arguments(arg "" "" "ALT;DEPS;EXTRA_PATH_SUFFIXES" ${ARGN}) - if(ARGC GREATER 1) - set(search_names ${ARGN}) - else() - set(search_names ${lib_name}) - endif() + set(search_names ${lib_name} ${arg_ALT}) + message(STATUS "arg_EXTRA_PATH_SUFFIXES: ${arg_EXTRA_PATH_SUFFIXES}") find_library(CUDA_${lib_name}_LIBRARY NAMES ${search_names} - PATHS ${CUDAToolkit_LIBRARY_DIR} + HINTS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH - PATH_SUFFIXES nvidia/current lib64 lib/x64 lib + PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs + ${arg_EXTRA_PATH_SUFFIXES} ) - if (NOT CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) + if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) add_library(CUDA::${lib_name} IMPORTED INTERFACE) target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") target_link_libraries(CUDA::${lib_name} INTERFACE "${CUDA_${lib_name}_LIBRARY}") - endif() - endfunction() - - function(add_cuda_link_dependency lib_name) - if(TARGET CUDA::${lib_name}) - foreach(dependency IN LISTS ARGN) - if(TARGET CUDA::${dependency}) - target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dependency}) + foreach(dep ${arg_DEPS}) + if(TARGET CUDA::${dep}) + target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dep}) endif() endforeach() endif() endfunction() - add_library(CUDA::toolkit IMPORTED INTERFACE) - target_include_directories(CUDA::toolkit SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") - target_link_directories(CUDA::toolkit INTERFACE "${CUDAToolkit_LIBRARY_DIR}") + if(NOT TARGET CUDA::toolkit) + add_library(CUDA::toolkit IMPORTED INTERFACE) + target_include_directories(CUDA::toolkit SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") + target_link_directories(CUDA::toolkit INTERFACE "${CUDAToolkit_LIBRARY_DIR}") + endif() + _CUDAToolkit_find_and_add_import_lib(cuda_driver ALT cuda) - find_and_add_cuda_import_lib(cuda_driver cuda) + _CUDAToolkit_find_and_add_import_lib(cudart) + _CUDAToolkit_find_and_add_import_lib(cudart_static) - find_and_add_cuda_import_lib(cudart) - find_and_add_cuda_import_lib(cudart_static) + # setup dependencies that are required for cudart_static when building + # on linux. These are generally only required when using the CUDA toolkit + # when CUDA language is disabled + if(NOT TARGET CUDA::cudart_static_deps + AND TARGET CUDA::cudart_static) - foreach (cuda_lib cublas cufft cufftw curand cusolver cusparse nvgraph nvjpeg) - find_and_add_cuda_import_lib(${cuda_lib}) + add_library(CUDA::cudart_static_deps IMPORTED INTERFACE) + target_link_libraries(CUDA::cudart_static INTERFACE CUDA::cudart_static_deps) - find_and_add_cuda_import_lib(${cuda_lib}_static) + if(UNIX AND (CMAKE_C_COMPILER OR CMAKE_CXX_COMPILER)) + find_package(Threads REQUIRED) + target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS}) + endif() + + if(UNIX AND NOT APPLE) + # On Linux, you must link against librt when using the static cuda runtime. + find_library(CUDAToolkit_rt_LIBRARY rt) + if(NOT CUDAToolkit_rt_LIBRARY) + message(WARNING "Could not find librt library, needed by CUDA::cudart_static") + else() + target_link_libraries(CUDA::cudart_static_deps INTERFACE ${CUDAToolkit_rt_LIBRARY}) + endif() + endif() + endif() + + _CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library + foreach (cuda_lib cublas cufft curand cusparse nppc nvjpeg) + _CUDAToolkit_find_and_add_import_lib(${cuda_lib}) + _CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos) endforeach() + # cuFFTW depends on cuFFT + _CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft) + _CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft_static) + # cuSOLVER depends on cuBLAS, and cuSPARSE - add_cuda_link_dependency(cusolver cublas cusparse) - add_cuda_link_dependency(cusolver_static cublas_static cusparse) + _CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse) + _CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos) # nvGRAPH depends on cuRAND, and cuSOLVER. - add_cuda_link_dependency(nvgraph curand cusolver) - add_cuda_link_dependency(nvgraph_static curand_static cusolver_static) - - find_and_add_cuda_import_lib(nppc) - find_and_add_cuda_import_lib(nppc_static) + _CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver) + _CUDAToolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static) # Process the majority of the NPP libraries. foreach (cuda_lib nppial nppicc nppidei nppif nppig nppim nppist nppitc npps nppicom nppisu) - find_and_add_cuda_import_lib(${cuda_lib}) - find_and_add_cuda_import_lib(${cuda_lib}_static) - add_cuda_link_dependency(${cuda_lib} nppc) - add_cuda_link_dependency(${cuda_lib}_static nppc_static) + _CUDAToolkit_find_and_add_import_lib(${cuda_lib} DEPS nppc) + _CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS nppc_static) endforeach() - find_and_add_cuda_import_lib(nvrtc) - add_cuda_link_dependency(nvrtc cuda_driver) + _CUDAToolkit_find_and_add_import_lib(cupti + EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ + ../extras/CUPTI/lib/) + _CUDAToolkit_find_and_add_import_lib(cupti_static + EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ + ../extras/CUPTI/lib/) - find_and_add_cuda_import_lib(nvml nvidia-ml nvml) + _CUDAToolkit_find_and_add_import_lib(nvrtc DEPS cuda_driver) + + _CUDAToolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml) if(WIN32) # nvtools can be installed outside the CUDA toolkit directory @@ -767,15 +852,12 @@ if(CUDAToolkit_FOUND) PATH_SUFFIXES lib/x64 lib ) endif() - find_and_add_cuda_import_lib(nvToolsExt nvToolsExt nvToolsExt64) - - find_and_add_cuda_import_lib(OpenCL) + _CUDAToolkit_find_and_add_import_lib(nvToolsExt ALT nvToolsExt64) - find_and_add_cuda_import_lib(culibos) - if(TARGET CUDA::culibos) - foreach (cuda_lib cublas cufft cusparse curand nppc nvjpeg) - add_cuda_link_dependency(${cuda_lib}_static culibos) - endforeach() - endif() + _CUDAToolkit_find_and_add_import_lib(OpenCL) +endif() +if(_CUDAToolkit_Pop_ROOT_PATH) + list(REMOVE_AT CMAKE_FIND_ROOT_PATH 0) + unset(_CUDAToolkit_Pop_ROOT_PATH) endif() diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index e3e7273..ba56078 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -159,6 +159,10 @@ if(CURSES_USE_NCURSES) if(NOT CURSES_NCURSES_HAS_CBREAK) find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}") find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" ) + + mark_as_advanced( + CURSES_EXTRA_LIBRARY + ) endif() else() get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) @@ -262,6 +266,5 @@ mark_as_advanced( CURSES_INCLUDE_PATH CURSES_CURSES_LIBRARY CURSES_NCURSES_LIBRARY - CURSES_EXTRA_LIBRARY CURSES_FORM_LIBRARY ) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index e015a98..53cab1a 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -240,4 +240,15 @@ if(GTEST_FOUND) __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE") __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG") endif() + + # Add targets mapping the same library names as defined in + # GTest's CMake package config. + if(NOT TARGET GTest::gtest) + add_library(GTest::gtest INTERFACE IMPORTED) + target_link_libraries(GTest::gtest INTERFACE GTest::GTest) + endif() + if(NOT TARGET GTest::gtest_main) + add_library(GTest::gtest_main INTERFACE IMPORTED) + target_link_libraries(GTest::gtest_main INTERFACE GTest::Main) + endif() endif() diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 3cb3653..c962976 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -7,10 +7,10 @@ FindLAPACK Find Linear Algebra PACKage (LAPACK) library -This module finds an installed fortran library that implements the +This module finds an installed Fortran library that implements the LAPACK linear-algebra interface (see http://www.netlib.org/lapack/). -The approach follows that taken for the autoconf macro file, +The approach follows that taken for the ``autoconf`` macro file, ``acx_lapack.m4`` (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). @@ -26,21 +26,22 @@ The following variables may be set to influence this module's behavior: If set, checks only the specified vendor, if not set checks all the possibilities. List of vendors valid in this module: + * ``OpenBLAS`` + * ``FLAME`` * ``Intel10_32`` (intel mkl v10 32 bit) * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * ``Intel10_64_dyn`` (intel mkl v10+ 64 bit, single dynamic library) * ``Intel`` (obsolete versions of mkl 32 and 64 bit) - * ``OpenBLAS`` - * ``FLAME`` * ``ACML`` * ``Apple`` * ``NAS`` * ``Generic`` ``BLA_F95`` - if ``ON`` tries to find BLAS95/LAPACK95 + if ``ON`` tries to find the BLAS95/LAPACK95 interfaces Result Variables ^^^^^^^^^^^^^^^^ @@ -50,7 +51,7 @@ This module defines the following variables: ``LAPACK_FOUND`` library implementing the LAPACK interface is found ``LAPACK_LINKER_FLAGS`` - uncached list of required linker flags (excluding -l and -L). + uncached list of required linker flags (excluding ``-l`` and ``-L``). ``LAPACK_LIBRARIES`` uncached list of libraries (using full path name) to link against to use LAPACK @@ -62,7 +63,8 @@ This module defines the following variables: .. note:: - C or CXX must be enabled to use Intel MKL + C, CXX or Fortran must be enabled to detect a BLAS/LAPACK library. + C or CXX must be enabled to use Intel Math Kernel Library (MKL). For example, to use Intel MKL libraries and/or Intel compiler: @@ -72,10 +74,8 @@ This module defines the following variables: find_package(LAPACK) #]=======================================================================] -set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - # Check the language being used -if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) +if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED)) if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.") else() @@ -84,11 +84,11 @@ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_C endif() endif() -if (CMAKE_Fortran_COMPILER_LOADED) -include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) -else () -include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) -endif () +if(CMAKE_Fortran_COMPILER_LOADED) + include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) +endif() include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() @@ -97,290 +97,344 @@ set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) -# TODO: move this stuff to separate module - -macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(_combined_name) -if (NOT _libdir) - if (WIN32) - set(_libdir ENV LIB) - elseif (APPLE) - set(_libdir ENV DYLD_LIBRARY_PATH) - else () - set(_libdir ENV LD_LIBRARY_PATH) - endif () -endif () - -list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) +set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() +endif() + +# TODO: move this stuff to a separate module + +macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs _blas) + # This macro checks for the existence of the combination of fortran libraries + # given by _list. If the combination is found, this macro checks (using the + # Check_Fortran_Function_Exists macro) whether can link against that library + # combination using the name of a routine given by _name using the linker + # flags given by _flags. If the combination of libraries is found and passes + # the link test, LIBRARIES is set to the list of complete library paths that + # have been found. Otherwise, LIBRARIES is set to FALSE. + + # N.B. _prefix is the prefix applied to the names of all cached variables that + # are generated internally and marked advanced by this macro. + # _addlibdir is a list of additional search paths. _subdirs is a list of path + # suffixes to be used by find_library(). + + set(_libraries_work TRUE) + set(${LIBRARIES}) + set(_combined_name) + + set(_extaddlibdir "${_addlibdir}") + if(WIN32) + list(APPEND _extaddlibdir ENV LIB) + elseif(APPLE) + list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH) + else() + list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH) + endif() + list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") + + foreach(_library ${_list}) + if(_library MATCHES "^-Wl,--(start|end)-group$") + # Respect linker flags like --start/end-group (required by MKL) + set(${LIBRARIES} ${${LIBRARIES}} "${_library}") + else() + set(_combined_name ${_combined_name}_${_library}) + if(_libraries_work) + find_library(${_prefix}_${_library}_LIBRARY + NAMES ${_library} + PATHS ${_extaddlibdir} + PATH_SUFFIXES ${_subdirs} + ) + #message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}") + mark_as_advanced(${_prefix}_${_library}_LIBRARY) + set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + endif() + endif() + endforeach() if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - PATHS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + # Test this combination of libraries. + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threadlibs}) + #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + if(CMAKE_Fortran_COMPILER_LOADED) + check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) + else() + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + endif() + set(CMAKE_REQUIRED_LIBRARIES) + set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) endif() -endforeach() -if(_libraries_work) - # Test this combination of libraries. - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) + if(_libraries_work) + if("${_list}${_blas}" STREQUAL "") + set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") + else() + set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threadlibs}) + endif() else() - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) + set(${LIBRARIES} FALSE) endif() -# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (NOT CMAKE_Fortran_COMPILER_LOADED) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else () - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif () - set(CMAKE_REQUIRED_LIBRARIES) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endif() - - if(_libraries_work) - if("${_list}${_blas}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") - else() - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) - endif() - else() - set(${LIBRARIES} FALSE) - endif() - endmacro() - set(LAPACK_LINKER_FLAGS) set(LAPACK_LIBRARIES) set(LAPACK95_LIBRARIES) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_package(BLAS) else() find_package(BLAS REQUIRED) endif() - if(BLAS_FOUND) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if (NOT $ENV{BLA_VENDOR} STREQUAL "") + if(NOT $ENV{BLA_VENDOR} STREQUAL "") set(BLA_VENDOR $ENV{BLA_VENDOR}) - else () + else() if(NOT BLA_VENDOR) set(BLA_VENDOR "All") endif() - endif () - -#intel lapack -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - if (NOT WIN32) - set(LAPACK_mkl_LM "-lm") - set(LAPACK_mkl_LDL "-ldl") - endif () - if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_PACKAGE(Threads) - else() - find_package(Threads REQUIRED) + endif() + + # LAPACK in the Intel MKL 10+ library? + if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) + # System-specific settings + if(NOT WIN32) + set(LAPACK_mkl_LM "-lm") + set(LAPACK_mkl_LDL "-ldl") + endif() + + if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(Threads) + else() + find_package(Threads REQUIRED) + endif() + + if(BLA_VENDOR MATCHES "_64ilp") + set(LAPACK_mkl_ILP_MODE "ilp64") + else() + set(LAPACK_mkl_ILP_MODE "lp64") + endif() + + set(LAPACK_SEARCH_LIBS "") + + if(BLA_F95) + set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95") + set(_LIBRARIES LAPACK95_LIBRARIES) + set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) + + # old + list(APPEND LAPACK_SEARCH_LIBS + "mkl_lapack95") + # new >= 10.3 + list(APPEND LAPACK_SEARCH_LIBS + "mkl_intel_c") + list(APPEND LAPACK_SEARCH_LIBS + "mkl_lapack95_${LAPACK_mkl_ILP_MODE}") + else() + set(LAPACK_mkl_SEARCH_SYMBOL "cheev") + set(_LIBRARIES LAPACK_LIBRARIES) + set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) + + # old and new >= 10.3 + list(APPEND LAPACK_SEARCH_LIBS + "mkl_lapack") + endif() + + # MKL uses a multitude of partially platform-specific subdirectories: + if(BLA_VENDOR STREQUAL "Intel10_32") + set(LAPACK_mkl_ARCH_NAME "ia32") + else() + set(LAPACK_mkl_ARCH_NAME "intel64") + endif() + if(WIN32) + set(LAPACK_mkl_OS_NAME "win") + elseif(APPLE) + set(LAPACK_mkl_OS_NAME "mac") + else() + set(LAPACK_mkl_OS_NAME "lin") + endif() + if(DEFINED ENV{MKLROOT}) + set(LAPACK_mkl_MKLROOT "$ENV{MKLROOT}") + # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead + # so we can better detect other relevant libraries in 'compiler' or 'tbb': + get_filename_component(LAPACK_mkl_MKLROOT_LAST_DIR "${LAPACK_mkl_MKLROOT}" NAME) + if(LAPACK_mkl_MKLROOT_LAST_DIR STREQUAL "mkl") + get_filename_component(LAPACK_mkl_MKLROOT "${LAPACK_mkl_MKLROOT}" DIRECTORY) + endif() + endif() + set(LAPACK_mkl_LIB_PATH_SUFFIXES + "compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" + "mkl/lib" "mkl/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" + "lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}") + + # First try empty lapack libs + if(NOT ${_LIBRARIES}) + check_lapack_libraries( + ${_LIBRARIES} + LAPACK + ${LAPACK_mkl_SEARCH_SYMBOL} + "" + "" + "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" + "${LAPACK_mkl_MKLROOT}" + "${LAPACK_mkl_LIB_PATH_SUFFIXES}" + "${_BLAS_LIBRARIES}" + ) + endif() + + # Then try the search libs + foreach(IT ${LAPACK_SEARCH_LIBS}) + string(REPLACE " " ";" SEARCH_LIBS ${IT}) + if(NOT ${_LIBRARIES}) + check_lapack_libraries( + ${_LIBRARIES} + LAPACK + ${LAPACK_mkl_SEARCH_SYMBOL} + "" + "${SEARCH_LIBS}" + "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" + "${LAPACK_mkl_MKLROOT}" + "${LAPACK_mkl_LIB_PATH_SUFFIXES}" + "${_BLAS_LIBRARIES}" + ) + endif() + endforeach() + + unset(LAPACK_mkl_ILP_MODE) + unset(LAPACK_mkl_SEARCH_SYMBOL) + unset(LAPACK_mkl_LM) + unset(LAPACK_mkl_LDL) + unset(LAPACK_mkl_MKLROOT) + unset(LAPACK_mkl_ARCH_NAME) + unset(LAPACK_mkl_OS_NAME) + unset(LAPACK_mkl_LIB_PATH_SUFFIXES) + endif() endif() + endif() - if (BLA_VENDOR MATCHES "_64ilp") - set(LAPACK_mkl_ILP_MODE "ilp64") - else () - set(LAPACK_mkl_ILP_MODE "lp64") - endif () - - set(LAPACK_SEARCH_LIBS "") - - if (BLA_F95) - set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95") - set(_LIBRARIES LAPACK95_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_c") - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95_${LAPACK_mkl_ILP_MODE}") - else() - set(LAPACK_mkl_SEARCH_SYMBOL "cheev") - set(_LIBRARIES LAPACK_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) + # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) + if(BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "goto2" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + endif() - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack") + # OpenBLAS? (http://www.openblas.net) + if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "openblas" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) endif() + endif() - # First try empty lapack libs - if (NOT ${_LIBRARIES}) + # FLAME's blis library? (https://github.com/flame/blis) + if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) check_lapack_libraries( - ${_LIBRARIES} + LAPACK_LIBRARIES LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} + cheev "" + "flame" "" - "${_BLAS_LIBRARIES}" "" - ) - endif () - # Then try the search libs - foreach (IT ${LAPACK_SEARCH_LIBS}) - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "${IT}" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" - ) - endif () - endforeach () - - unset(LAPACK_mkl_ILP_MODE) - unset(LAPACK_mkl_SEARCH_SYMBOL) - unset(LAPACK_mkl_LM) - unset(LAPACK_mkl_LDL) - endif () + "" + "${BLAS_LIBRARIES}" + ) + endif() + endif() + + # BLAS in acml library? + if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") + if(BLAS_LIBRARIES MATCHES ".+acml.+") + set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + endif() + endif() + + # Apple LAPACK library? + if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "Accelerate" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() endif() -endif() -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "goto2" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "openblas" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "flame" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -#acml lapack -if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if (BLAS_LIBRARIES MATCHES ".+acml.+") - set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif () -endif () - -# Apple LAPACK library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) + # Apple NAS (vecLib) library? + if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "vecLib" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() endif() -endif () -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "${BLAS_LIBRARIES}" - "" - ) - endif () -endif () -# Generic LAPACK library? -if (BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "ATLAS" OR - BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "${BLAS_LIBRARIES}" - "" - ) - endif () -endif () + # Generic LAPACK library? + if(BLA_VENDOR STREQUAL "Generic" OR + BLA_VENDOR STREQUAL "ATLAS" OR + BLA_VENDOR STREQUAL "All") + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "lapack" + "" + "" + "" + "${BLAS_LIBRARIES}" + ) + endif() + endif() else() message(STATUS "LAPACK requires BLAS") endif() @@ -397,11 +451,11 @@ if(BLA_F95) else() if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." + "A required library with LAPACK95 API not found. Please specify library location." ) else() message(STATUS - "A library with LAPACK95 API not found. Please specify library location." + "A library with LAPACK95 API not found. Please specify library location." ) endif() endif() @@ -421,11 +475,11 @@ else() else() if(LAPACK_FIND_REQUIRED) message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." + "A required library with LAPACK API not found. Please specify library location." ) else() message(STATUS - "A library with LAPACK API not found. Please specify library location." + "A library with LAPACK API not found. Please specify library location." ) endif() endif() @@ -434,7 +488,7 @@ endif() # On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines) # we used a placeholder for empty LAPACK_LIBRARIES to get through our logic above. -if (LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") +if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") set(LAPACK_LIBRARIES "") endif() diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index caf9d69..0b0c970 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -211,6 +211,7 @@ if (LUA_LIBRARY) # include the math library for Unix if (UNIX AND NOT APPLE AND NOT BEOS) find_library(LUA_MATH_LIBRARY m) + mark_as_advanced(LUA_MATH_LIBRARY) set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") # include dl library for statically-linked Lua library @@ -232,6 +233,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR VERSION_VAR LUA_VERSION_STRING) -mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY) cmake_policy(POP) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index a77b98a..41e1d08 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -96,15 +96,27 @@ For running MPI programs, the module sets the following variables Variables for locating MPI ^^^^^^^^^^^^^^^^^^^^^^^^^^ -This module performs a three step search for an MPI implementation: +This module performs a four step search for an MPI implementation: -1. Check if the compiler has MPI support built-in. This is the case if the user passed a +1. Search for ``MPIEXEC_EXECUTABLE`` and, if found, use its base directory. +2. Check if the compiler has MPI support built-in. This is the case if the user passed a compiler wrapper as ``CMAKE_<LANG>_COMPILER`` or if they're on a Cray system. -2. Attempt to find an MPI compiler wrapper and determine the compiler information from it. -3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. +3. Attempt to find an MPI compiler wrapper and determine the compiler information from it. +4. Try to find an MPI implementation that does not ship such a wrapper by guessing settings. Currently, only Microsoft MPI and MPICH2 on Windows are supported. -For controlling the second step, the following variables may be set: +For controlling the ``MPIEXEC_EXECUTABLE`` step, the following variables may be set: + +``MPIEXEC_EXECUTABLE`` + Manually specify the location of ``mpiexec``. +``MPI_HOME`` + Specify the base directory of the MPI installation. +``ENV{MPI_HOME}`` + Environment variable to specify the base directory of the MPI installation. +``ENV{I_MPI_ROOT}`` + Environment variable to specify the base directory of the MPI installation. + +For controlling the compiler wrapper step, the following variables may be set: ``MPI_<lang>_COMPILER`` Search for the specified compiler wrapper and use it. diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 23bb001d..74392da 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -130,6 +130,8 @@ foreach(component ${OpenGL_FIND_COMPONENTS}) set(OPENGL_USE_${_COMPONENT} 1) endforeach() +set(_OpenGL_CACHE_VARS) + if (CYGWIN) find_path(OPENGL_INCLUDE_DIR GL/gl.h ) list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) @@ -137,6 +139,11 @@ if (CYGWIN) find_library(OPENGL_gl_LIBRARY opengl32 ) find_library(OPENGL_glu_LIBRARY glu32 ) + list(APPEND _OpenGL_CACHE_VARS + OPENGL_INCLUDE_DIR + OPENGL_gl_LIBRARY + OPENGL_glu_LIBRARY + ) elseif (WIN32) if(BORLAND) @@ -147,6 +154,10 @@ elseif (WIN32) set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") endif() + list(APPEND _OpenGL_CACHE_VARS + OPENGL_gl_LIBRARY + OPENGL_glu_LIBRARY + ) elseif (APPLE) # The OpenGL.framework provides both gl and glu find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") @@ -155,6 +166,11 @@ elseif (APPLE) find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) + list(APPEND _OpenGL_CACHE_VARS + OPENGL_INCLUDE_DIR + OPENGL_gl_LIBRARY + OPENGL_glu_LIBRARY + ) else() if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") # Handle HP-UX cases where we only want to find OpenGL in either hpux64 @@ -194,6 +210,12 @@ else() /usr/openwin/share/include /opt/graphics/OpenGL/include ) + list(APPEND _OpenGL_CACHE_VARS + OPENGL_INCLUDE_DIR + OPENGL_GLX_INCLUDE_DIR + OPENGL_EGL_INCLUDE_DIR + OPENGL_xmesa_INCLUDE_DIR + ) # Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll # take into account the COMPONENTS logic later. @@ -222,6 +244,13 @@ else() /usr/shlib ) + list(APPEND _OpenGL_CACHE_VARS + OPENGL_opengl_LIBRARY + OPENGL_glx_LIBRARY + OPENGL_egl_LIBRARY + OPENGL_glu_LIBRARY + ) + set(_OpenGL_GL_POLICY_WARN 0) if(NOT DEFINED OpenGL_GL_PREFERENCE) set(OpenGL_GL_PREFERENCE "") @@ -268,6 +297,7 @@ else() ${_OPENGL_LIB_PATH} PATH_SUFFIXES libglvnd ) + list(APPEND _OpenGL_CACHE_VARS OPENGL_gl_LIBRARY) endif() if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) @@ -532,14 +562,5 @@ set(OPENGL_LIBRARY ${OPENGL_LIBRARIES}) # This deprecated setting is for backward compatibility with CMake1.4 set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) -mark_as_advanced( - OPENGL_INCLUDE_DIR - OPENGL_xmesa_INCLUDE_DIR - OPENGL_egl_LIBRARY - OPENGL_glu_LIBRARY - OPENGL_glx_LIBRARY - OPENGL_gl_LIBRARY - OPENGL_opengl_LIBRARY - OPENGL_EGL_INCLUDE_DIR - OPENGL_GLX_INCLUDE_DIR -) +mark_as_advanced(${_OpenGL_CACHE_VARS}) +unset(_OpenGL_CACHE_VARS) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 043fc6c..af713d6 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -458,7 +458,7 @@ find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" ) -mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) +mark_as_advanced(OPENSSL_INCLUDE_DIR) if(OPENSSL_FOUND) if(NOT TARGET OpenSSL::Crypto AND diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index a7c3eae..a078049 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -289,10 +289,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) string(TOLOWER ${_NAME} _NAME_LOWER) if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) + set(_FOUND_VAR_MIXED ${_NAME}_FOUND) + if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) set(_FOUND_VAR ${FPHSA_FOUND_VAR}) else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") endif() else() set(_FOUND_VAR ${_NAME_UPPER}_FOUND) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index f95e6e2..9ef22b9 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -221,6 +221,11 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set # default one. When CMAKE_INSTALL_PREFIX changes, the value is # updated to the new default, unless the user explicitly changed it. endif() + if (NOT DEFINED CMAKE_SYSTEM_NAME OR NOT DEFINED CMAKE_SIZEOF_VOID_P) + message(AUTHOR_WARNING + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " + "Please enable at least one language before including GNUInstallDirs.") + endif() if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" AND NOT CMAKE_CROSSCOMPILING AND NOT EXISTS "/etc/arch-release") @@ -235,16 +240,10 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set endif() endif() else() # not debian, rely on CMAKE_SIZEOF_VOID_P: - if(NOT DEFINED CMAKE_SIZEOF_VOID_P) - message(AUTHOR_WARNING - "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " - "Please enable at least one language before including GNUInstallDirs.") - else() - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - set(_LIBDIR_DEFAULT "lib64") - if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX) - set(__LAST_LIBDIR_DEFAULT "lib64") - endif() + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_LIBDIR_DEFAULT "lib64") + if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX) + set(__LAST_LIBDIR_DEFAULT "lib64") endif() endif() endif() diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index c74c324..14bb104 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -540,7 +540,8 @@ function(cpack_deb_prepare_package_vars) # Ok, description has set. According to the `Debian Policy Manual`_ the frist # line is a pacakge summary. Try to get it as well... # See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description - elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY AND + NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY STREQUAL CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY) # Merge summary w/ the detailed description string(PREPEND CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n") endif() diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 61d213a..5a532c7 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -23,11 +23,11 @@ macro(__aix_compiler_gnu lang) # Construct the export list ourselves to pass only the object files so # that we export only the symbols actually provided by the sources. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>" - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" + "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/exports.exp <AIX_EXPORTS> <OBJECTS>" + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" ) set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS - "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -l . <OBJECTS>" + "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -l . <AIX_EXPORTS> <OBJECTS>" "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<TARGET_IMPLIB> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index 64b0bc1..2a8c159 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -18,14 +18,24 @@ macro(__aix_compiler_xl lang) set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") + set(_OBJECTS " <OBJECTS>") + if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "") + # Prior to CMake 3.16, CMAKE_XL_CreateExportList held the path to the XL CreateExportList tool. + # Users could set it to an empty value to skip automatic exports in favor of manual -bE: flags. + # Preserve that behavior for compatibility (even though it was undocumented). + set(_OBJECTS "") + endif() + # Construct the export list ourselves to pass only the object files so # that we export only the symbols actually provided by the sources. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>" - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" + "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/exports.exp <AIX_EXPORTS>${_OBJECTS}" + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/exports.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" ) set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS - "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -l . <OBJECTS>" + "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <TARGET_IMPLIB> -l . <AIX_EXPORTS> <OBJECTS>" "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<TARGET_IMPLIB> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + + unset(_OBJECTS) endmacro() diff --git a/Modules/Platform/AIX/ExportImportList b/Modules/Platform/AIX/ExportImportList index 4f67ef5..891bce7 100755 --- a/Modules/Platform/AIX/ExportImportList +++ b/Modules/Platform/AIX/ExportImportList @@ -5,7 +5,7 @@ # This script is internal to CMake and meant only to be # invoked by CMake-generated build systems on AIX. -usage='usage: ExportImportList -o <out-file> [-l <lib>] [--] <objects>...' +usage='usage: ExportImportList -o <out-file> [-l <lib>] [-n] [--] <objects>...' die() { echo "$@" 1>&2; exit 1 @@ -14,10 +14,12 @@ die() { # Process command-line arguments. out='' lib='' +no_objects='' while test "$#" != 0; do case "$1" in -l) shift; lib="$1" ;; -o) shift; out="$1" ;; + -n) no_objects='1' ;; --) shift; break ;; -*) die "$usage" ;; *) break ;; @@ -26,23 +28,28 @@ while test "$#" != 0; do done test -n "$out" || die "$usage" -# Collect symbols exported from all object files. +# Build a temporary file that atomically replaces the output later. out_tmp="$out.tmp$$" trap 'rm -f "$out_tmp"' EXIT INT TERM -for f in "$@"; do - dump -tov -X 32_64 "$f" | - awk ' - BEGIN { - V["EXPORTED"]=" export" - V["PROTECTED"]=" protected" - } - /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / { - if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) { - print $NF V[$(NF-1)] +> "$out_tmp" + +# Collect symbols exported from all object files. +if test -z "$no_objects"; then + for f in "$@"; do + dump -tov -X 32_64 "$f" | + awk ' + BEGIN { + V["EXPORTED"]=" export" + V["PROTECTED"]=" protected" + } + /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / { + if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) { + print $NF V[$(NF-1)] + } } - } - ' -done > "$out_tmp" + ' + done >> "$out_tmp" +fi # Generate the export/import file. { diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake index e009c10..f56e1d5 100644 --- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake +++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake @@ -23,6 +23,7 @@ if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "") set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin/${CMAKE_ANDROID_ARCH_TRIPLE}-") set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}") + set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_ARCH_TRIPLE}-") return() endif() diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index c51767e..c3fd186 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -1,4 +1,3 @@ - # This file implements basic support for sdcc (http://sdcc.sourceforge.net/) # a free C compiler for 8 and 16 bit microcontrollers. # To use it either a toolchain file is required or cmake has to be run like this: @@ -35,22 +34,12 @@ else() set(CMAKE_AR "${SDCCAR_EXECUTABLE}" CACHE FILEPATH "The sdcc librarian" FORCE) endif() - if("${SDCCAR_EXECUTABLE}" MATCHES "sdcclib") set(CMAKE_AR_OPTIONS "-a") else() set(CMAKE_AR_OPTIONS "-rc") endif() -# CMAKE_C_FLAGS_INIT and CMAKE_EXE_LINKER_FLAGS_INIT should be set in a CMAKE_SYSTEM_PROCESSOR file -if(NOT DEFINED CMAKE_C_FLAGS_INIT) - string(APPEND CMAKE_C_FLAGS_INIT " -mmcs51 --model-small") -endif() - -if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) - set (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) -endif() - set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl" ",") # compile a C file into an object file diff --git a/Modules/Platform/Windows-Clang-ASM.cmake b/Modules/Platform/Windows-Clang-ASM.cmake new file mode 100644 index 0000000..345d77d --- /dev/null +++ b/Modules/Platform/Windows-Clang-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(ASM) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index c17cf6d..7fd5e49 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -21,7 +21,9 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") set(CMAKE_SHARED_MODULE_SUFFIX ".dll") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") - set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>") + if(NOT "${lang}" STREQUAL "ASM") + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <OBJECT> -MF <DEPFILE>") + endif() set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") @@ -61,23 +63,25 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") - set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt) - set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt) - set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -D_DEBUG -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmtd) - set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd) + if(NOT "${lang}" STREQUAL "ASM") + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -D_DEBUG -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmtd) + set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd) - if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) - set(__ADDED_FLAGS "") - set(__ADDED_FLAGS_DEBUG "") - else() - set(__ADDED_FLAGS_DEBUG "-D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd") - set(__ADDED_FLAGS "-D_DLL -D_MT -Xclang --dependent-lib=msvcrt") - endif() + if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT) + set(__ADDED_FLAGS "") + set(__ADDED_FLAGS_DEBUG "") + else() + set(__ADDED_FLAGS_DEBUG "-D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd") + set(__ADDED_FLAGS "-D_DLL -D_MT -Xclang --dependent-lib=msvcrt") + endif() - string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -Xclang -gcodeview -O0 ${__ADDED_FLAGS_DEBUG}") - string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG ${__ADDED_FLAGS}") - string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG ${__ADDED_FLAGS}") - string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -Xclang -gcodeview -O0 ${__ADDED_FLAGS_DEBUG}") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG ${__ADDED_FLAGS}") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG ${__ADDED_FLAGS}") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}") + endif() set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") set(CMAKE_PCH_EXTENSION .pch) @@ -129,6 +133,23 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" ) include(Platform/Windows-MSVC) + # Feed the preprocessed rc file to llvm-rc + if(CMAKE_RC_COMPILER_INIT STREQUAL "llvm-rc") + if(DEFINED CMAKE_C_COMPILER) + set(CMAKE_RC_PREPROCESSOR CMAKE_C_COMPILER) + elseif(DEFINED CMAKE_CXX_COMPILER) + set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) + endif() + if(DEFINED CMAKE_RC_PREPROCESSOR) + set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -clang:-MD -clang:-MF -clang:<SOURCE>.d -E <SOURCE> -- <CMAKE_RC_COMPILER> <FLAGS> /fo <OBJECT> <OBJECT>.pp") + if(CMAKE_GENERATOR STREQUAL "Ninja") + set(CMAKE_NINJA_CMCLDEPS_RC 0) + set(CMAKE_NINJA_DEP_TYPE_RC gcc) + endif() + unset(CMAKE_RC_PREPROCESSOR) + endif() + endif() + macro(__windows_compiler_clang lang) set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}") __windows_compiler_msvc(${lang}) diff --git a/Modules/Platform/Windows-GNU-ASM.cmake b/Modules/Platform/Windows-GNU-ASM.cmake new file mode 100644 index 0000000..8600892 --- /dev/null +++ b/Modules/Platform/Windows-GNU-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(ASM) diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 30b5aa9..f809094 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -69,6 +69,11 @@ else() endif() unset(_cmp0092) +set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") +set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") + string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"") string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}-Zi -Ob0 -Od ${_RTC1}\"") string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG") diff --git a/Modules/Platform/WindowsPhone-Clang-ASM.cmake b/Modules/Platform/WindowsPhone-Clang-ASM.cmake new file mode 100644 index 0000000..94f4ca7 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Clang-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-ASM) diff --git a/Modules/Platform/WindowsPhone-GNU-ASM.cmake b/Modules/Platform/WindowsPhone-GNU-ASM.cmake new file mode 100644 index 0000000..140eea7 --- /dev/null +++ b/Modules/Platform/WindowsPhone-GNU-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-ASM) diff --git a/Modules/Platform/WindowsStore-Clang-ASM.cmake b/Modules/Platform/WindowsStore-Clang-ASM.cmake new file mode 100644 index 0000000..94f4ca7 --- /dev/null +++ b/Modules/Platform/WindowsStore-Clang-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-ASM) diff --git a/Modules/Platform/WindowsStore-GNU-ASM.cmake b/Modules/Platform/WindowsStore-GNU-ASM.cmake new file mode 100644 index 0000000..140eea7 --- /dev/null +++ b/Modules/Platform/WindowsStore-GNU-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-ASM) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 33cacf1..cb6ae43 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -436,7 +436,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files) if(_my_sources) # make a .pro file to call lupdate on, so we don't make our commands too # long for some systems - get_filename_component(_ts_name ${_ts_file} NAME_WE) + get_filename_component(_ts_name ${_ts_file} NAME) set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) set(_pro_srcs) foreach(_pro_src ${_my_sources}) @@ -463,13 +463,15 @@ endmacro() macro(QT4_ADD_TRANSLATION _qm_files) foreach (_current_FILE ${ARGN}) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(qm ${_abs_FILE} NAME_WE) - get_property(output_location SOURCE ${_abs_FILE} PROPERTY OUTPUT_LOCATION) + get_filename_component(qm ${_abs_FILE} NAME) + # everything before the last dot has to be considered the file name (including other dots) + string(REGEX REPLACE "\\.[^.]*$" "" FILE_NAME ${qm}) + get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION) if(output_location) file(MAKE_DIRECTORY "${output_location}") - set(qm "${output_location}/${qm}.qm") + set(qm "${output_location}/${FILE_NAME}.qm") else() - set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + set(qm "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.qm") endif() add_custom_command(OUTPUT ${qm} diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ff313d6..c57f713 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -134,6 +134,9 @@ set(SRCS LexerParser/cmFortranParser.cxx LexerParser/cmFortranParserTokens.h LexerParser/cmFortranParser.y + LexerParser/cmGccDepfileLexer.cxx + LexerParser/cmGccDepfileLexer.h + LexerParser/cmGccDepfileLexer.in.l LexerParser/cmListFileLexer.c LexerParser/cmListFileLexer.in.l @@ -270,6 +273,10 @@ set(SRCS cmFortranParserImpl.cxx cmFSPermissions.cxx cmFSPermissions.h + cmGccDepfileLexerHelper.cxx + cmGccDepfileLexerHelper.h + cmGccDepfileReader.cxx + cmGccDepfileReader.h cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx cmGeneratorExpressionContext.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a2976ab..c5d9b94 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) -set(CMake_VERSION_MINOR 16) -set(CMake_VERSION_PATCH 20200122) +set(CMake_VERSION_MINOR 17) +set(CMake_VERSION_PATCH 20200211) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 3516235..fe7abf4 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -138,11 +138,16 @@ int cmCPackDragNDropGenerator::InitializeInternal() } for (auto const& language : languages) { std::string license = slaDirectory + "/" + language + ".license.txt"; - if (!singleLicense && !cmSystemTools::FileExists(license)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Missing license file " << language << ".license.txt" - << std::endl); - return 0; + std::string license_rtf = slaDirectory + "/" + language + ".license.rtf"; + if (!singleLicense) { + if (!cmSystemTools::FileExists(license) && + !cmSystemTools::FileExists(license_rtf)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " + << language << ".license.txt" + << " / " << language << ".license.rtf" << std::endl); + return 0; + } } std::string menu = slaDirectory + "/" + language + ".menu.txt"; if (!cmSystemTools::FileExists(menu)) { @@ -793,13 +798,29 @@ bool cmCPackDragNDropGenerator::WriteLicense( licenseLanguage = "English"; } + // License file + std::string license_format = "TEXT"; + std::string actual_license; + if (!licenseFile.empty()) { + if (cmHasLiteralSuffix(licenseFile, ".rtf")) { + license_format = "RTF "; + } + actual_license = licenseFile; + } else { + std::string license_wo_ext = + slaDirectory + "/" + licenseLanguage + ".license"; + if (cmSystemTools::FileExists(license_wo_ext + ".txt")) { + actual_license = license_wo_ext + ".txt"; + } else { + license_format = "RTF "; + actual_license = license_wo_ext + ".rtf"; + } + } + // License header - outputStream << "data 'TEXT' (" << licenseNumber << ", \"" << licenseLanguage - << "\") {\n"; + outputStream << "data '" << license_format << "' (" << licenseNumber + << ", \"" << licenseLanguage << "\") {\n"; // License body - std::string actual_license = !licenseFile.empty() - ? licenseFile - : (slaDirectory + "/" + licenseLanguage + ".license.txt"); cmsys::ifstream license_ifs; license_ifs.open(actual_license.c_str()); if (license_ifs.is_open()) { @@ -878,8 +899,9 @@ bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, std::string* error) { const size_t max_line_length = 512; - for (size_t i = 0; i < line.size(); i += max_line_length) { - size_t line_length = max_line_length; + size_t line_length = max_line_length; + for (size_t i = 0; i < line.size(); i += line_length) { + line_length = max_line_length; if (i + line_length > line.size()) { line_length = line.size() - i; } else { diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 951c65f..5de4a6f 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -178,6 +178,9 @@ int cmCPackOSXX11Generator::PackageFiles() int cmCPackOSXX11Generator::InitializeInternal() { + cmCPackLogger(cmCPackLog::LOG_WARNING, + "The OSXX11 generator is deprecated " + "and will be removed in a future version.\n"); cmCPackLogger(cmCPackLog::LOG_DEBUG, "cmCPackOSXX11Generator::Initialize()" << std::endl); std::vector<std::string> path; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 12ea97b..f51ea42 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -321,6 +321,9 @@ int cmCPackPackageMakerGenerator::PackageFiles() int cmCPackPackageMakerGenerator::InitializeInternal() { + cmCPackLogger(cmCPackLog::LOG_WARNING, + "The PackageMaker generator is deprecated " + "and will be removed in a future version.\n"); this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); // Starting with Xcode 4.3, PackageMaker is a separate app, and you diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index e70bc5a..78c68be 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -410,10 +410,15 @@ int cmCTestTestHandler::ProcessHandler() auto clock_finish = std::chrono::steady_clock::now(); + bool noTestsFoundError = false; if (passed.size() + failed.size() == 0) { - if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) { + if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() && + this->CTest->GetNoTestsMode() != cmCTest::NoTests::Ignore) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!" << std::endl); + if (this->CTest->GetNoTestsMode() == cmCTest::NoTests::Error) { + noTestsFoundError = true; + } } } else { if (this->HandlerVerbose && !passed.empty() && @@ -459,6 +464,12 @@ int cmCTestTestHandler::ProcessHandler() this->LogFile = nullptr; return -1; } + + if (noTestsFoundError) { + this->LogFile = nullptr; + return -1; + } + this->LogFile = nullptr; return 0; } diff --git a/Source/LexerParser/.gitattributes b/Source/LexerParser/.gitattributes index bf70249..63d9afb 100644 --- a/Source/LexerParser/.gitattributes +++ b/Source/LexerParser/.gitattributes @@ -16,4 +16,6 @@ /cmFortranLexer.h generated /cmFortranParser.cxx generated /cmFortranParserTokens.h generated +/cmGccDepfileLexer.cxx generated +/cmGccDepfileLexer.h generated /cmListFileLexer.c generated diff --git a/Source/LexerParser/cmGccDepfileLexer.cxx b/Source/LexerParser/cmGccDepfileLexer.cxx new file mode 100644 index 0000000..a98969d --- /dev/null +++ b/Source/LexerParser/cmGccDepfileLexer.cxx @@ -0,0 +1,2210 @@ +#include "cmStandardLexer.h" + +#define FLEXINT_H 1 +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define cmGccDepfile_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer cmGccDepfile_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define cmGccDepfile_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer cmGccDepfile_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define cmGccDepfile_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer cmGccDepfile_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define cmGccDepfile_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string cmGccDepfile_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define cmGccDepfile_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes cmGccDepfile_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define cmGccDepfile_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer cmGccDepfile_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define cmGccDepfile_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer cmGccDepfile_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define cmGccDepfile_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state cmGccDepfile_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define cmGccDepfile_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer cmGccDepfile_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define cmGccDepfile_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state cmGccDepfile_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define cmGccDepfile_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state cmGccDepfile_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define cmGccDepfile_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack cmGccDepfile_yyensure_buffer_stack +#endif + +#ifdef yylex +#define cmGccDepfile_yylex_ALREADY_DEFINED +#else +#define yylex cmGccDepfile_yylex +#endif + +#ifdef yyrestart +#define cmGccDepfile_yyrestart_ALREADY_DEFINED +#else +#define yyrestart cmGccDepfile_yyrestart +#endif + +#ifdef yylex_init +#define cmGccDepfile_yylex_init_ALREADY_DEFINED +#else +#define yylex_init cmGccDepfile_yylex_init +#endif + +#ifdef yylex_init_extra +#define cmGccDepfile_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra cmGccDepfile_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define cmGccDepfile_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy cmGccDepfile_yylex_destroy +#endif + +#ifdef yyget_debug +#define cmGccDepfile_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug cmGccDepfile_yyget_debug +#endif + +#ifdef yyset_debug +#define cmGccDepfile_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug cmGccDepfile_yyset_debug +#endif + +#ifdef yyget_extra +#define cmGccDepfile_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra cmGccDepfile_yyget_extra +#endif + +#ifdef yyset_extra +#define cmGccDepfile_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra cmGccDepfile_yyset_extra +#endif + +#ifdef yyget_in +#define cmGccDepfile_yyget_in_ALREADY_DEFINED +#else +#define yyget_in cmGccDepfile_yyget_in +#endif + +#ifdef yyset_in +#define cmGccDepfile_yyset_in_ALREADY_DEFINED +#else +#define yyset_in cmGccDepfile_yyset_in +#endif + +#ifdef yyget_out +#define cmGccDepfile_yyget_out_ALREADY_DEFINED +#else +#define yyget_out cmGccDepfile_yyget_out +#endif + +#ifdef yyset_out +#define cmGccDepfile_yyset_out_ALREADY_DEFINED +#else +#define yyset_out cmGccDepfile_yyset_out +#endif + +#ifdef yyget_leng +#define cmGccDepfile_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng cmGccDepfile_yyget_leng +#endif + +#ifdef yyget_text +#define cmGccDepfile_yyget_text_ALREADY_DEFINED +#else +#define yyget_text cmGccDepfile_yyget_text +#endif + +#ifdef yyget_lineno +#define cmGccDepfile_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno cmGccDepfile_yyget_lineno +#endif + +#ifdef yyset_lineno +#define cmGccDepfile_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno cmGccDepfile_yyset_lineno +#endif + +#ifdef yyget_column +#define cmGccDepfile_yyget_column_ALREADY_DEFINED +#else +#define yyget_column cmGccDepfile_yyget_column +#endif + +#ifdef yyset_column +#define cmGccDepfile_yyset_column_ALREADY_DEFINED +#else +#define yyset_column cmGccDepfile_yyset_column +#endif + +#ifdef yywrap +#define cmGccDepfile_yywrap_ALREADY_DEFINED +#else +#define yywrap cmGccDepfile_yywrap +#endif + +#ifdef yyalloc +#define cmGccDepfile_yyalloc_ALREADY_DEFINED +#else +#define yyalloc cmGccDepfile_yyalloc +#endif + +#ifdef yyrealloc +#define cmGccDepfile_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc cmGccDepfile_yyrealloc +#endif + +#ifdef yyfree +#define cmGccDepfile_yyfree_ALREADY_DEFINED +#else +#define yyfree cmGccDepfile_yyfree +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin , yyscanner ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define cmGccDepfile_yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; +#define YY_NUM_RULES 11 +#define YY_END_OF_BUFFER 12 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[26] = + { 0, + 0, 0, 12, 10, 8, 6, 10, 9, 10, 10, + 10, 8, 0, 6, 9, 1, 7, 5, 0, 3, + 2, 0, 4, 0, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 5, 6, 1, 7, 8, 6, 1, 1, 6, + 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 9, 1, 1, + 6, 1, 1, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 10, 6, 1, 6, 1, 6, 6, 6, 6, + + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 1, 6, 6, 1, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6 + } ; + +static const YY_CHAR yy_meta[11] = + { 0, + 1, 2, 1, 1, 2, 1, 1, 1, 1, 3 + } ; + +static const flex_int16_t yy_base[28] = + { 0, + 0, 0, 29, 35, 18, 35, 22, 18, 15, 0, + 8, 12, 16, 35, 11, 35, 0, 35, 13, 35, + 35, 16, 35, 22, 35, 31, 12 + } ; + +static const flex_int16_t yy_def[28] = + { 0, + 25, 1, 25, 25, 26, 25, 25, 25, 25, 27, + 25, 26, 25, 25, 25, 25, 27, 25, 25, 25, + 25, 25, 25, 25, 0, 25, 25 + } ; + +static const flex_int16_t yy_nxt[46] = + { 0, + 4, 5, 6, 7, 5, 8, 4, 9, 10, 11, + 18, 19, 20, 17, 21, 18, 15, 22, 18, 19, + 23, 13, 16, 15, 14, 24, 20, 13, 25, 25, + 25, 22, 12, 12, 3, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25 + } ; + +static const flex_int16_t yy_chk[46] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 27, 11, 19, 15, 11, 13, 13, + 22, 12, 9, 8, 7, 22, 24, 5, 3, 0, + 0, 24, 26, 26, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +/* IWYU pragma: no_forward_declare yyguts_t */ + +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + +#include <cmGccDepfileLexerHelper.h> +#include <string> + +#define INITIAL 0 + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + }; /* end struct yyguts_t */ + +static int yy_init_globals ( yyscan_t yyscanner ); + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner); + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( yyscan_t yyscanner ); +#else +static int input ( yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_load_buffer_state( yyscanner ); + } + + { + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 26 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 35 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +{ + // Unescape the dollar sign. + yyextra->addToCurrentPath("$"); + } + YY_BREAK +case 2: +YY_RULE_SETUP +{ + // Unescape the hash. + yyextra->addToCurrentPath("#"); + } + YY_BREAK +case 3: +YY_RULE_SETUP +{ + // 2N+1 backslashes plus space -> N backslashes plus space. + size_t c = (strlen(yytext) - 1) / 2; + std::string s(c, '\\'); + s.push_back(' '); + yyextra->addToCurrentPath(s.c_str()); + } + YY_BREAK +case 4: +YY_RULE_SETUP +{ + // 2N backslashes plus space -> 2N backslashes, end of filename. + yytext[strlen(yytext) - 1] = 0; + yyextra->addToCurrentPath(yytext); + yyextra->newDependency(); + } + YY_BREAK +case 5: +/* rule 5 can match eol */ +YY_RULE_SETUP +{ + // A line continuation ends the current file name. + yyextra->newDependency(); + } + YY_BREAK +case 6: +/* rule 6 can match eol */ +YY_RULE_SETUP +{ + // A newline ends the current file name and the current rule. + yyextra->newEntry(); + } + YY_BREAK +case 7: +YY_RULE_SETUP +{ + // A colon followed by space ends the rules and starts a new dependency. + yyextra->newDependency(); + } + YY_BREAK +case 8: +YY_RULE_SETUP +{ + // Rules and dependencies are separated by blocks of whitespace. + yyextra->newRuleOrDependency(); + } + YY_BREAK +case 9: +YY_RULE_SETUP +{ + // Got a span of plain text. + yyextra->addToCurrentPath(yytext); + } + YY_BREAK +case 10: +YY_RULE_SETUP +{ + // Got an otherwise unmatched character. + yyextra->addToCurrentPath(yytext); + } + YY_BREAK +case 11: +YY_RULE_SETUP +ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap( yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin , yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 26 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 26 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 25); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) +{ + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin , yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file , yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf , yyscanner ); + + yyfree( (void *) b , yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer( b , yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b , yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n , yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n , yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param _line_number line number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int _line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + + yylineno = _line_number; +} + +/** Set the current column. + * @param _column_no column number + * @param yyscanner The scanner object. + */ +void yyset_column (int _column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + + yycolumn = _column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = _out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int _bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = _bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ +int yylex_init(yyscan_t* ptr_yy_globals) +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = NULL; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack , yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree( yyg->yy_start_stack , yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/LexerParser/cmGccDepfileLexer.h b/Source/LexerParser/cmGccDepfileLexer.h new file mode 100644 index 0000000..7d34060 --- /dev/null +++ b/Source/LexerParser/cmGccDepfileLexer.h @@ -0,0 +1,687 @@ +#ifndef cmGccDepfile_yyHEADER_H +#define cmGccDepfile_yyHEADER_H 1 +#define cmGccDepfile_yyIN_HEADER 1 + +#define FLEXINT_H 1 +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define cmGccDepfile_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer cmGccDepfile_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define cmGccDepfile_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer cmGccDepfile_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define cmGccDepfile_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer cmGccDepfile_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define cmGccDepfile_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string cmGccDepfile_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define cmGccDepfile_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes cmGccDepfile_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define cmGccDepfile_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer cmGccDepfile_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define cmGccDepfile_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer cmGccDepfile_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define cmGccDepfile_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state cmGccDepfile_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define cmGccDepfile_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer cmGccDepfile_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define cmGccDepfile_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state cmGccDepfile_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define cmGccDepfile_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state cmGccDepfile_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define cmGccDepfile_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack cmGccDepfile_yyensure_buffer_stack +#endif + +#ifdef yylex +#define cmGccDepfile_yylex_ALREADY_DEFINED +#else +#define yylex cmGccDepfile_yylex +#endif + +#ifdef yyrestart +#define cmGccDepfile_yyrestart_ALREADY_DEFINED +#else +#define yyrestart cmGccDepfile_yyrestart +#endif + +#ifdef yylex_init +#define cmGccDepfile_yylex_init_ALREADY_DEFINED +#else +#define yylex_init cmGccDepfile_yylex_init +#endif + +#ifdef yylex_init_extra +#define cmGccDepfile_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra cmGccDepfile_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define cmGccDepfile_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy cmGccDepfile_yylex_destroy +#endif + +#ifdef yyget_debug +#define cmGccDepfile_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug cmGccDepfile_yyget_debug +#endif + +#ifdef yyset_debug +#define cmGccDepfile_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug cmGccDepfile_yyset_debug +#endif + +#ifdef yyget_extra +#define cmGccDepfile_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra cmGccDepfile_yyget_extra +#endif + +#ifdef yyset_extra +#define cmGccDepfile_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra cmGccDepfile_yyset_extra +#endif + +#ifdef yyget_in +#define cmGccDepfile_yyget_in_ALREADY_DEFINED +#else +#define yyget_in cmGccDepfile_yyget_in +#endif + +#ifdef yyset_in +#define cmGccDepfile_yyset_in_ALREADY_DEFINED +#else +#define yyset_in cmGccDepfile_yyset_in +#endif + +#ifdef yyget_out +#define cmGccDepfile_yyget_out_ALREADY_DEFINED +#else +#define yyget_out cmGccDepfile_yyget_out +#endif + +#ifdef yyset_out +#define cmGccDepfile_yyset_out_ALREADY_DEFINED +#else +#define yyset_out cmGccDepfile_yyset_out +#endif + +#ifdef yyget_leng +#define cmGccDepfile_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng cmGccDepfile_yyget_leng +#endif + +#ifdef yyget_text +#define cmGccDepfile_yyget_text_ALREADY_DEFINED +#else +#define yyget_text cmGccDepfile_yyget_text +#endif + +#ifdef yyget_lineno +#define cmGccDepfile_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno cmGccDepfile_yyget_lineno +#endif + +#ifdef yyset_lineno +#define cmGccDepfile_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno cmGccDepfile_yyset_lineno +#endif + +#ifdef yyget_column +#define cmGccDepfile_yyget_column_ALREADY_DEFINED +#else +#define yyget_column cmGccDepfile_yyget_column +#endif + +#ifdef yyset_column +#define cmGccDepfile_yyset_column_ALREADY_DEFINED +#else +#define yyset_column cmGccDepfile_yyset_column +#endif + +#ifdef yywrap +#define cmGccDepfile_yywrap_ALREADY_DEFINED +#else +#define yywrap cmGccDepfile_yywrap +#endif + +#ifdef yyalloc +#define cmGccDepfile_yyalloc_ALREADY_DEFINED +#else +#define yyalloc cmGccDepfile_yyalloc +#endif + +#ifdef yyrealloc +#define cmGccDepfile_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc cmGccDepfile_yyrealloc +#endif + +#ifdef yyfree +#define cmGccDepfile_yyfree_ALREADY_DEFINED +#else +#define yyfree cmGccDepfile_yyfree +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); + +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); + +/* Begin user sect3 */ + +#define cmGccDepfile_yywrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +#define yytext_ptr yytext_r + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 + +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); + +FILE *yyget_in ( yyscan_t yyscanner ); + +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); + +FILE *yyget_out ( yyscan_t yyscanner ); + +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); + + int yyget_leng ( yyscan_t yyscanner ); + +char *yyget_text ( yyscan_t yyscanner ); + +int yyget_lineno ( yyscan_t yyscanner ); + +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( yyscan_t yyscanner ); +#else +extern int yywrap ( yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (yyscan_t yyscanner); + +#define YY_DECL int yylex (yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#ifndef cmGccDepfile_yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef cmGccDepfile_yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef cmGccDepfile_yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef cmGccDepfile_yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef cmGccDepfile_yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef cmGccDepfile_yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef cmGccDepfile_yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef cmGccDepfile_yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef cmGccDepfile_yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef cmGccDepfile_yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef cmGccDepfile_yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef cmGccDepfile_yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef cmGccDepfile_yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef cmGccDepfile_yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef cmGccDepfile_yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef cmGccDepfile_yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef cmGccDepfile_yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef cmGccDepfile_yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef cmGccDepfile_yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef cmGccDepfile_yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef cmGccDepfile_yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef cmGccDepfile_yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef cmGccDepfile_yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef cmGccDepfile_yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef cmGccDepfile_yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef cmGccDepfile_yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef cmGccDepfile_yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef cmGccDepfile_yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef cmGccDepfile_yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef cmGccDepfile_yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef cmGccDepfile_yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef cmGccDepfile_yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef cmGccDepfile_yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef cmGccDepfile_yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef cmGccDepfile_yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef cmGccDepfile_yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef cmGccDepfile_yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef cmGccDepfile_yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef cmGccDepfile_yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef cmGccDepfile_yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef cmGccDepfile_yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef cmGccDepfile_yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef cmGccDepfile_yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef cmGccDepfile_yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef cmGccDepfile_yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef cmGccDepfile_yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef cmGccDepfile_yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef cmGccDepfile_yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#undef cmGccDepfile_yyIN_HEADER +#endif /* cmGccDepfile_yyHEADER_H */ diff --git a/Source/LexerParser/cmGccDepfileLexer.in.l b/Source/LexerParser/cmGccDepfileLexer.in.l new file mode 100644 index 0000000..08f8577 --- /dev/null +++ b/Source/LexerParser/cmGccDepfileLexer.in.l @@ -0,0 +1,72 @@ +%{ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +/* IWYU pragma: no_forward_declare yyguts_t */ + +#ifndef __clang_analyzer__ /* Suppress clang scan-build warnings */ + +#include <cmGccDepfileLexerHelper.h> +#include <string> +%} + +%option prefix="cmGccDepfile_yy" +%option noyywrap +%option reentrant +%pointer + +WSPACE [ \t] +NEWLINE \r?\n + +%% +\${2} { + // Unescape the dollar sign. + yyextra->addToCurrentPath("$"); + } +\\# { + // Unescape the hash. + yyextra->addToCurrentPath("#"); + } +(\\\\)*\\[ ] { + // 2N+1 backslashes plus space -> N backslashes plus space. + size_t c = (strlen(yytext) - 1) / 2; + std::string s(c, '\\'); + s.push_back(' '); + yyextra->addToCurrentPath(s.c_str()); + } +(\\\\)+[ ] { + // 2N backslashes plus space -> 2N backslashes, end of filename. + yytext[strlen(yytext) - 1] = 0; + yyextra->addToCurrentPath(yytext); + yyextra->newDependency(); + } +{WSPACE}*\\{NEWLINE} { + // A line continuation ends the current file name. + yyextra->newDependency(); + } +{NEWLINE} { + // A newline ends the current file name and the current rule. + yyextra->newEntry(); + } +:{WSPACE}+ { + // A colon followed by space ends the rules and starts a new dependency. + yyextra->newDependency(); + } +{WSPACE}+ { + // Rules and dependencies are separated by blocks of whitespace. + yyextra->newRuleOrDependency(); + } +[a-zA-Z0-9+,/_.~()}{%=@\x5B\x5D!\x80-\xFF-]+ { + // Got a span of plain text. + yyextra->addToCurrentPath(yytext); + } +. { + // Got an otherwise unmatched character. + yyextra->addToCurrentPath(yytext); + } + +%% + +/*--------------------------------------------------------------------------*/ + +#endif /* __clang_analyzer__ */ diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index ca28b19..3c24b9b 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -10,8 +10,12 @@ #include "Compilers.h" -StartCompilerSetup::StartCompilerSetup(QWidget* p) +StartCompilerSetup::StartCompilerSetup(QString defaultGeneratorPlatform, + QString defaultGeneratorToolset, + QWidget* p) : QWizardPage(p) + , DefaultGeneratorPlatform(std::move(defaultGeneratorPlatform)) + , DefaultGeneratorToolset(std::move(defaultGeneratorToolset)) { QVBoxLayout* l = new QVBoxLayout(this); l->addWidget(new QLabel(tr("Specify the generator for this project"))); @@ -68,6 +72,10 @@ QFrame* StartCompilerSetup::CreateToolsetWidgets() Toolset = new QLineEdit(frame); l->addWidget(Toolset); + // Default to CMAKE_GENERATOR_TOOLSET env var if set + if (!DefaultGeneratorToolset.isEmpty()) { + this->Toolset->setText(DefaultGeneratorToolset); + } return frame; } @@ -199,6 +207,14 @@ void StartCompilerSetup::onGeneratorChanged(QString const& name) this->PlatformOptions->addItems(platform_list); PlatformFrame->show(); + + // Default to generator platform from environment + if (!DefaultGeneratorPlatform.isEmpty()) { + int platform_index = platforms.indexOf(DefaultGeneratorPlatform); + if (platform_index != -1) { + this->PlatformOptions->setCurrentIndex(platform_index); + } + } } else { PlatformFrame->hide(); } @@ -421,8 +437,26 @@ void ToolchainCompilerSetup::setToolchainFile(const QString& t) FirstConfigure::FirstConfigure() { + const char* env_generator = std::getenv("CMAKE_GENERATOR"); + const char* env_generator_platform = nullptr; + const char* env_generator_toolset = nullptr; + if (env_generator && std::strlen(env_generator)) { + mDefaultGenerator = env_generator; + env_generator_platform = std::getenv("CMAKE_GENERATOR_PLATFORM"); + env_generator_toolset = std::getenv("CMAKE_GENERATOR_TOOLSET"); + } + + if (!env_generator_platform) { + env_generator_platform = ""; + } + + if (!env_generator_toolset) { + env_generator_toolset = ""; + } + // this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true); - this->mStartCompilerSetupPage = new StartCompilerSetup(this); + this->mStartCompilerSetupPage = new StartCompilerSetup( + env_generator_platform, env_generator_toolset, this); this->setPage(Start, this->mStartCompilerSetupPage); QObject::connect(this->mStartCompilerSetupPage, SIGNAL(selectionChanged()), this, SLOT(restart())); @@ -504,6 +538,17 @@ void FirstConfigure::loadFromSettings() this->mCrossCompilerSetupPage->setIncludeMode( settings.value("IncludeMode", 0).toInt()); settings.endGroup(); + + // environment variables take precedence over application settings because... + // - they're harder to set + // - settings always exist after the program is run once, so the environment + // variables would never be used otherwise + // - platform and toolset are populated only from environment variables, so + // this prevents them from being taken from environment, while the + // generator is taken from application settings + if (!mDefaultGenerator.isEmpty()) { + this->mStartCompilerSetupPage->setCurrentGenerator(mDefaultGenerator); + } } void FirstConfigure::saveToSettings() diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index d1db5bf..c26f489 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -29,7 +29,8 @@ class StartCompilerSetup : public QWizardPage { Q_OBJECT public: - StartCompilerSetup(QWidget* p); + StartCompilerSetup(QString defaultGeneratorPlatform, + QString defaultGeneratorToolset, QWidget* p); ~StartCompilerSetup(); void setGenerators(std::vector<cmake::GeneratorInfo> const& gens); void setCurrentGenerator(const QString& gen); @@ -64,6 +65,7 @@ protected: QStringList GeneratorsSupportingPlatform; QMultiMap<QString, QString> GeneratorSupportedPlatforms; QMap<QString, QString> GeneratorDefaultPlatform; + QString DefaultGeneratorPlatform, DefaultGeneratorToolset; private: QFrame* CreateToolsetWidgets(); @@ -197,6 +199,7 @@ protected: NativeCompilerSetup* mNativeCompilerSetupPage; CrossCompilerSetup* mCrossCompilerSetupPage; ToolchainCompilerSetup* mToolchainCompilerSetupPage; + QString mDefaultGenerator; }; #endif // FirstConfigure_h diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 5deba8b..231a2d6 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -174,7 +174,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, doing = doing_comment; } else if (copy == keyDEPFILE) { doing = doing_depfile; - if (mf.GetGlobalGenerator()->GetName() != "Ninja") { + if (!mf.GetGlobalGenerator()->SupportsCustomCommandDepfile()) { status.SetError("Option DEPFILE not supported by " + mf.GetGlobalGenerator()->GetName()); return false; diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index e5eea79..d29b2ac 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -200,8 +200,11 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix, bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix, bool recursive) { - if (!this->AddFile(path, skip, prefix)) { - return false; + if (strcmp(path, ".") != 0 || + (this->Format != "zip" && this->Format != "7zip")) { + if (!this->AddFile(path, skip, prefix)) { + return false; + } } if ((!cmSystemTools::FileIsDirectory(path) || !recursive) || cmSystemTools::FileIsSymlink(path)) { @@ -210,6 +213,9 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix, cmsys::Directory d; if (d.Load(path)) { std::string next = cmStrCat(path, '/'); + if (next == "./" && (this->Format == "zip" || this->Format == "7zip")) { + next.clear(); + } std::string::size_type end = next.size(); unsigned long n = d.GetNumberOfFiles(); for (unsigned long i = 0; i < n; ++i) { diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 22a6e38..04f75bd 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -208,6 +208,8 @@ struct cmCTest::Private bool OutputColorCode = cmCTest::ColoredOutputSupportedByConsole(); std::map<std::string, std::string> Definitions; + + cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy; }; struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag) @@ -2059,6 +2061,19 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, this->SetNotesFiles(args[i].c_str()); } + const std::string noTestsPrefix = "--no-tests="; + if (cmHasPrefix(arg, noTestsPrefix)) { + const std::string noTestsMode = arg.substr(noTestsPrefix.length()); + if (noTestsMode == "error") { + this->Impl->NoTestsMode = cmCTest::NoTests::Error; + } else if (noTestsMode != "ignore") { + errormsg = "'--no-tests=' given unknown value '" + noTestsMode + "'"; + return false; + } else { + this->Impl->NoTestsMode = cmCTest::NoTests::Ignore; + } + } + // options that control what tests are run if (this->CheckArgument(arg, "-I", "--tests-information") && i < args.size() - 1) { @@ -2896,6 +2911,11 @@ cmCTest::Repeat cmCTest::GetRepeatMode() const return this->Impl->RepeatMode; } +cmCTest::NoTests cmCTest::GetNoTestsMode() const +{ + return this->Impl->NoTestsMode; +} + void cmCTest::SetBuildID(const std::string& id) { this->Impl->BuildID = id; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index e0ae100..7f8f913 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -442,6 +442,14 @@ public: }; Repeat GetRepeatMode() const; + enum class NoTests + { + Legacy, + Error, + Ignore + }; + NoTests GetNoTestsMode() const; + void GenerateSubprojectsOutput(cmXMLWriter& xml); std::vector<std::string> GetLabelsForSubprojects(); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 265941a..dc9aba1 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -648,8 +648,8 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, bool asString) { if (prop == "TYPE") { - this->Type = cmState::StringToCacheEntryType(!value.empty() ? value.c_str() - : "STRING"); + this->Type = + cmState::StringToCacheEntryType(!value.empty() ? value : "STRING"); } else if (prop == "VALUE") { if (!value.empty()) { if (!this->Value.empty() && !asString) { @@ -658,7 +658,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, this->Value += value; } } else { - this->Properties.AppendProperty(prop, value.c_str(), asString); + this->Properties.AppendProperty(prop, value, asString); } } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 9106e70..5ff6f8c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -17,6 +17,7 @@ #include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" +#include "cmTarget.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) : GeneratorTarget(gt) @@ -216,6 +217,20 @@ std::string cmCommonTargetGenerator::GetManifests(const std::string& config) return cmJoin(manifests, " "); } +std::string cmCommonTargetGenerator::GetAIXExports(std::string const&) +{ + std::string aixExports; + if (this->GeneratorTarget->Target->IsAIX()) { + if (const char* exportAll = + this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) { + if (cmIsOff(exportAll)) { + aixExports = "-n"; + } + } + } + return aixExports; +} + void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so) @@ -233,7 +248,10 @@ void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags, int major; int minor; int patch; - this->GeneratorTarget->GetTargetVersion(so, major, minor, patch); + std::string prop = cmStrCat("OSX_", name, "_VERSION"); + std::string fallback_prop = so ? "SOVERSION" : "VERSION"; + this->GeneratorTarget->GetTargetVersionFallback(prop, fallback_prop, major, + minor, patch); if (major > 0 || minor > 0 || patch > 0) { // Append the flag since a non-zero version is specified. std::ostringstream vflag; diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 2796470..b40a2ed 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -55,6 +55,7 @@ protected: std::string GetDefines(const std::string& l, const std::string& config); std::string GetIncludes(std::string const& l, const std::string& config); std::string GetManifests(const std::string& config); + std::string GetAIXExports(std::string const& config); std::vector<std::string> GetLinkedTargetDirectories( const std::string& config) const; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 8773d10..7be6d2c 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -8,8 +8,11 @@ #include <sstream> #include <utility> +#include <cm/memory> + #include "cmAlgorithms.h" #include "cmComputeLinkDepends.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmListFileCache.h" @@ -256,11 +259,10 @@ cmComputeLinkInformation::cmComputeLinkInformation( "FIND_LIBRARY_USE_OPENBSD_VERSIONING"); // Allocate internals. - this->OrderLinkerSearchPath = new cmOrderDirectories( + this->OrderLinkerSearchPath = cm::make_unique<cmOrderDirectories>( this->GlobalGenerator, target, "linker search path"); - this->OrderRuntimeSearchPath = new cmOrderDirectories( + this->OrderRuntimeSearchPath = cm::make_unique<cmOrderDirectories>( this->GlobalGenerator, target, "runtime search path"); - this->OrderDependentRPath = nullptr; // Get the language used for linking this target. this->LinkLanguage = this->Target->GetLinkerLanguage(config); @@ -358,7 +360,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( this->SharedDependencyMode = SharedDepModeLibDir; } else if (!this->RPathLinkFlag.empty()) { this->SharedDependencyMode = SharedDepModeDir; - this->OrderDependentRPath = new cmOrderDirectories( + this->OrderDependentRPath = cm::make_unique<cmOrderDirectories>( this->GlobalGenerator, target, "dependent library path"); } @@ -400,12 +402,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( "CMAKE_POLICY_WARNING_CMP0060"); } -cmComputeLinkInformation::~cmComputeLinkInformation() -{ - delete this->OrderLinkerSearchPath; - delete this->OrderRuntimeSearchPath; - delete this->OrderDependentRPath; -} +cmComputeLinkInformation::~cmComputeLinkInformation() = default; void cmComputeLinkInformation::AppendValues( std::string& result, std::vector<BT<std::string>>& values) @@ -573,6 +570,15 @@ void cmComputeLinkInformation::AddImplicitLinkInfo() cmGeneratorTarget::LinkClosure const* lc = this->Target->GetLinkClosure(this->Config); for (std::string const& li : lc->Languages) { + + if (li == "CUDA") { + // These need to go before the other implicit link information + // as they could require symbols from those other library + // Currently restricted to CUDA as it is the only language + // we have documented runtime behavior controls for + this->AddRuntimeLinkLibrary(li); + } + // Skip those of the linker language. They are implicit. if (li != this->LinkLanguage) { this->AddImplicitLinkInfo(li); @@ -580,6 +586,39 @@ void cmComputeLinkInformation::AddImplicitLinkInfo() } } +void cmComputeLinkInformation::AddRuntimeLinkLibrary(std::string const& lang) +{ // Add the lang runtime library flags. This is activated by the presence + // of a default selection whether or not it is overridden by a property. + std::string defaultVar = + cmStrCat("CMAKE_", lang, "_RUNTIME_LIBRARY_DEFAULT"); + const char* langRuntimeLibraryDefault = + this->Makefile->GetDefinition(defaultVar); + if (langRuntimeLibraryDefault && *langRuntimeLibraryDefault) { + const char* runtimeLibraryValue = + this->Target->GetProperty(cmStrCat(lang, "_RUNTIME_LIBRARY")); + if (!runtimeLibraryValue) { + runtimeLibraryValue = langRuntimeLibraryDefault; + } + + std::string runtimeLibrary = + cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate( + runtimeLibraryValue, this->Target->GetLocalGenerator(), this->Config, + this->Target)); + if (!runtimeLibrary.empty()) { + if (const char* runtimeLinkOptions = this->Makefile->GetDefinition( + "CMAKE_" + lang + "_RUNTIME_LIBRARY_LINK_OPTIONS_" + + runtimeLibrary)) { + std::vector<std::string> libsVec = cmExpandedList(runtimeLinkOptions); + for (std::string const& i : libsVec) { + if (!cmContains(this->ImplicitLinkLibs, i)) { + this->AddItem(i, nullptr); + } + } + } + } + } +} + void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) { // Add libraries for this language that are not implied by the @@ -747,10 +786,10 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, if (this->SharedDependencyMode == SharedDepModeLibDir && !this->LinkWithRuntimePath /* AddLibraryRuntimeInfo adds it */) { // Add the item to the linker search path. - order = this->OrderLinkerSearchPath; + order = this->OrderLinkerSearchPath.get(); } else if (this->SharedDependencyMode == SharedDepModeDir) { // Add the item to the separate dependent library search path. - order = this->OrderDependentRPath; + order = this->OrderDependentRPath.get(); } if (order) { if (tgt) { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 92ab83b..3bc9c16 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include <iosfwd> +#include <memory> #include <set> #include <string> #include <utility> @@ -29,6 +30,9 @@ class cmComputeLinkInformation public: cmComputeLinkInformation(cmGeneratorTarget const* target, const std::string& config); + cmComputeLinkInformation(const cmComputeLinkInformation&) = delete; + cmComputeLinkInformation& operator=(const cmComputeLinkInformation&) = + delete; ~cmComputeLinkInformation(); bool Compute(); @@ -164,7 +168,7 @@ private: cmsys::RegularExpression SplitFramework; // Linker search path computation. - cmOrderDirectories* OrderLinkerSearchPath; + std::unique_ptr<cmOrderDirectories> OrderLinkerSearchPath; bool FinishLinkerSearchDirectories(); void PrintLinkPolicyDiagnosis(std::ostream&); @@ -172,6 +176,7 @@ private: void LoadImplicitLinkInfo(); void AddImplicitLinkInfo(); void AddImplicitLinkInfo(std::string const& lang); + void AddRuntimeLinkLibrary(std::string const& lang); std::set<std::string> ImplicitLinkDirs; std::set<std::string> ImplicitLinkLibs; @@ -184,9 +189,9 @@ private: std::vector<std::string> OldUserFlagItems; std::set<std::string> CMP0060WarnItems; // Dependent library path computation. - cmOrderDirectories* OrderDependentRPath; + std::unique_ptr<cmOrderDirectories> OrderDependentRPath; // Runtime path computation. - cmOrderDirectories* OrderRuntimeSearchPath; + std::unique_ptr<cmOrderDirectories> OrderRuntimeSearchPath; bool OldLinkDirMode; bool OpenBSD; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 34f815f..2432d2b 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -139,7 +139,7 @@ const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const (target->IsImported() || target->GetProperty("CROSSCOMPILING_EMULATOR") || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { - return target->GetLocation(this->Config); + return target->GetLocation(this->Config).c_str(); } return nullptr; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 27e9906..6441e6f 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -61,9 +61,9 @@ void cmExportFileGenerator::SetExportFile(const char* mainFile) cmSystemTools::GetFilenameLastExtension(this->MainImportFile); } -const char* cmExportFileGenerator::GetMainExportFileName() const +const std::string& cmExportFileGenerator::GetMainExportFileName() const { - return this->MainImportFile.c_str(); + return this->MainImportFile; } bool cmExportFileGenerator::GenerateImportFile() diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 0d69779..e9d0da7 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -46,7 +46,7 @@ public: /** Set the full path to the export file to generate. */ void SetExportFile(const char* mainFile); - const char* GetMainExportFileName() const; + const std::string& GetMainExportFileName() const; /** Set the namespace in which to place exported target names. */ void SetNamespace(const std::string& ns) { this->Namespace = ns; } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 603fea3..413449c 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -297,8 +297,7 @@ void cmExtraSublimeTextGenerator::AppendTarget( fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - " << targetName << "\",\n"; fout << "\t\t\t\"cmd\": [" - << this->BuildMakeCommand(make, makefileName.c_str(), targetName) - << "],\n"; + << this->BuildMakeCommand(make, makefileName, targetName) << "],\n"; fout << "\t\t\t\"working_dir\": \"${project_path}\",\n"; fout << "\t\t\t\"file_regex\": \"" "^(..[^:]*)(?::|\\\\()([0-9]+)(?::|\\\\))(?:([0-9]+):)?\\\\s*(.*)" @@ -309,7 +308,8 @@ void cmExtraSublimeTextGenerator::AppendTarget( // Create the command line for building the given target using the selected // make std::string cmExtraSublimeTextGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const std::string& target) + const std::string& make, const std::string& makefile, + const std::string& target) { std::string command = cmStrCat('"', make, '"'); std::string generator = this->GlobalGenerator->GetName(); diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 7e8f2d4..078cfe7 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -44,7 +44,8 @@ private: /** Returns the build command that needs to be executed to build the * specified target. */ - std::string BuildMakeCommand(const std::string& make, const char* makefile, + std::string BuildMakeCommand(const std::string& make, + const std::string& makefile, const std::string& target); /** Appends the specified target to the generated project file as a Sublime * Text build system. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d1775a7..79110ab 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -25,6 +25,7 @@ #include "cm_static_string_view.hxx" #include "cm_sys_stat.h" +#include "cmAlgorithms.h" #include "cmArgumentParser.h" #include "cmCryptoHash.h" #include "cmExecutionStatus.h" @@ -2674,9 +2675,20 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args, cmSystemTools::SetFatalErrorOccured(); return false; } - argIt = keywordsMissingValues.begin(); - if (argIt != keywordsMissingValues.end()) { - status.SetError(cmStrCat("Keyword missing value: ", *argIt)); + + const std::vector<std::string> LIST_ARGS = { "DIRECTORIES", + "EXECUTABLES", + "LIBRARIES", + "MODULES", + "POST_EXCLUDE_REGEXES", + "POST_INCLUDE_REGEXES", + "PRE_EXCLUDE_REGEXES", + "PRE_INCLUDE_REGEXES" }; + auto kwbegin = keywordsMissingValues.cbegin(); + auto kwend = cmRemoveMatching(keywordsMissingValues, LIST_ARGS); + if (kwend != kwbegin) { + status.SetError(cmStrCat("Keywords missing values:\n ", + cmJoin(cmMakeRange(kwbegin, kwend), "\n "))); cmSystemTools::SetFatalErrorOccured(); return false; } diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx new file mode 100644 index 0000000..957896f --- /dev/null +++ b/Source/cmGccDepfileLexerHelper.cxx @@ -0,0 +1,126 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmGccDepfileLexerHelper.h" + +#include <cstdio> +#include <memory> +#include <string> +#include <vector> + +#include "cmGccDepfileReaderTypes.h" + +#include "LexerParser/cmGccDepfileLexer.h" + +#ifdef _WIN32 +# include "cmsys/Encoding.h" +#endif + +bool cmGccDepfileLexerHelper::readFile(const char* filePath) +{ +#ifdef _WIN32 + wchar_t* wpath = cmsysEncoding_DupToWide(filePath); + FILE* file = _wfopen(wpath, L"rb"); + free(wpath); +#else + FILE* file = fopen(filePath, "r"); +#endif + if (!file) { + return false; + } + newEntry(); + yyscan_t scanner; + cmGccDepfile_yylex_init(&scanner); + cmGccDepfile_yyset_extra(this, scanner); + cmGccDepfile_yyrestart(file, scanner); + cmGccDepfile_yylex(scanner); + cmGccDepfile_yylex_destroy(scanner); + sanitizeContent(); + fclose(file); + return true; +} + +void cmGccDepfileLexerHelper::newEntry() +{ + this->HelperState = State::Rule; + this->Content.emplace_back(); + newRule(); +} + +void cmGccDepfileLexerHelper::newRule() +{ + auto& entry = this->Content.back(); + if (entry.rules.empty() || !entry.rules.back().empty()) { + entry.rules.emplace_back(); + } +} + +void cmGccDepfileLexerHelper::newDependency() +{ + // printf("NEW DEP\n"); + this->HelperState = State::Dependency; + if (this->Content.back().paths.empty() || + !this->Content.back().paths.back().empty()) { + this->Content.back().paths.emplace_back(); + } +} + +void cmGccDepfileLexerHelper::newRuleOrDependency() +{ + if (this->HelperState == State::Rule) { + newRule(); + } else { + newDependency(); + } +} + +void cmGccDepfileLexerHelper::addToCurrentPath(const char* s) +{ + if (this->Content.empty()) { + return; + } + cmGccStyleDependency* dep = &this->Content.back(); + std::string* dst = nullptr; + switch (this->HelperState) { + case State::Rule: { + if (dep->rules.empty()) { + return; + } + dst = &dep->rules.back(); + } break; + case State::Dependency: { + if (dep->paths.empty()) { + return; + } + dst = &dep->paths.back(); + } break; + } + dst->append(s); +} + +void cmGccDepfileLexerHelper::sanitizeContent() +{ + for (auto it = this->Content.begin(); it != this->Content.end();) { + // Remove empty rules + for (auto rit = it->rules.begin(); rit != it->rules.end();) { + if (rit->empty()) { + rit = it->rules.erase(rit); + } else { + ++rit; + } + } + // Remove the entry if rules are empty + if (it->rules.empty()) { + it = this->Content.erase(it); + } else { + // Remove empty paths + for (auto pit = it->paths.begin(); pit != it->paths.end();) { + if (pit->empty()) { + pit = it->paths.erase(pit); + } else { + ++pit; + } + } + ++it; + } + } +} diff --git a/Source/cmGccDepfileLexerHelper.h b/Source/cmGccDepfileLexerHelper.h new file mode 100644 index 0000000..e6b2fcf --- /dev/null +++ b/Source/cmGccDepfileLexerHelper.h @@ -0,0 +1,40 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmGccDepfileLexerHelper_h +#define cmGccDepfileLexerHelper_h + +#include <utility> + +#include <cmGccDepfileReaderTypes.h> + +class cmGccDepfileLexerHelper +{ +public: + cmGccDepfileLexerHelper() = default; + + bool readFile(const char* filePath); + cmGccDepfileContent extractContent() && { return std::move(this->Content); } + + // Functions called by the lexer + void newEntry(); + void newRule(); + void newDependency(); + void newRuleOrDependency(); + void addToCurrentPath(const char* s); + +private: + void sanitizeContent(); + + cmGccDepfileContent Content; + + enum class State + { + Rule, + Dependency + }; + State HelperState = State::Rule; +}; + +#define YY_EXTRA_TYPE cmGccDepfileLexerHelper* + +#endif diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx new file mode 100644 index 0000000..9d70ede --- /dev/null +++ b/Source/cmGccDepfileReader.cxx @@ -0,0 +1,18 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmGccDepfileReader.h" + +#include <type_traits> +#include <utility> + +#include "cmGccDepfileLexerHelper.h" + +cmGccDepfileContent cmReadGccDepfile(const char* filePath) +{ + cmGccDepfileContent result; + cmGccDepfileLexerHelper helper; + if (helper.readFile(filePath)) { + result = std::move(helper).extractContent(); + } + return result; +} diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h new file mode 100644 index 0000000..9313010 --- /dev/null +++ b/Source/cmGccDepfileReader.h @@ -0,0 +1,10 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmGccDepfileReader_h +#define cmGccDepfileReader_h + +#include "cmGccDepfileReaderTypes.h" + +cmGccDepfileContent cmReadGccDepfile(const char* filePath); + +#endif diff --git a/Source/cmGccDepfileReaderTypes.h b/Source/cmGccDepfileReaderTypes.h new file mode 100644 index 0000000..8b15c73 --- /dev/null +++ b/Source/cmGccDepfileReaderTypes.h @@ -0,0 +1,17 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmGccDepfileReaderTypes_h +#define cmGccDepfileReaderTypes_h + +#include <string> +#include <vector> + +struct cmGccStyleDependency +{ + std::vector<std::string> rules; + std::vector<std::string> paths; +}; + +using cmGccDepfileContent = std::vector<cmGccStyleDependency>; + +#endif diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 66f1c71..14478c2 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -14,6 +14,7 @@ #include <utility> #include <cm/iterator> +#include <cm/string_view> #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" @@ -37,7 +38,6 @@ #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" -#include "cmString.hxx" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 792cd4d..4dfc33d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -54,11 +54,11 @@ const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>( cmGeneratorTarget const* tgt, cmMessenger* /* messenger */, cmListFileBacktrace const& /* context */) { - return tgt->GetSourcesProperty(); + return tgt->GetSourcesProperty().c_str(); } template <> -const char* +const std::string& cmTargetPropertyComputer::ComputeLocationForBuild<cmGeneratorTarget>( cmGeneratorTarget const* tgt) { @@ -66,7 +66,8 @@ cmTargetPropertyComputer::ComputeLocationForBuild<cmGeneratorTarget>( } template <> -const char* cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>( +const std::string& +cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>( cmGeneratorTarget const* tgt, const std::string& config) { return tgt->GetLocation(config); @@ -310,7 +311,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) cmGeneratorTarget::~cmGeneratorTarget() = default; -const char* cmGeneratorTarget::GetSourcesProperty() const +const std::string& cmGeneratorTarget::GetSourcesProperty() const { std::vector<std::string> values; for (auto& se : this->SourceEntries) { @@ -319,7 +320,7 @@ const char* cmGeneratorTarget::GetSourcesProperty() const static std::string value; value.clear(); value = cmJoin(values, ";"); - return value.c_str(); + return value; } cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const @@ -996,7 +997,8 @@ void cmGeneratorTarget::GetXamlSources(std::vector<cmSourceFile const*>& data, IMPLEMENT_VISIT(SourceKindXaml); } -const char* cmGeneratorTarget::GetLocation(const std::string& config) const +const std::string& cmGeneratorTarget::GetLocation( + const std::string& config) const { static std::string location; if (this->IsImported()) { @@ -1005,7 +1007,7 @@ const char* cmGeneratorTarget::GetLocation(const std::string& config) const } else { location = this->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); } - return location.c_str(); + return location; } std::vector<cmCustomCommand> const& cmGeneratorTarget::GetPreBuildCommands() @@ -1036,13 +1038,13 @@ bool cmGeneratorTarget::IsImportedGloballyVisible() const return this->Target->IsImportedGloballyVisible(); } -const char* cmGeneratorTarget::GetLocationForBuild() const +const std::string& cmGeneratorTarget::GetLocationForBuild() const { static std::string location; if (this->IsImported()) { location = this->Target->ImportedGetFullPath( "", cmStateEnums::RuntimeBinaryArtifact); - return location.c_str(); + return location; } // Now handle the deprecated build-time configuration location. @@ -1062,7 +1064,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const } location += "/"; location += this->GetFullName("", cmStateEnums::RuntimeBinaryArtifact); - return location.c_str(); + return location; } bool cmGeneratorTarget::IsSystemIncludeDirectory( @@ -5280,11 +5282,23 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation( void cmGeneratorTarget::GetTargetVersion(int& major, int& minor) const { int patch; - this->GetTargetVersion(false, major, minor, patch); + this->GetTargetVersion("VERSION", major, minor, patch); +} + +void cmGeneratorTarget::GetTargetVersionFallback( + const std::string& property, const std::string& fallback_property, + int& major, int& minor, int& patch) const +{ + if (this->GetProperty(property)) { + this->GetTargetVersion(property, major, minor, patch); + } else { + this->GetTargetVersion(fallback_property, major, minor, patch); + } } -void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major, - int& minor, int& patch) const +void cmGeneratorTarget::GetTargetVersion(const std::string& property, + int& major, int& minor, + int& patch) const { // Set the default values. major = 0; @@ -5293,9 +5307,7 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major, assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); - // Look for a VERSION or SOVERSION property. - const char* prop = soversion ? "SOVERSION" : "VERSION"; - if (const char* version = this->GetProperty(prop)) { + if (const char* version = this->GetProperty(property)) { // Try to parse the version number and store the results that were // successfully parsed. int parsed_major; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 9d06104..b647b25 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -46,7 +46,7 @@ public: bool IsImported() const; bool IsImportedGloballyVisible() const; - const char* GetLocation(const std::string& config) const; + const std::string& GetLocation(const std::string& config) const; std::vector<cmCustomCommand> const& GetPreBuildCommands() const; std::vector<cmCustomCommand> const& GetPreLinkCommands() const; @@ -65,7 +65,7 @@ public: /** Get the location of the target in the build tree with a placeholder referencing the configuration in the native build system. This location is suitable for use as the LOCATION target property. */ - const char* GetLocationForBuild() const; + const std::string& GetLocationForBuild() const; cmComputeLinkInformation* GetLinkInformation( const std::string& config) const; @@ -755,14 +755,22 @@ public: void GetTargetVersion(int& major, int& minor) const; /** Get the target major, minor, and patch version numbers - interpreted from the VERSION or SOVERSION property. Version 0 + interpreted from the given property. Version 0 is returned if the property is not set or cannot be parsed. */ - void GetTargetVersion(bool soversion, int& major, int& minor, + void GetTargetVersion(std::string const& property, int& major, int& minor, int& patch) const; + /** Get the target major, minor, and patch version numbers + interpreted from the given property and if empty use the + fallback property. Version 0 is returned if the property is + not set or cannot be parsed. */ + void GetTargetVersionFallback(const std::string& property, + const std::string& fallback_property, + int& major, int& minor, int& patch) const; + std::string GetFortranModuleDirectory(std::string const& working_dir) const; - const char* GetSourcesProperty() const; + const std::string& GetSourcesProperty() const; private: void AddSourceCommon(const std::string& src, bool before = false); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 38ff3ae..7ddeb99 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1645,7 +1645,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() for (std::string const& c : configs) { std::string defPropName = cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(c)); - t->AppendProperty(defPropName, mf->GetProperty(defPropName)); + if (const char* val = mf->GetProperty(defPropName)) { + t->AppendProperty(defPropName, val); + } } } } @@ -1876,6 +1878,10 @@ int cmGlobalGenerator::Build( output += "\n"; return 1; } + std::string realConfig = config; + if (realConfig.empty()) { + realConfig = this->GetDefaultBuildConfig(); + } int retVal = 0; cmSystemTools::SetRunCommandHideConsole(true); @@ -1884,7 +1890,7 @@ int cmGlobalGenerator::Build( std::vector<GeneratedMakeCommand> makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir, targets, - config, fast, jobs, verbose, nativeOptions); + realConfig, fast, jobs, verbose, nativeOptions); // Workaround to convince some commands to produce output. if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH && @@ -1896,7 +1902,7 @@ int cmGlobalGenerator::Build( if (clean) { std::vector<GeneratedMakeCommand> cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir, - { "clean" }, config, fast, jobs, verbose); + { "clean" }, realConfig, fast, jobs, verbose); output += "\nRun Clean Command:"; output += cleanCommand.front().Printable(); output += "\n"; @@ -2525,6 +2531,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache( gti.PerConfig = false; cmCustomCommandLine singleLine; singleLine.push_back(cmSystemTools::GetCMakeCommand()); + singleLine.push_back("--regenerate-during-build"); singleLine.push_back("-S$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); gti.CommandLines.push_back(std::move(singleLine)); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f6ed10f..0e7e03d 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -44,6 +44,7 @@ class cmLocalGenerator; class cmMakefile; class cmOutputConverter; class cmSourceFile; +class cmState; class cmStateDirectory; class cmake; @@ -135,6 +136,12 @@ public: virtual bool SetGeneratorToolset(std::string const& ts, bool build, cmMakefile* mf); + /** Read any other cache entries needed for cmake --build. */ + virtual bool ReadCacheEntriesForBuild(const cmState& /*state*/) + { + return true; + } + /** * Create LocalGenerators and process the CMakeLists files. This does not * actually produce any makefiles, DSPs, etc. @@ -382,6 +389,9 @@ public: // Lookup edit_cache target command preferred by this generator. virtual std::string GetEditCacheCommand() const { return ""; } + // Default config to use for cmake --build + virtual std::string GetDefaultBuildConfig() const { return "Debug"; } + // Class to track a set of dependencies. using TargetDependSet = cmTargetDependSet; @@ -438,6 +448,8 @@ public: MacFolder. */ virtual bool ShouldStripResourcePath(cmMakefile*) const; + virtual bool SupportsCustomCommandDepfile() const { return false; } + std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; /** Generate an <output>.rule file path for a given command output. */ diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0487ad1..ff9c433 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -46,7 +46,8 @@ #include "cmake.h" const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja"; -const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja"; +const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = + "CMakeFiles/rules.ninja"; const char* cmGlobalNinjaGenerator::INDENT = " "; #ifdef _WIN32 std::string const cmGlobalNinjaGenerator::SHELL_NOOP = "cd ."; @@ -293,7 +294,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( if (config.empty()) { this->WriteBuild(*this->GetCommonFileStream(), build); } else { - this->WriteBuild(*this->GetConfigFileStream(config), build); + this->WriteBuild(*this->GetImplFileStream(config), build); } } @@ -324,7 +325,7 @@ void cmGlobalNinjaGenerator::WriteMacOSXContentBuild(std::string input, cmNinjaBuild build("COPY_OSX_CONTENT"); build.Outputs.push_back(std::move(output)); build.ExplicitDeps.push_back(std::move(input)); - this->WriteBuild(*this->GetConfigFileStream(config), build); + this->WriteBuild(*this->GetImplFileStream(config), build); } } @@ -485,6 +486,9 @@ void cmGlobalNinjaGenerator::Generate() msg.str()); return; } + if (!this->InspectConfigTypeVariables()) { + return; + } if (!this->OpenBuildFileStreams()) { return; } @@ -518,6 +522,7 @@ void cmGlobalNinjaGenerator::Generate() if (cmSystemTools::GetErrorOccuredFlag()) { this->RulesFileStream->setstate(std::ios::failbit); for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) { + this->GetImplFileStream(config)->setstate(std::ios::failbit); this->GetConfigFileStream(config)->setstate(std::ios::failbit); } this->GetCommonFileStream()->setstate(std::ios::failbit); @@ -527,15 +532,28 @@ void cmGlobalNinjaGenerator::Generate() this->CloseRulesFileStream(); this->CloseBuildFileStreams(); - if (!this->WriteDefaultBuildFile()) { - return; +#ifdef _WIN32 + // The ninja tools will not be able to update metadata on Windows + // when we are re-generating inside an existing 'ninja' invocation + // because the outer tool has the files open for write. + if (!this->GetCMakeInstance()->GetRegenerateDuringBuild()) +#endif + { + this->CleanMetaData(); } +} - auto run_ninja_tool = [this](char const* tool) { +void cmGlobalNinjaGenerator::CleanMetaData() +{ + auto run_ninja_tool = [this](std::vector<char const*> const& args) { std::vector<std::string> command; command.push_back(this->NinjaCommand); + command.emplace_back("-C"); + command.emplace_back(this->GetCMakeInstance()->GetHomeOutputDirectory()); command.emplace_back("-t"); - command.emplace_back(tool); + for (auto const& arg : args) { + command.emplace_back(arg); + } std::string error; if (!cmSystemTools::RunSingleCommand(command, nullptr, &error, nullptr, nullptr, @@ -550,14 +568,46 @@ void cmGlobalNinjaGenerator::Generate() } }; - if (this->NinjaSupportsCleanDeadTool) { - run_ninja_tool("cleandead"); - } - if (this->NinjaSupportsUnconditionalRecompactTool) { - run_ninja_tool("recompact"); - } - if (this->NinjaSupportsRestatTool) { - run_ninja_tool("restat"); + // Can the tools below expect 'build.ninja' to be loadable? + bool const expectBuildManifest = + !this->IsMultiConfig() && this->OutputPathPrefix.empty(); + + // Skip some ninja tools if they need 'build.ninja' but it is missing. + bool const missingBuildManifest = expectBuildManifest && + (this->NinjaSupportsCleanDeadTool || + this->NinjaSupportsUnconditionalRecompactTool) && + !cmSystemTools::FileExists("build.ninja"); + + // The `cleandead` tool needs to know about all outputs in the build we just + // wrote out. Ninja-Multi doesn't have a single `build.ninja` we can use that + // is the union of all generated configurations, so we can't run it reliably + // in that case. + if (this->NinjaSupportsCleanDeadTool && expectBuildManifest && + !missingBuildManifest) { + run_ninja_tool({ "cleandead" }); + } + // The `recompact` tool loads the manifest. As above, we don't have a single + // `build.ninja` to load for this in Ninja-Multi. This may be relaxed in the + // future pending further investigation into how Ninja works upstream + // (ninja#1721). + if (this->NinjaSupportsUnconditionalRecompactTool && expectBuildManifest && + !missingBuildManifest) { + run_ninja_tool({ "recompact" }); + } + if (this->NinjaSupportsRestatTool && this->OutputPathPrefix.empty()) { + // XXX(ninja): We only list `build.ninja` entry files here because CMake + // *always* rewrites these files on a reconfigure. If CMake ever gets + // smarter about this, all CMake-time created/edited files listed as + // outputs for the reconfigure build statement will need to be listed here. + cmNinjaDeps outputs; + this->AddRebuildManifestOutputs(outputs); + std::vector<const char*> args; + args.reserve(outputs.size() + 1); + args.push_back("restat"); + for (auto const& output : outputs) { + args.push_back(output.c_str()); + } + run_ninja_tool(args); } } @@ -640,6 +690,17 @@ bool cmGlobalNinjaGenerator::CheckLanguages( if (cmContains(languages, "Fortran")) { return this->CheckFortran(mf); } + if (cmContains(languages, "Swift")) { + const std::string architectures = + mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); + if (architectures.find_first_of(';') != std::string::npos) { + mf->IssueMessage(MessageType::FATAL_ERROR, + "multiple values for CMAKE_OSX_ARCHITECTURES not " + "supported with Swift"); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + } return true; } @@ -675,7 +736,7 @@ void cmGlobalNinjaGenerator::EnableLanguage( if (this->IsMultiConfig()) { if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) { mf->AddCacheDefinition( - "CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo", + "CMAKE_CONFIGURATION_TYPES", "Debug;Release;RelWithDebInfo", "Semicolon separated list of supported configuration types, only " "supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything " "else will be ignored", @@ -740,8 +801,7 @@ cmGlobalNinjaGenerator::GenerateBuildCommand( makeCommand.Add("-j", std::to_string(jobs)); } - this->AppendNinjaFileArgument(makeCommand, - config.empty() ? "Debug" : config); + this->AppendNinjaFileArgument(makeCommand, config); makeCommand.Add(makeOptions.begin(), makeOptions.end()); for (const auto& tname : targetNames) { @@ -830,6 +890,28 @@ bool cmGlobalNinjaGenerator::OpenFileStream( return true; } +cm::optional<std::set<std::string>> cmGlobalNinjaGenerator::ListSubsetWithAll( + const std::set<std::string>& defaults, const std::vector<std::string>& items) +{ + std::set<std::string> result; + + for (auto const& item : items) { + if (item == "all") { + if (items.size() == 1) { + result = defaults; + } else { + return cm::nullopt; + } + } else if (defaults.count(item)) { + result.insert(item); + } else { + return cm::nullopt; + } + } + + return cm::make_optional(result); +} + void cmGlobalNinjaGenerator::CloseBuildFileStreams() { if (this->BuildFileStream) { @@ -1133,6 +1215,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, // uses the output as an alias. for (std::string const& output : outputs) { this->TargetAliases[output].GeneratorTarget = nullptr; + this->DefaultTargetAliases[output].GeneratorTarget = nullptr; for (const std::string& config2 : this->Makefiles.front()->GetGeneratorConfigs()) { this->Configs[config2].TargetAliases[output].GeneratorTarget = nullptr; @@ -1144,19 +1227,26 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, TargetAlias ta; ta.GeneratorTarget = target; ta.Config = config; - std::pair<TargetAliasMap::iterator, bool> newAliasGlobal = + + auto newAliasGlobal = this->TargetAliases.insert(std::make_pair(buildAlias, ta)); if (newAliasGlobal.second && newAliasGlobal.first->second.GeneratorTarget != target) { newAliasGlobal.first->second.GeneratorTarget = nullptr; } - if (config != "all") { - std::pair<TargetAliasMap::iterator, bool> newAliasConfig = - this->Configs[config].TargetAliases.insert( - std::make_pair(outputPath, ta)); - if (newAliasConfig.second && - newAliasConfig.first->second.GeneratorTarget != target) { - newAliasConfig.first->second.GeneratorTarget = nullptr; + + auto newAliasConfig = + this->Configs[config].TargetAliases.insert(std::make_pair(outputPath, ta)); + if (newAliasConfig.second && + newAliasConfig.first->second.GeneratorTarget != target) { + newAliasConfig.first->second.GeneratorTarget = nullptr; + } + if (this->DefaultConfigs.count(config)) { + auto newAliasDefaultGlobal = + this->DefaultTargetAliases.insert(std::make_pair(outputPath, ta)); + if (newAliasDefaultGlobal.second && + newAliasDefaultGlobal.first->second.GeneratorTarget != target) { + newAliasDefaultGlobal.first->second.GeneratorTarget = nullptr; } } } @@ -1183,8 +1273,7 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) build.Outputs.front() = ta.first; build.ExplicitDeps.clear(); if (ta.second.Config == "all") { - for (auto const& config : - ta.second.GeneratorTarget->Makefile->GetGeneratorConfigs()) { + for (auto const& config : this->CrossConfigs) { this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps, config); } @@ -1192,9 +1281,11 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps, ta.second.Config); } - this->WriteBuild(this->EnableCrossConfigBuild() + this->WriteBuild(this->EnableCrossConfigBuild() && + (ta.second.Config == "all" || + this->CrossConfigs.count(ta.second.Config)) ? os - : *this->GetConfigFileStream(ta.second.Config), + : *this->GetImplFileStream(ta.second.Config), build); } @@ -1219,6 +1310,29 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) this->WriteBuild(*this->GetConfigFileStream(config), build); } } + + if (!this->DefaultConfigs.empty()) { + for (auto const& ta : this->DefaultTargetAliases) { + // Don't write ambiguous aliases. + if (!ta.second.GeneratorTarget) { + continue; + } + + // Don't write alias if there is a already a custom command with + // matching output + if (this->HasCustomCommandOutput(ta.first)) { + continue; + } + + build.Outputs.front() = ta.first; + build.ExplicitDeps.clear(); + for (auto const& config : this->DefaultConfigs) { + this->AppendTargetOutputs(ta.second.GeneratorTarget, + build.ExplicitDeps, config); + } + this->WriteBuild(*this->GetDefaultFileStream(), build); + } + } } } @@ -1262,9 +1376,10 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) } } // Write target - this->WriteBuild(this->EnableCrossConfigBuild() + this->WriteBuild(this->EnableCrossConfigBuild() && + this->CrossConfigs.count(config) ? os - : *this->GetConfigFileStream(config), + : *this->GetImplFileStream(config), build); } @@ -1277,12 +1392,23 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) this->ConvertToNinjaPath(currentBinaryDir + "/all"); this->WriteBuild(*this->GetConfigFileStream(config), build); } + + if (!this->DefaultFileConfig.empty()) { + build.ExplicitDeps.clear(); + for (auto const& config : this->DefaultConfigs) { + build.ExplicitDeps.push_back(this->BuildAlias( + this->ConvertToNinjaPath(currentBinaryDir + "/all"), config)); + } + build.Outputs.front() = + this->ConvertToNinjaPath(currentBinaryDir + "/all"); + this->WriteBuild(*this->GetDefaultFileStream(), build); + } } // Add target for all configs if (this->EnableCrossConfigBuild()) { build.ExplicitDeps.clear(); - for (auto const& config : configs) { + for (auto const& config : this->CrossConfigs) { build.ExplicitDeps.push_back(this->BuildAlias( this->ConvertToNinjaPath(currentBinaryDir + "/all"), config)); } @@ -1428,6 +1554,10 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) { this->WriteTargetDefault(*this->GetConfigFileStream(config)); } + + if (!this->DefaultFileConfig.empty()) { + this->WriteTargetDefault(*this->GetDefaultFileStream()); + } } void cmGlobalNinjaGenerator::WriteTargetDefault(std::ostream& os) @@ -1450,7 +1580,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) { cmNinjaRule rule("RERUN_CMAKE"); rule.Command = - cmStrCat(CMakeCmd(), " -S", + cmStrCat(CMakeCmd(), " --regenerate-during-build -S", lg->ConvertToOutputFormat(lg->GetSourceDirectory(), cmOutputConverter::SHELL), " -B", @@ -1720,9 +1850,10 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) } if (this->IsMultiConfig()) { build.Variables["FILE_ARG"] = cmStrCat( - "-f ", cmGlobalNinjaMultiGenerator::GetNinjaFilename(fileConfig)); + "-f ", + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); } - this->WriteBuild(*this->GetConfigFileStream(fileConfig), build); + this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } } @@ -1732,16 +1863,25 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) build.ExplicitDeps.clear(); if (additionalFiles) { - build.ExplicitDeps.push_back( - this->NinjaOutputPath(this->GetAdditionalCleanTargetName())); + for (auto const& config : this->CrossConfigs) { + build.ExplicitDeps.push_back(this->BuildAlias( + this->NinjaOutputPath(this->GetAdditionalCleanTargetName()), + config)); + } } - build.Variables["TARGETS"] = ""; + std::vector<std::string> byproducts; + for (auto const& config : this->CrossConfigs) { + byproducts.push_back( + this->BuildAlias(GetByproductsForCleanTargetName(), config)); + } + build.Variables["TARGETS"] = cmJoin(byproducts, " "); for (auto const& fileConfig : configs) { build.Variables["FILE_ARG"] = cmStrCat( - "-f ", cmGlobalNinjaMultiGenerator::GetNinjaFilename(fileConfig)); - this->WriteBuild(*this->GetConfigFileStream(fileConfig), build); + "-f ", + cmGlobalNinjaMultiGenerator::GetNinjaImplFilename(fileConfig)); + this->WriteBuild(*this->GetImplFileStream(fileConfig), build); } } } @@ -1757,6 +1897,15 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) this->NinjaOutputPath(this->GetCleanTargetName()), config); this->WriteBuild(*this->GetConfigFileStream(config), build); } + + if (!this->DefaultConfigs.empty()) { + build.ExplicitDeps.clear(); + for (auto const& config : this->DefaultConfigs) { + build.ExplicitDeps.push_back(this->BuildAlias( + this->NinjaOutputPath(this->GetCleanTargetName()), config)); + } + this->WriteBuild(*this->GetDefaultFileStream(), build); + } } // Write byproducts @@ -2202,8 +2351,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const { - return this->IsMultiConfig() && - this->Makefiles.front()->IsOn("CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE"); + return !this->CrossConfigs.empty(); } int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, @@ -2297,7 +2445,16 @@ void cmGlobalNinjaGenerator::AppendDirectoryForConfig( } } -const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE = "common.ninja"; +std::set<std::string> cmGlobalNinjaGenerator::GetCrossConfigs( + const std::string& fileConfig) const +{ + auto result = this->CrossConfigs; + result.insert(fileConfig); + return result; +} + +const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE = + "CMakeFiles/common.ninja"; const char* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja"; cmGlobalNinjaMultiGenerator::cmGlobalNinjaMultiGenerator(cmake* cm) @@ -2328,21 +2485,44 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams() return false; } + if (!this->DefaultFileConfig.empty()) { + if (!this->OpenFileStream(this->DefaultFileStream, NINJA_BUILD_FILE)) { + return false; + } + *this->DefaultFileStream + << "# This file is a convenience file generated by\n" + << "# CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG.\n\n" + << "include " << GetNinjaImplFilename(this->DefaultFileConfig) << "\n\n"; + } + // Write a comment about this file. *this->CommonFileStream << "# This file contains build statements common to all " "configurations.\n\n"; for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) { - if (!this->OpenFileStream(this->ConfigFileStreams[config], - GetNinjaFilename(config))) { + // Open impl file. + if (!this->OpenFileStream(this->ImplFileStreams[config], + GetNinjaImplFilename(config))) { return false; } // Write a comment about this file. - *this->ConfigFileStreams[config] + *this->ImplFileStreams[config] << "# This file contains build statements specific to the \"" << config << "\"\n# configuration.\n\n"; + + // Open config file. + if (!this->OpenFileStream(this->ConfigFileStreams[config], + GetNinjaConfigFilename(config))) { + return false; + } + + // Write a comment about this file. + *this->ConfigFileStreams[config] + << "# This file contains aliases specific to the \"" << config + << "\"\n# configuration.\n\n" + << "include " << GetNinjaImplFilename(config) << "\n\n"; } return true; @@ -2356,7 +2536,17 @@ void cmGlobalNinjaMultiGenerator::CloseBuildFileStreams() cmSystemTools::Error("Common file stream was not open."); } + if (this->DefaultFileStream) { + this->DefaultFileStream.reset(); + } // No error if it wasn't open + for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) { + if (this->ImplFileStreams[config]) { + this->ImplFileStreams[config].reset(); + } else { + cmSystemTools::Error( + cmStrCat("Impl file stream for \"", config, "\" was not open.")); + } if (this->ConfigFileStreams[config]) { this->ConfigFileStreams[config].reset(); } else { @@ -2369,11 +2559,20 @@ void cmGlobalNinjaMultiGenerator::CloseBuildFileStreams() void cmGlobalNinjaMultiGenerator::AppendNinjaFileArgument( GeneratedMakeCommand& command, const std::string& config) const { - command.Add("-f"); - command.Add(GetNinjaFilename(config)); + if (!config.empty()) { + command.Add("-f"); + command.Add(GetNinjaConfigFilename(config)); + } +} + +std::string cmGlobalNinjaMultiGenerator::GetNinjaImplFilename( + const std::string& config) +{ + return cmStrCat("CMakeFiles/impl-", config, + cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION); } -std::string cmGlobalNinjaMultiGenerator::GetNinjaFilename( +std::string cmGlobalNinjaMultiGenerator::GetNinjaConfigFilename( const std::string& config) { return cmStrCat("build-", config, @@ -2384,10 +2583,10 @@ void cmGlobalNinjaMultiGenerator::AddRebuildManifestOutputs( cmNinjaDeps& outputs) const { for (auto const& config : this->Makefiles.front()->GetGeneratorConfigs()) { - outputs.push_back(this->NinjaOutputPath(GetNinjaFilename(config))); + outputs.push_back(this->NinjaOutputPath(GetNinjaImplFilename(config))); + outputs.push_back(this->NinjaOutputPath(GetNinjaConfigFilename(config))); } - if (this->Makefiles.front()->GetDefinition( - "CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE")) { + if (!this->DefaultFileConfig.empty()) { outputs.push_back(this->NinjaOutputPath(NINJA_BUILD_FILE)); } } @@ -2402,19 +2601,88 @@ void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs( } } -bool cmGlobalNinjaMultiGenerator::WriteDefaultBuildFile() +bool cmGlobalNinjaMultiGenerator::InspectConfigTypeVariables() { - auto const* defaultConfig = this->Makefiles.front()->GetDefinition( - "CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE"); - if (defaultConfig) { - std::unique_ptr<cmGeneratedFileStream> defaultStream; - if (!this->OpenFileStream(defaultStream, NINJA_BUILD_FILE)) { + return this->ReadCacheEntriesForBuild(*this->Makefiles.front()->GetState()); +} + +std::string cmGlobalNinjaMultiGenerator::GetDefaultBuildConfig() const +{ + if (this->DefaultFileConfig.empty()) { + return "Debug"; + } + return ""; +} + +bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( + const cmState& state) +{ + std::vector<std::string> configsVec; + cmExpandList(state.GetSafeCacheEntryValue("CMAKE_CONFIGURATION_TYPES"), + configsVec); + if (configsVec.empty()) { + configsVec.emplace_back(); + } + std::set<std::string> configs(configsVec.cbegin(), configsVec.cend()); + + this->DefaultFileConfig = + state.GetSafeCacheEntryValue("CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG"); + if (!this->DefaultFileConfig.empty() && + !configs.count(this->DefaultFileConfig)) { + std::ostringstream msg; + msg << "The configuration specified by " + << "CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG (" << this->DefaultFileConfig + << ") is not present in CMAKE_CONFIGURATION_TYPES"; + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str()); + return false; + } + + std::vector<std::string> crossConfigsVec; + cmExpandList(state.GetSafeCacheEntryValue("CMAKE_NMC_CROSS_CONFIGS"), + crossConfigsVec); + auto crossConfigs = ListSubsetWithAll(configs, crossConfigsVec); + if (!crossConfigs) { + std::ostringstream msg; + msg << "CMAKE_NMC_CROSS_CONFIGS is not a subset of " + << "CMAKE_CONFIGURATION_TYPES"; + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str()); + return false; + } + this->CrossConfigs = *crossConfigs; + + auto defaultConfigsString = + state.GetSafeCacheEntryValue("CMAKE_NMC_DEFAULT_CONFIGS"); + if (defaultConfigsString.empty()) { + defaultConfigsString = this->DefaultFileConfig; + } + if (!defaultConfigsString.empty() && + defaultConfigsString != this->DefaultFileConfig && + (this->DefaultFileConfig.empty() || this->CrossConfigs.empty())) { + std::ostringstream msg; + msg << "CMAKE_NMC_DEFAULT_CONFIGS cannot be used without " + << "CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG or " + << "CMAKE_NMC_CROSS_CONFIGS"; + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str()); + return false; + } + + std::vector<std::string> defaultConfigsVec; + cmExpandList(defaultConfigsString, defaultConfigsVec); + if (!this->DefaultFileConfig.empty()) { + auto defaultConfigs = ListSubsetWithAll( + this->GetCrossConfigs(this->DefaultFileConfig), defaultConfigsVec); + if (!defaultConfigs) { + std::ostringstream msg; + msg << "CMAKE_NMC_DEFAULT_CONFIGS is not a subset of " + << "CMAKE_NMC_CROSS_CONFIGS"; + this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, + msg.str()); return false; } - *defaultStream << "# This file is a convenience file generated by\n" - << "# CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE.\n\n" - << "include " << this->GetNinjaFilename(defaultConfig) - << "\n"; + this->DefaultConfigs = *defaultConfigs; } return true; diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3545f1e..a59859e 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -15,6 +15,8 @@ #include <utility> #include <vector> +#include <cm/optional> + #include "cm_codecvt.hxx" #include "cmGeneratedFileStream.h" @@ -30,6 +32,7 @@ class cmLinkLineComputer; class cmLocalGenerator; class cmMakefile; class cmOutputConverter; +class cmState; class cmStateDirectory; class cmake; struct cmDocumentationEntry; @@ -208,12 +211,25 @@ public: } const char* GetCleanTargetName() const override { return "clean"; } + bool SupportsCustomCommandDepfile() const override { return true; } + + virtual cmGeneratedFileStream* GetImplFileStream( + const std::string& /*config*/) const + { + return this->BuildFileStream.get(); + } + virtual cmGeneratedFileStream* GetConfigFileStream( const std::string& /*config*/) const { return this->BuildFileStream.get(); } + virtual cmGeneratedFileStream* GetDefaultFileStream() const + { + return this->BuildFileStream.get(); + } + virtual cmGeneratedFileStream* GetCommonFileStream() const { return this->BuildFileStream.get(); @@ -397,6 +413,8 @@ public: bool EnableCrossConfigBuild() const; + std::set<std::string> GetCrossConfigs(const std::string& config) const; + protected: void Generate() override; @@ -404,11 +422,20 @@ protected: virtual bool OpenBuildFileStreams(); virtual void CloseBuildFileStreams(); - virtual bool WriteDefaultBuildFile() { return true; } bool OpenFileStream(std::unique_ptr<cmGeneratedFileStream>& stream, const std::string& name); + static cm::optional<std::set<std::string>> ListSubsetWithAll( + const std::set<std::string>& defaults, + const std::vector<std::string>& items); + + virtual bool InspectConfigTypeVariables() { return true; } + + std::set<std::string> CrossConfigs; + std::set<std::string> DefaultConfigs; + std::string DefaultFileConfig; + private: std::string GetEditCacheCommand() const override; bool FindMakeProgram(cmMakefile* mf) override; @@ -421,6 +448,7 @@ private: bool OpenRulesFileStream(); void CloseRulesFileStream(); + void CleanMetaData(); /// Write the common disclaimer text at the top of each build file. void WriteDisclaimer(std::ostream& os); @@ -486,6 +514,7 @@ private: }; using TargetAliasMap = std::map<std::string, TargetAlias>; TargetAliasMap TargetAliases; + TargetAliasMap DefaultTargetAliases; /// the local cache for calls to ConvertToNinjaPath mutable std::unordered_map<std::string, std::string> ConvertToNinjaPathCache; @@ -573,12 +602,23 @@ public: std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const override; + cmGeneratedFileStream* GetImplFileStream( + const std::string& config) const override + { + return this->ImplFileStreams.at(config).get(); + } + cmGeneratedFileStream* GetConfigFileStream( const std::string& config) const override { return this->ConfigFileStreams.at(config).get(); } + cmGeneratedFileStream* GetDefaultFileStream() const override + { + return this->DefaultFileStream.get(); + } + cmGeneratedFileStream* GetCommonFileStream() const override { return this->CommonFileStream.get(); @@ -587,13 +627,18 @@ public: void AppendNinjaFileArgument(GeneratedMakeCommand& command, const std::string& config) const override; - static std::string GetNinjaFilename(const std::string& config); + static std::string GetNinjaImplFilename(const std::string& config); + static std::string GetNinjaConfigFilename(const std::string& config); void AddRebuildManifestOutputs(cmNinjaDeps& outputs) const override; void GetQtAutoGenConfigs(std::vector<std::string>& configs) const override; - bool WriteDefaultBuildFile() override; + bool InspectConfigTypeVariables() override; + + std::string GetDefaultBuildConfig() const override; + + bool ReadCacheEntriesForBuild(const cmState& state) override; protected: bool OpenBuildFileStreams() override; @@ -601,8 +646,11 @@ protected: private: std::map<std::string, std::unique_ptr<cmGeneratedFileStream>> + ImplFileStreams; + std::map<std::string, std::unique_ptr<cmGeneratedFileStream>> ConfigFileStreams; std::unique_ptr<cmGeneratedFileStream> CommonFileStream; + std::unique_ptr<cmGeneratedFileStream> DefaultFileStream; }; #endif // ! cmGlobalNinjaGenerator_h diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0591758..90c9ef0 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -892,6 +892,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( // Keep track of targets already listed. std::set<std::string> emittedTargets; + std::set<std::string> utility_targets; + std::set<std::string> globals_targets; + std::set<std::string> project_targets; // for each local generator for (const auto& localGen : this->LocalGenerators) { @@ -907,18 +910,30 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( (type == cmStateEnums::STATIC_LIBRARY) || (type == cmStateEnums::SHARED_LIBRARY) || (type == cmStateEnums::MODULE_LIBRARY) || - (type == cmStateEnums::OBJECT_LIBRARY) || - (type == cmStateEnums::GLOBAL_TARGET) || - (type == cmStateEnums::UTILITY)) { - std::string const& name = target->GetName(); - if (emittedTargets.insert(name).second) { - path = cmStrCat("... ", name); - lg->AppendEcho(commands, path); - } + (type == cmStateEnums::OBJECT_LIBRARY)) { + project_targets.insert(target->GetName()); + } else if (type == cmStateEnums::GLOBAL_TARGET) { + globals_targets.insert(target->GetName()); + } else if (type == cmStateEnums::UTILITY) { + utility_targets.insert(target->GetName()); } } } } + + for (std::string const& name : globals_targets) { + path = cmStrCat("... ", name); + lg->AppendEcho(commands, path); + } + for (std::string const& name : utility_targets) { + path = cmStrCat("... ", name); + lg->AppendEcho(commands, path); + } + for (std::string const& name : project_targets) { + path = cmStrCat("... ", name); + lg->AppendEcho(commands, path); + } + for (std::string const& o : lg->GetLocalHelp()) { path = cmStrCat("... ", o); lg->AppendEcho(commands, path); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a720cc3..ccb6c50 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -250,6 +250,12 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( } } + this->SupportsUnityBuilds = + this->Version >= cmGlobalVisualStudioGenerator::VS16 || + (this->Version == cmGlobalVisualStudioGenerator::VS15 && + cmSystemTools::PathExists(this->VCTargetsPath + + "/Microsoft.Cpp.Unity.targets")); + if (this->GeneratorToolsetCuda.empty()) { // Find the highest available version of the CUDA tools. std::vector<std::string> cudaTools; @@ -615,7 +621,7 @@ void cmGlobalVisualStudio10Generator::Generate() "To avoid this problem CMake must use a full path for this file " "which then triggers the VS 10 property dialog bug."; /* clang-format on */ - lg->IssueMessage(MessageType::WARNING, e.str().c_str()); + lg->IssueMessage(MessageType::WARNING, e.str()); } } @@ -836,7 +842,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) // Prepare the work directory. if (!cmSystemTools::MakeDirectory(wd)) { std::string e = "Failed to make directory:\n " + wd; - mf->IssueMessage(MessageType::FATAL_ERROR, e.c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -957,7 +963,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) if (ret != 0) { e << "Exit code: " << ret << "\n"; } - mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -1131,8 +1137,7 @@ std::string cmGlobalVisualStudio10Generator::GenerateRuleFile( // Hide them away under the CMakeFiles directory. std::string ruleDir = cmStrCat( this->GetCMakeInstance()->GetHomeOutputDirectory(), "/CMakeFiles/", - cmSystemTools::ComputeStringMD5( - cmSystemTools::GetFilenamePath(output).c_str())); + cmSystemTools::ComputeStringMD5(cmSystemTools::GetFilenamePath(output))); std::string ruleFile = cmStrCat(ruleDir, '/', cmSystemTools::GetFilenameName(output), ".rule"); return ruleFile; @@ -1326,7 +1331,7 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( e << "JSON flag table \"" << filename << "\" could not be loaded.\n"; /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); } return ret; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 2120785..f659ff3 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -115,6 +115,8 @@ public: virtual bool IsDefaultToolset(const std::string& version) const; virtual std::string GetAuxiliaryToolset() const; + bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; } + bool FindMakeProgram(cmMakefile* mf) override; bool IsIPOSupported() const override { return true; } @@ -180,6 +182,7 @@ protected: std::string DefaultMasmFlagTableName; std::string DefaultNasmFlagTableName; std::string DefaultRCFlagTableName; + bool SupportsUnityBuilds = false; bool SystemIsWindowsCE; bool SystemIsWindowsPhone; bool SystemIsWindowsStore; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index e8e9ece..ec1380b 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -87,7 +87,7 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations( // the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const std::string& dspname, - const char* dir, + const std::string& dir, cmGeneratorTarget const* t) { // check to see if this is a fortran build @@ -109,7 +109,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, std::string guid = this->GetGUID(dspname); fout << project << dspname << "\", \"" << this->ConvertToSolutionPath(dir) - << (dir[0] ? "\\" : "") << dspname << ext << "\", \"{" << guid + << (!dir.empty() ? "\\" : "") << dspname << ext << "\", \"{" << guid << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); @@ -138,7 +138,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProjectDepends( - std::ostream& fout, const std::string&, const char*, + std::ostream& fout, const std::string&, const std::string&, cmGeneratorTarget const* target) { VSDependSet const& depends = this->VSTargetDepends[target]; @@ -156,7 +156,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends( // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteExternalProject( - std::ostream& fout, const std::string& name, const char* location, + std::ostream& fout, const std::string& name, const std::string& location, const char* typeGuid, const std::set<BT<std::string>>& depends) { fout << "Project(\"{" diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 85755af..61a2f6f 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -22,9 +22,10 @@ protected: virtual void WriteSolutionConfigurations( std::ostream& fout, std::vector<std::string> const& configs); void WriteProject(std::ostream& fout, const std::string& name, - const char* path, const cmGeneratorTarget* t) override; + const std::string& path, + const cmGeneratorTarget* t) override; void WriteProjectDepends(std::ostream& fout, const std::string& name, - const char* path, + const std::string& path, cmGeneratorTarget const* t) override; void WriteProjectConfigurations( std::ostream& fout, const std::string& name, @@ -32,7 +33,7 @@ protected: const std::set<std::string>& configsPartOfDefaultBuild, const std::string& platformMapping = "") override; void WriteExternalProject(std::ostream& fout, const std::string& name, - const char* path, const char* typeGuid, + const std::string& path, const char* typeGuid, const std::set<BT<std::string>>& depends) override; // Folders are not supported by VS 7.1. diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 04ec7b3..9799124 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -186,7 +186,7 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() } const char* cmGlobalVisualStudio7Generator::ExternalProjectType( - const char* location) + const std::string& location) { std::string extension = cmSystemTools::GetFilenameLastExtension(location); if (extension == ".vbproj") { @@ -346,8 +346,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if (expath) { std::set<std::string> allConfigurations(configs.begin(), configs.end()); const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING"); - this->WriteProjectConfigurations(fout, target->GetName().c_str(), - *target, configs, allConfigurations, + this->WriteProjectConfigurations(fout, target->GetName(), *target, + configs, allConfigurations, mapping ? mapping : ""); } else { const std::set<std::string>& configsPartOfDefaultBuild = @@ -380,7 +380,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string project = target->GetName(); std::string location = expath; - this->WriteExternalProject(fout, project.c_str(), location.c_str(), + this->WriteExternalProject(fout, project, location, target->GetProperty("VS_PROJECT_TYPE"), target->GetUtilities()); written = true; @@ -389,11 +389,11 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (vcprojName) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str()); + dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir); if (dir == ".") { dir.clear(); // msbuild cannot handle ".\" prefix } - this->WriteProject(fout, vcprojName, dir.c_str(), target); + this->WriteProject(fout, vcprojName, dir, target); written = true; } } @@ -483,7 +483,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout) } std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath( - const char* path) + const std::string& path) { // Convert to backslashes. Do not use ConvertToOutputPath because // we will add quoting ourselves, and we know these projects always diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 974bb1d..699f091 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -110,16 +110,17 @@ protected: std::string const& GetDevEnvCommand(); virtual std::string FindDevEnvCommand(); - static const char* ExternalProjectType(const char* location); + static const char* ExternalProjectType(const std::string& location); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators) = 0; virtual void WriteProject(std::ostream& fout, const std::string& name, - const char* path, const cmGeneratorTarget* t) = 0; + const std::string& path, + const cmGeneratorTarget* t) = 0; virtual void WriteProjectDepends(std::ostream& fout, const std::string& name, - const char* path, + const std::string& path, cmGeneratorTarget const* t) = 0; virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, @@ -141,10 +142,10 @@ protected: OrderedTargetDependSet const& projectTargets); virtual void WriteExternalProject( - std::ostream& fout, const std::string& name, const char* path, + std::ostream& fout, const std::string& name, const std::string& path, const char* typeGuid, const std::set<BT<std::string>>& dependencies) = 0; - std::string ConvertToSolutionPath(const char* path); + std::string ConvertToSolutionPath(const std::string& path); std::set<std::string> IsPartOfDefaultBuild( std::vector<std::string> const& configs, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ba54f98..c0551f7 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -307,7 +307,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() } void cmGlobalVisualStudio8Generator::WriteProjectDepends( - std::ostream& fout, const std::string&, const char*, + std::ostream& fout, const std::string&, const std::string&, cmGeneratorTarget const* gt) { TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 352bc3c..8f8e33b 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -74,7 +74,7 @@ protected: const std::string& platformMapping = "") override; bool ComputeTargetDepends() override; void WriteProjectDepends(std::ostream& fout, const std::string& name, - const char* path, + const std::string& path, const cmGeneratorTarget* t) override; bool UseFolderProperty() const override; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index be5cfd4..012a77c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -308,7 +308,7 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro( if (!dir.empty()) { std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME; std::string nextSubkeyName; - if (cmSystemTools::FileExists(macrosFile.c_str()) && + if (cmSystemTools::FileExists(macrosFile) && IsVisualStudioMacrosFileRegistered( macrosFile, this->GetUserMacrosRegKeyBase(), nextSubkeyName)) { if (m == MacroReload) { @@ -593,7 +593,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, std::string filepath; std::string filepathname; std::string filepathpath; - if (cmSystemTools::FileExists(fullname.c_str())) { + if (cmSystemTools::FileExists(fullname)) { filename = cmSystemTools::GetFilenameName(fullname); filepath = cmSystemTools::GetFilenamePath(fullname); filepathname = cmSystemTools::GetFilenameName(filepath); @@ -917,7 +917,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( std::string objFile = it; // replace $(ConfigurationName) in the object names cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(), - configName.c_str()); + configName); if (cmHasLiteralSuffix(objFile, ".obj")) { fout << objFile << "\n"; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f887284..3d5c9c4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -528,7 +528,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets( root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY"); bool isTopLevel = !root->GetStateSnapshot().GetBuildsystemDirectoryParent().IsValid(); - if (regenerate && (isTopLevel || !generateTopLevelProjectOnly)) { + bool isGenerateProject = isTopLevel || !generateTopLevelProjectOnly; + if (regenerate && isGenerateProject) { this->CreateReRunCMakeFile(root, gens); std::string file = this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile); @@ -558,7 +559,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // run the depend check makefile as a post build rule // this will make sure that when the next target is built // things are up-to-date - if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { + if (isGenerateProject && + target->GetType() == cmStateEnums::OBJECT_LIBRARY) { commandLines.front().back() = // fill placeholder this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)"); gen->AddCustomCommandToTarget( @@ -2366,8 +2368,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, int minor; int patch; - // VERSION -> current_version - gtgt->GetTargetVersion(false, major, minor, patch); + // OSX_CURRENT_VERSION or VERSION -> current_version + gtgt->GetTargetVersionFallback("OSX_CURRENT_VERSION", "VERSION", major, + minor, patch); std::ostringstream v; // Xcode always wants at least 1.0.0 or nothing @@ -2377,8 +2380,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, buildSettings->AddAttribute("DYLIB_CURRENT_VERSION", this->CreateString(v.str())); - // SOVERSION -> compatibility_version - gtgt->GetTargetVersion(true, major, minor, patch); + // OSX_COMPATIBILITY_VERSION or SOVERSION -> compatibility_version + gtgt->GetTargetVersionFallback("OSX_COMPATIBILITY_VERSION", "SOVERSION", + major, minor, patch); std::ostringstream vso; // Xcode always wants at least 1.0.0 or nothing diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index e59c428..86a0921 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -77,8 +77,8 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args, if (!customGuid.empty()) { std::string guidVariable = utility_name + "_GUID_CMAKE"; - mf.GetCMakeInstance()->AddCacheEntry(guidVariable.c_str(), - customGuid.c_str(), "Stored GUID", + mf.GetCMakeInstance()->AddCacheEntry(guidVariable, customGuid.c_str(), + "Stored GUID", cmStateEnums::INTERNAL); } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 5088379..c67358f 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -196,14 +196,14 @@ bool HandleScriptMode(std::vector<std::string> const& args, return false; } helper.Makefile->AddInstallGenerator( - cm::make_unique<cmInstallScriptGenerator>( - script, false, component.c_str(), exclude_from_all)); + cm::make_unique<cmInstallScriptGenerator>(script, false, component, + exclude_from_all)); } else if (doing_code) { doing_code = false; std::string const& code = arg; helper.Makefile->AddInstallGenerator( - cm::make_unique<cmInstallScriptGenerator>( - code, true, component.c_str(), exclude_from_all)); + cm::make_unique<cmInstallScriptGenerator>(code, true, component, + exclude_from_all)); } } @@ -942,7 +942,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args, bool exclude_from_all = false; bool message_never = false; std::vector<std::string> dirs; - const char* destination = nullptr; + const std::string* destination = nullptr; std::string permissions_file; std::string permissions_dir; std::vector<std::string> configurations; @@ -1101,7 +1101,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args, } else if (doing == DoingConfigurations) { configurations.push_back(args[i]); } else if (doing == DoingDestination) { - destination = args[i].c_str(); + destination = &args[i]; doing = DoingNone; } else if (doing == DoingType) { if (allowedTypes.count(args[i]) == 0) { @@ -1187,7 +1187,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args, return false; } destinationStr = helper.GetDestinationForType(nullptr, type); - destination = destinationStr.c_str(); + destination = &destinationStr; } else if (!type.empty()) { status.SetError(cmStrCat(args[0], " given both TYPE and DESTINATION " @@ -1201,7 +1201,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args, // Create the directory install generator. helper.Makefile->AddInstallGenerator( cm::make_unique<cmInstallDirectoryGenerator>( - dirs, destination, permissions_file, permissions_dir, configurations, + dirs, *destination, permissions_file, permissions_dir, configurations, component, message, exclude_from_all, literal_args, optional)); // Tell the global generator about any installation component names diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 7e3148a..175e7cf 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -12,12 +12,12 @@ #include "cmSystemTools.h" cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( - std::vector<std::string> const& dirs, const char* dest, + std::vector<std::string> const& dirs, std::string const& dest, std::string file_permissions, std::string dir_permissions, std::vector<std::string> const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string literal_args, bool optional) - : cmInstallGenerator(dest, configurations, component.c_str(), message, + : cmInstallGenerator(dest, configurations, component, message, exclude_from_all) , LocalGenerator(nullptr) , Directories(dirs) diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index e53e81c..bec89df 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -21,7 +21,8 @@ class cmInstallDirectoryGenerator : public cmInstallGenerator { public: cmInstallDirectoryGenerator(std::vector<std::string> const& dirs, - const char* dest, std::string file_permissions, + std::string const& dest, + std::string file_permissions, std::string dir_permissions, std::vector<std::string> const& configurations, std::string const& component, diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index ff32ef1..2c53a28 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -22,8 +22,8 @@ cmInstallExportGenerator::cmInstallExportGenerator( std::string file_permissions, std::vector<std::string> const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string filename, std::string name_space, bool exportOld, bool android) - : cmInstallGenerator(destination.c_str(), configurations, component.c_str(), - message, exclude_from_all) + : cmInstallGenerator(destination, configurations, component, message, + exclude_from_all) , ExportSet(exportSet) , FilePermissions(std::move(file_permissions)) , FileName(std::move(filename)) diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index e470ff8..ad2f84e 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -16,8 +16,8 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( std::vector<std::string> const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string rename, bool optional) - : cmInstallGenerator(dest.c_str(), configurations, component.c_str(), - message, exclude_from_all) + : cmInstallGenerator(dest, configurations, component, message, + exclude_from_all) , LocalGenerator(nullptr) , Files(files) , FilePermissions(std::move(file_permissions)) diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index ec17361..0665895 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -3,16 +3,17 @@ #include "cmInstallGenerator.h" #include <ostream> +#include <utility> #include "cmMakefile.h" #include "cmSystemTools.h" cmInstallGenerator::cmInstallGenerator( - const char* destination, std::vector<std::string> const& configurations, - const char* component, MessageLevel message, bool exclude_from_all) + std::string destination, std::vector<std::string> const& configurations, + std::string component, MessageLevel message, bool exclude_from_all) : cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations) - , Destination(destination ? destination : "") - , Component(component ? component : "") + , Destination(std::move(destination)) + , Component(std::move(component)) , Message(message) , ExcludeFromAll(exclude_from_all) { @@ -139,8 +140,8 @@ void cmInstallGenerator::AddInstallRule( os << ")\n"; } -std::string cmInstallGenerator::CreateComponentTest(const char* component, - bool exclude_from_all) +std::string cmInstallGenerator::CreateComponentTest( + const std::string& component, bool exclude_from_all) { std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)"; result += component; @@ -158,7 +159,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Begin this block of installation. std::string component_test = - this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); + this->CreateComponentTest(this->Component, this->ExcludeFromAll); os << indent << "if(" << component_test << ")\n"; // Generate the script possibly with per-configuration code. diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 024027d..d786d24 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -30,9 +30,9 @@ public: MessageNever }; - cmInstallGenerator(const char* destination, + cmInstallGenerator(std::string destination, std::vector<std::string> const& configurations, - const char* component, MessageLevel message, + std::string component, MessageLevel message, bool exclude_from_all); ~cmInstallGenerator() override; @@ -65,14 +65,14 @@ public: protected: void GenerateScript(std::ostream& os) override; - std::string CreateComponentTest(const char* component, + std::string CreateComponentTest(const std::string& component, bool exclude_from_all); // Information shared by most generator types. - std::string Destination; - std::string Component; - MessageLevel Message; - bool ExcludeFromAll; + std::string const Destination; + std::string const Component; + MessageLevel const Message; + bool const ExcludeFromAll; }; #endif diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 77680d2..7cdf3b4 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -12,11 +12,10 @@ #include "cmPolicies.h" #include "cmScriptGenerator.h" -cmInstallScriptGenerator::cmInstallScriptGenerator(std::string script, - bool code, - const char* component, - bool exclude_from_all) - : cmInstallGenerator(nullptr, std::vector<std::string>(), component, +cmInstallScriptGenerator::cmInstallScriptGenerator( + std::string script, bool code, std::string const& component, + bool exclude_from_all) + : cmInstallGenerator("", std::vector<std::string>(), component, MessageDefault, exclude_from_all) , Script(std::move(script)) , Code(code) diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index d22c6ec..0a9c4ba 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -20,7 +20,8 @@ class cmInstallScriptGenerator : public cmInstallGenerator { public: cmInstallScriptGenerator(std::string script, bool code, - const char* component, bool exclude_from_all); + std::string const& component, + bool exclude_from_all); ~cmInstallScriptGenerator() override; bool Compute(cmLocalGenerator* lg) override; diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx index 8b45972..12bc92b 100644 --- a/Source/cmInstallSubdirectoryGenerator.cxx +++ b/Source/cmInstallSubdirectoryGenerator.cxx @@ -15,8 +15,8 @@ cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator( cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll) - : cmInstallGenerator(nullptr, std::vector<std::string>(), nullptr, - MessageDefault, excludeFromAll) + : cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault, + excludeFromAll) , Makefile(makefile) , BinaryDirectory(std::move(binaryDirectory)) { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index d2fc2ea..e05daa8 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -29,8 +29,8 @@ cmInstallTargetGenerator::cmInstallTargetGenerator( std::string file_permissions, std::vector<std::string> const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, bool optional, cmListFileBacktrace backtrace) - : cmInstallGenerator(dest.c_str(), configurations, component.c_str(), - message, exclude_from_all) + : cmInstallGenerator(dest, configurations, component, message, + exclude_from_all) , TargetName(std::move(targetName)) , Target(nullptr) , FilePermissions(std::move(file_permissions)) diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index cb63ceb..2b8f836 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -32,7 +32,7 @@ bool cmLinkLibrariesCommand(std::vector<std::string> const& args, } mf.AppendProperty("LINK_LIBRARIES", "optimized"); } - mf.AppendProperty("LINK_LIBRARIES", i->c_str()); + mf.AppendProperty("LINK_LIBRARIES", *i); } return true; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 02dedc1..cf6802d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1969,7 +1969,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::UNKNOWN_LIBRARY: - dep = target->GetLocation(config); + dep = target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact, + /*realname=*/true); return true; case cmStateEnums::OBJECT_LIBRARY: // An object library has no single file on which to depend. @@ -2748,11 +2749,11 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags( } void cmLocalGenerator::AppendCompileOptions(std::string& options, - const char* options_list, + std::string const& options_list, const char* regex) const { // Short-circuit if there are no options. - if (!options_list) { + if (options_list.empty()) { return; } @@ -2806,11 +2807,11 @@ void cmLocalGenerator::AppendCompileOptions( } void cmLocalGenerator::AppendIncludeDirectories( - std::vector<std::string>& includes, const char* includes_list, + std::vector<std::string>& includes, const std::string& includes_list, const cmSourceFile& sourceFile) const { // Short-circuit if there are no includes. - if (!includes_list) { + if (includes_list.empty()) { return; } @@ -3028,7 +3029,7 @@ void cmLocalGenerator::GenerateTargetInstallRules( // Include the user-specified pre-install script for this target. if (const char* preinstall = l->GetProperty("PRE_INSTALL_SCRIPT")) { - cmInstallScriptGenerator g(preinstall, false, nullptr, false); + cmInstallScriptGenerator g(preinstall, false, "", false); g.Generate(os, config, configurationTypes); } @@ -3081,7 +3082,7 @@ void cmLocalGenerator::GenerateTargetInstallRules( // Include the user-specified post-install script for this target. if (const char* postinstall = l->GetProperty("POST_INSTALL_SCRIPT")) { - cmInstallScriptGenerator g(postinstall, false, nullptr, false); + cmInstallScriptGenerator g(postinstall, false, "", false); g.Generate(os, config, configurationTypes); } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index b91d5f7..88194b7 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -167,15 +167,8 @@ public: * Process a list of include directories */ void AppendIncludeDirectories(std::vector<std::string>& includes, - const char* includes_list, - const cmSourceFile& sourceFile) const; - void AppendIncludeDirectories(std::vector<std::string>& includes, std::string const& includes_list, - const cmSourceFile& sourceFile) const - { - this->AppendIncludeDirectories(includes, includes_list.c_str(), - sourceFile); - } + const cmSourceFile& sourceFile) const; void AppendIncludeDirectories(std::vector<std::string>& includes, const std::vector<std::string>& includes_vec, const cmSourceFile& sourceFile) const; @@ -195,14 +188,9 @@ public: * Encode a list of compile options for the compiler * command line. */ - void AppendCompileOptions(std::string& options, const char* options_list, - const char* regex = nullptr) const; void AppendCompileOptions(std::string& options, std::string const& options_list, - const char* regex = nullptr) const - { - this->AppendCompileOptions(options, options_list.c_str(), regex); - } + const char* regex = nullptr) const; void AppendCompileOptions(std::string& options, const std::vector<std::string>& options_vec, const char* regex = nullptr) const; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6967097..be1dd0d 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -64,7 +64,7 @@ void cmLocalNinjaGenerator::Generate() if (this->GetGlobalGenerator()->IsMultiConfig()) { for (auto const& config : this->GetConfigNames()) { - this->WriteProcessedMakefile(this->GetConfigFileStream(config)); + this->WriteProcessedMakefile(this->GetImplFileStream(config)); } } this->WriteProcessedMakefile(this->GetCommonFileStream()); @@ -154,10 +154,10 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference( // Private methods. -cmGeneratedFileStream& cmLocalNinjaGenerator::GetConfigFileStream( +cmGeneratedFileStream& cmLocalNinjaGenerator::GetImplFileStream( const std::string& config) const { - return *this->GetGlobalNinjaGenerator()->GetConfigFileStream(config); + return *this->GetGlobalNinjaGenerator()->GetImplFileStream(config); } cmGeneratedFileStream& cmLocalNinjaGenerator::GetCommonFileStream() const @@ -186,7 +186,7 @@ void cmLocalNinjaGenerator::WriteBuildFileTop() if (this->GetGlobalGenerator()->IsMultiConfig()) { for (auto const& config : this->GetConfigNames()) { - auto& stream = this->GetConfigFileStream(config); + auto& stream = this->GetImplFileStream(config); this->WriteProjectHeader(stream); this->WriteNinjaRequiredVersion(stream); this->WriteNinjaConfigurationVariable(stream, config); @@ -560,7 +560,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( build.Outputs = std::move(ninjaOutputs); build.ExplicitDeps = std::move(ninjaDeps); build.OrderOnlyDeps = orderOnlyDeps; - gg->WriteBuild(this->GetConfigFileStream(config), build); + gg->WriteBuild(this->GetImplFileStream(config), build); } else { std::string customStep = cmSystemTools::GetFilenameName(ninjaOutputs[0]); // Hash full path to make unique. diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 0445879..ef160e7 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -86,7 +86,7 @@ protected: bool forceFullPaths = false) override; private: - cmGeneratedFileStream& GetConfigFileStream(const std::string& config) const; + cmGeneratedFileStream& GetImplFileStream(const std::string& config) const; cmGeneratedFileStream& GetCommonFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dbdde48..d037b93 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -683,9 +683,15 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop( if (!this->IsNMake() && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack) { // turn off RCS and SCCS automatic stuff from gmake - makefileStream - << "# Remove some rules from gmake that .SUFFIXES does not remove.\n" - << "SUFFIXES =\n\n"; + constexpr const char* vcs_rules[] = { + "%,v", "RCS/%", "RCS/%,v", "SCCS/s.%", "s.%", + }; + for (auto vcs_rule : vcs_rules) { + std::vector<std::string> vcs_depend; + vcs_depend.emplace_back(vcs_rule); + this->WriteMakeRule(makefileStream, "Disable VCS-based implicit rules.", + "%", vcs_depend, no_commands, false); + } } // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make. std::vector<std::string> depends; @@ -1966,18 +1972,18 @@ void cmLocalUnixMakefileGenerator3::WriteDivider(std::ostream& os) } void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os, - const char* s) + const std::string& s) { // Write the given string to the stream with escaping to get it back // into CMake through the lexical scanner. os << "\""; - for (const char* c = s; *c; ++c) { - if (*c == '\\') { + for (char c : s) { + if (c == '\\') { os << "\\\\"; - } else if (*c == '"') { + } else if (c == '"') { os << "\\\""; } else { - os << *c; + os << c; } } os << "\""; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 1629e63..68eeb29 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -77,7 +77,7 @@ public: void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; } // used in writing out Cmake files such as WriteDirectoryInformation - static void WriteCMakeArgument(std::ostream& os, const char* s); + static void WriteCMakeArgument(std::ostream& os, const std::string& s); /** creates the common disclaimer text at the top of each makefile */ void WriteDisclaimer(std::ostream& os); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 6f456c6..02e2c6d 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -128,8 +128,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID( std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE"); // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( - guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmStateEnums::INTERNAL); + guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL); } const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index a35dc20..0b0d9ac 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -167,7 +167,7 @@ bool cmMacroFunctionBlocker::Replay(std::vector<cmListFileFunction> functions, cmExecutionStatus& status) { cmMakefile& mf = status.GetMakefile(); - mf.AppendProperty("MACROS", this->Args[0].c_str()); + mf.AppendProperty("MACROS", this->Args[0]); // create a new command and add it to cmake cmMacroHelperCommand f; f.Args = this->Args; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 668a27d..b2e59bd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -7,7 +7,6 @@ #include <algorithm> #include <cassert> #include <cctype> -#include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> @@ -334,12 +333,15 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const Json::StreamWriterBuilder builder; builder["indentation"] = ""; val["file"] = full_path; - val["line"] = static_cast<std::int64_t>(lff.Line); + val["line"] = static_cast<Json::Value::Int64>(lff.Line); val["cmd"] = lff.Name.Original; val["args"] = Json::Value(Json::arrayValue); for (std::string const& arg : args) { val["args"].append(arg); } + val["time"] = cmSystemTools::GetTime(); + val["frame"] = + static_cast<Json::Value::UInt64>(this->ExecutionStatusStack.size()); msg << Json::writeString(builder, val); #endif break; @@ -1285,17 +1287,17 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag) void cmMakefile::AddCompileDefinition(std::string const& option) { - this->AppendProperty("COMPILE_DEFINITIONS", option.c_str()); + this->AppendProperty("COMPILE_DEFINITIONS", option); } void cmMakefile::AddCompileOption(std::string const& option) { - this->AppendProperty("COMPILE_OPTIONS", option.c_str()); + this->AppendProperty("COMPILE_OPTIONS", option); } void cmMakefile::AddLinkOption(std::string const& option) { - this->AppendProperty("LINK_OPTIONS", option.c_str()); + this->AppendProperty("LINK_OPTIONS", option); } void cmMakefile::AddLinkDirectory(std::string const& directory, bool before) @@ -4036,8 +4038,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) this->StateSnapshot.GetDirectory().SetProperty(prop, value, this->Backtrace); } -void cmMakefile::AppendProperty(const std::string& prop, const char* value, - bool asString) +void cmMakefile::AppendProperty(const std::string& prop, + const std::string& value, bool asString) { this->StateSnapshot.GetDirectory().AppendProperty(prop, value, asString, this->Backtrace); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index b13716b..f1a68c2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -135,7 +135,7 @@ public: std::unique_ptr<cmFunctionBlocker> RemoveFunctionBlocker(); /** - * Try running cmake and building a file. This is used for dynalically + * Try running cmake and building a file. This is used for dynamically * loaded commands, not as part of the usual build process. */ int TryCompile(const std::string& srcdir, const std::string& bindir, @@ -419,9 +419,9 @@ public: { this->ComplainFileRegularExpression = regex; } - const char* GetComplainRegularExpression() const + const std::string& GetComplainRegularExpression() const { - return this->ComplainFileRegularExpression.c_str(); + return this->ComplainFileRegularExpression; } // -- List of targets @@ -784,7 +784,7 @@ public: //! Set/Get a property of this directory void SetProperty(const std::string& prop, const char* value); - void AppendProperty(const std::string& prop, const char* value, + void AppendProperty(const std::string& prop, const std::string& value, bool asString = false); const char* GetProperty(const std::string& prop) const; const char* GetProperty(const std::string& prop, bool chain) const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1df5410..0471a45 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -196,6 +196,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects, buildObjs, depends, useWatcomQuote); + std::string const& aixExports = this->GetAIXExports(this->GetConfigName()); + cmRulePlaceholderExpander::RuleVariables vars; std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); @@ -219,6 +221,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( cmOutputConverter::SHELL); vars.Language = linkLanguage.c_str(); + vars.AIXExports = aixExports.c_str(); vars.Objects = buildObjs.c_str(); vars.ObjectDir = objectDir.c_str(); vars.Target = target.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 357e273..d3f3a4f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -727,6 +727,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( cmOutputConverter::SHELL); } + std::string const& aixExports = this->GetAIXExports(this->GetConfigName()); + // maybe create .def file from list of objects this->GenDefFile(real_link_commands); @@ -756,6 +758,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars.CMTargetType = cmState::GetTargetTypeName(this->GeneratorTarget->GetType()); vars.Language = linkLanguage.c_str(); + vars.AIXExports = aixExports.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 77b6bc2..d7e2de6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -4,10 +4,10 @@ #include <cassert> #include <cstdio> -#include <memory> #include <sstream> #include <utility> +#include <cm/memory> #include <cmext/algorithm> #include "cmComputeLinkInformation.h" @@ -38,12 +38,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) : cmCommonTargetGenerator(target) - , OSXBundleGenerator(nullptr) - , MacOSXContentGenerator(nullptr) { - this->BuildFileStream = nullptr; - this->InfoFileStream = nullptr; - this->FlagFileStream = nullptr; this->CustomCommandDriver = OnBuild; this->LocalGenerator = static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator()); @@ -55,31 +50,28 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) { this->NoRuleMessages = cmIsOff(ruleStatus); } - MacOSXContentGenerator = new MacOSXContentGeneratorType(this); + MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this); } -cmMakefileTargetGenerator::~cmMakefileTargetGenerator() -{ - delete MacOSXContentGenerator; -} +cmMakefileTargetGenerator::~cmMakefileTargetGenerator() = default; -cmMakefileTargetGenerator* cmMakefileTargetGenerator::New( +std::unique_ptr<cmMakefileTargetGenerator> cmMakefileTargetGenerator::New( cmGeneratorTarget* tgt) { - cmMakefileTargetGenerator* result = nullptr; + std::unique_ptr<cmMakefileTargetGenerator> result; switch (tgt->GetType()) { case cmStateEnums::EXECUTABLE: - result = new cmMakefileExecutableTargetGenerator(tgt); + result = cm::make_unique<cmMakefileExecutableTargetGenerator>(tgt); break; case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: - result = new cmMakefileLibraryTargetGenerator(tgt); + result = cm::make_unique<cmMakefileLibraryTargetGenerator>(tgt); break; case cmStateEnums::UTILITY: - result = new cmMakefileUtilityTargetGenerator(tgt); + result = cm::make_unique<cmMakefileUtilityTargetGenerator>(tgt); break; default: return result; @@ -139,9 +131,9 @@ void cmMakefileTargetGenerator::CreateRuleFile() // Open the rule file. This should be copy-if-different because the // rules may depend on this file itself. - this->BuildFileStream = - new cmGeneratedFileStream(this->BuildFileNameFull, false, - this->GlobalGenerator->GetMakefileEncoding()); + this->BuildFileStream = cm::make_unique<cmGeneratedFileStream>( + this->BuildFileNameFull, false, + this->GlobalGenerator->GetMakefileEncoding()); if (!this->BuildFileStream) { return; } @@ -247,11 +239,11 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->GeneratorTarget->GetHeaderSources(headerSources, this->GetConfigName()); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - headerSources, this->MacOSXContentGenerator, this->GetConfigName()); + headerSources, this->MacOSXContentGenerator.get(), this->GetConfigName()); std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, this->GetConfigName()); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - extraSources, this->MacOSXContentGenerator, this->GetConfigName()); + extraSources, this->MacOSXContentGenerator.get(), this->GetConfigName()); const char* pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION"); std::vector<cmSourceFile const*> externalObjects; @@ -316,9 +308,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // rules may depend on this file itself. this->FlagFileNameFull = cmStrCat(this->TargetBuildDirectoryFull, "/flags.make"); - this->FlagFileStream = - new cmGeneratedFileStream(this->FlagFileNameFull, false, - this->GlobalGenerator->GetMakefileEncoding()); + this->FlagFileStream = cm::make_unique<cmGeneratedFileStream>( + this->FlagFileNameFull, false, + this->GlobalGenerator->GetMakefileEncoding()); if (!this->FlagFileStream) { return; } @@ -790,7 +782,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( } if (tidy && *tidy) { run_iwyu += " --tidy="; - run_iwyu += this->LocalGenerator->EscapeForShell(tidy); + const char* driverMode = this->Makefile->GetDefinition( + "CMAKE_" + lang + "_CLANG_TIDY_DRIVER_MODE"); + if (!(driverMode && *driverMode)) { + driverMode = lang == "C" ? "gcc" : "g++"; + } + run_iwyu += this->LocalGenerator->EscapeForShell( + cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode)); } if (cpplint && *cpplint) { run_iwyu += " --cpplint="; @@ -1057,7 +1055,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->InfoFileNameFull = cmStrCat(dir, "/DependInfo.cmake"); this->InfoFileNameFull = this->LocalGenerator->ConvertToFullPath(this->InfoFileNameFull); - this->InfoFileStream = new cmGeneratedFileStream(this->InfoFileNameFull); + this->InfoFileStream = + cm::make_unique<cmGeneratedFileStream>(this->InfoFileNameFull); if (!this->InfoFileStream) { return; } @@ -1524,9 +1523,9 @@ std::string cmMakefileTargetGenerator::GetLinkRule( void cmMakefileTargetGenerator::CloseFileStreams() { - delete this->BuildFileStream; - delete this->InfoFileStream; - delete this->FlagFileStream; + this->BuildFileStream.reset(); + this->InfoFileStream.reset(); + this->FlagFileStream.reset(); } void cmMakefileTargetGenerator::CreateLinkScript( diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index fd62933..ec6b314 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -34,10 +34,15 @@ class cmMakefileTargetGenerator : public cmCommonTargetGenerator public: // constructor to set the ivars cmMakefileTargetGenerator(cmGeneratorTarget* target); + cmMakefileTargetGenerator(const cmMakefileTargetGenerator&) = delete; ~cmMakefileTargetGenerator() override; + cmMakefileTargetGenerator& operator=(const cmMakefileTargetGenerator&) = + delete; + // construct using this factory call - static cmMakefileTargetGenerator* New(cmGeneratorTarget* tgt); + static std::unique_ptr<cmMakefileTargetGenerator> New( + cmGeneratorTarget* tgt); /* the main entry point for this class. Writes the Makefiles associated with this target */ @@ -195,11 +200,11 @@ protected: std::string TargetBuildDirectoryFull; // the stream for the build file - cmGeneratedFileStream* BuildFileStream; + std::unique_ptr<cmGeneratedFileStream> BuildFileStream; // the stream for the flag file std::string FlagFileNameFull; - cmGeneratedFileStream* FlagFileStream; + std::unique_ptr<cmGeneratedFileStream> FlagFileStream; class StringList : public std::vector<std::string> { }; @@ -207,7 +212,7 @@ protected: // the stream for the info file std::string InfoFileNameFull; - cmGeneratedFileStream* InfoFileStream; + std::unique_ptr<cmGeneratedFileStream> InfoFileStream; // files to clean std::set<std::string> CleanFiles; @@ -236,7 +241,7 @@ protected: // macOS content info. std::set<std::string> MacContentFolders; std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator; - MacOSXContentGeneratorType* MacOSXContentGenerator; + std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; }; #endif diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index ca46e14..45043fa 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -4,8 +4,11 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmMessageType.h" +#include "cmPolicies.h" #include "cmState.h" #include "cmStateTypes.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmake.h" @@ -28,14 +31,63 @@ bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args, } i = 1; } + + cmMakefile& mf = status.GetMakefile(); + cmState* state = mf.GetState(); + for (; i < args.size(); ++i) { std::string const& variable = args[i]; - cmState* state = status.GetMakefile().GetState(); - if (!state->GetCacheEntryValue(variable)) { - status.GetMakefile().GetCMakeInstance()->AddCacheEntry( - variable, nullptr, nullptr, cmStateEnums::UNINITIALIZED); - overwrite = true; + + bool issueMessage = false; + bool oldBehavior = false; + bool ignoreVariable = false; + switch (mf.GetPolicyStatus(cmPolicies::CMP0102)) { + case cmPolicies::WARN: + if (mf.PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0102")) { + if (!state->GetCacheEntryValue(variable)) { + issueMessage = true; + } + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + oldBehavior = true; + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + if (!state->GetCacheEntryValue(variable)) { + ignoreVariable = true; + } + break; + } + + // First see if we should issue a message about CMP0102 + if (issueMessage) { + std::string err = cmStrCat( + "Policy CMP0102 is not set: The variable named \"", variable, + "\" is not in the cache. This results in an empty cache entry which " + "is no longer created when policy CMP0102 is set to NEW. Run \"cmake " + "--help-policy CMP0102\" for policy details. Use the cmake_policy " + "command to set the policy and suppress this warning."); + mf.IssueMessage(MessageType::AUTHOR_WARNING, err); } + + // If it's not in the cache and we're using the new behavior, nothing to + // see here. + if (ignoreVariable) { + continue; + } + + // Check if we want the old behavior of making a dummy cache entry. + if (oldBehavior) { + if (!state->GetCacheEntryValue(variable)) { + status.GetMakefile().GetCMakeInstance()->AddCacheEntry( + variable, nullptr, nullptr, cmStateEnums::UNINITIALIZED); + overwrite = true; + } + } + + // We need a cache entry to do this. if (!state->GetCacheEntryValue(variable)) { cmSystemTools::Error("This should never happen..."); return false; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index f853ac5..ff79a17 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -72,8 +72,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config) // Write the build statements bool firstForConfig = true; for (auto const& fileConfig : this->GetConfigNames()) { - if (fileConfig != config && - !this->GetGlobalGenerator()->EnableCrossConfigBuild()) { + if (!this->GetGlobalGenerator() + ->GetCrossConfigs(fileConfig) + .count(config)) { continue; } this->WriteObjectBuildStatements(config, fileConfig, firstForConfig); @@ -85,8 +86,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config) } else { firstForConfig = true; for (auto const& fileConfig : this->GetConfigNames()) { - if (fileConfig != config && - !this->GetGlobalGenerator()->EnableCrossConfigBuild()) { + if (!this->GetGlobalGenerator() + ->GetCrossConfigs(fileConfig) + .count(config)) { continue; } // If this target has cuda language link inputs, and we need to do @@ -284,6 +286,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, std::string lang = this->TargetLinkLanguage(config); vars.Language = config.c_str(); + vars.AIXExports = "$AIX_EXPORTS"; if (this->TargetLinkLanguage(config) == "Swift") { vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; @@ -548,16 +551,23 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd( linkCmds.push_back(cmakeCommand + " -E touch $TARGET_FILE"); } #endif - return linkCmds; - } + } break; case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: + break; case cmStateEnums::EXECUTABLE: + if (this->TargetLinkLanguage(config) == "Swift") { + if (this->GeneratorTarget->IsExecutableWithExports()) { + const std::string flags = + this->Makefile->GetSafeDefinition("CMAKE_EXE_EXPORTS_Swift_FLAG"); + cmExpandList(flags, linkCmds); + } + } break; default: assert(false && "Unexpected target type"); } - return std::vector<std::string>(); + return linkCmds; } void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement( @@ -811,9 +821,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( } // Write comments. - cmGlobalNinjaGenerator::WriteDivider(this->GetConfigFileStream(fileConfig)); + cmGlobalNinjaGenerator::WriteDivider(this->GetImplFileStream(fileConfig)); const cmStateEnums::TargetType targetType = gt->GetType(); - this->GetConfigFileStream(fileConfig) + this->GetImplFileStream(fileConfig) << "# Link build statements for " << cmState::GetTargetTypeName(targetType) << " target " << this->GetTargetName() << "\n\n"; @@ -953,6 +963,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( vars["LINK_FLAGS"] = globalGen->EncodeLiteral(vars["LINK_FLAGS"]); vars["MANIFESTS"] = this->GetManifests(config); + vars["AIX_EXPORTS"] = this->GetAIXExports(config); vars["LINK_PATH"] = frameworkPath + linkPath; std::string lwyuFlags; @@ -1183,7 +1194,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( // Write the build statement for this target. bool usedResponseFile = false; - globalGen->WriteBuild(this->GetConfigFileStream(fileConfig), linkBuild, + globalGen->WriteBuild(this->GetImplFileStream(fileConfig), linkBuild, commandLineLengthLimit, &usedResponseFile); this->WriteLinkRule(usedResponseFile, config); @@ -1197,7 +1208,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( } build.ExplicitDeps.push_back(targetOutputReal); build.Variables = std::move(symlinkVars); - globalGen->WriteBuild(this->GetConfigFileStream(fileConfig), build); + globalGen->WriteBuild(this->GetImplFileStream(fileConfig), build); } else { cmNinjaBuild build("CMAKE_SYMLINK_LIBRARY"); build.Comment = "Create library symlink " + targetOutput; @@ -1223,7 +1234,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( build.ExplicitDeps.push_back(targetOutputReal); build.Variables = std::move(symlinkVars); - globalGen->WriteBuild(this->GetConfigFileStream(fileConfig), build); + globalGen->WriteBuild(this->GetImplFileStream(fileConfig), build); } } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5a8c144..0e74678 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,20 +58,22 @@ std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New( cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) : cmCommonTargetGenerator(target) - , MacOSXContentGenerator(nullptr) , OSXBundleGenerator(nullptr) , LocalGenerator( static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())) { - MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this); + for (auto const& fileConfig : target->Makefile->GetGeneratorConfigs()) { + this->Configs[fileConfig].MacOSXContentGenerator = + cm::make_unique<MacOSXContentGeneratorType>(this, fileConfig); + } } cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default; -cmGeneratedFileStream& cmNinjaTargetGenerator::GetConfigFileStream( +cmGeneratedFileStream& cmNinjaTargetGenerator::GetImplFileStream( const std::string& config) const { - return *this->GetGlobalGenerator()->GetConfigFileStream(config); + return *this->GetGlobalGenerator()->GetImplFileStream(config); } cmGeneratedFileStream& cmNinjaTargetGenerator::GetCommonFileStream() const @@ -759,7 +761,13 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, } if (tidy && *tidy) { run_iwyu += " --tidy="; - run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy); + const char* driverMode = this->Makefile->GetDefinition( + "CMAKE_" + lang + "_CLANG_TIDY_DRIVER_MODE"); + if (!(driverMode && *driverMode)) { + driverMode = lang == "C" ? "gcc" : "g++"; + } + run_iwyu += this->GetLocalGenerator()->EscapeForShell( + cmStrCat(tidy, ";--extra-arg-before=--driver-mode=", driverMode)); } if (cpplint && *cpplint) { run_iwyu += " --cpplint="; @@ -815,8 +823,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( bool firstForConfig) { // Write comments. - cmGlobalNinjaGenerator::WriteDivider(this->GetConfigFileStream(fileConfig)); - this->GetConfigFileStream(fileConfig) + cmGlobalNinjaGenerator::WriteDivider(this->GetImplFileStream(fileConfig)); + this->GetImplFileStream(fileConfig) << "# Object build statements for " << cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) << " target " << this->GetTargetName() << "\n\n"; @@ -837,13 +845,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( std::vector<cmSourceFile const*> headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - headerSources, this->MacOSXContentGenerator.get(), config); + headerSources, this->Configs[fileConfig].MacOSXContentGenerator.get(), + config); } { std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, config); this->OSXBundleGenerator->GenerateMacOSXContentStatements( - extraSources, this->MacOSXContentGenerator.get(), config); + extraSources, this->Configs[fileConfig].MacOSXContentGenerator.get(), + config); } if (firstForConfig) { const char* pchExtension = @@ -901,8 +911,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( orderOnlyDeps.push_back(this->ConvertToNinjaPath(tgtDir)); } - this->GetGlobalGenerator()->WriteBuild( - this->GetConfigFileStream(fileConfig), build); + this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), + build); } { @@ -935,11 +945,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( this->GeneratorTarget, build.OrderOnlyDeps, config, fileConfig, DependOnTargetArtifact); - this->GetGlobalGenerator()->WriteBuild( - this->GetConfigFileStream(fileConfig), build); + this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), + build); } - this->GetConfigFileStream(fileConfig) << "\n"; + this->GetImplFileStream(fileConfig) << "\n"; if (!this->Configs[config].SwiftOutputMap.empty()) { std::string const mapFilePath = @@ -1177,8 +1187,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetGeneratorTarget(), ppBuild.Variables); - this->GetGlobalGenerator()->WriteBuild( - this->GetConfigFileStream(fileConfig), ppBuild, commandLineLengthLimit); + this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), + ppBuild, commandLineLengthLimit); } if (needDyndep) { std::string const dyndep = this->GetDyndepFilePath(language, config); @@ -1210,8 +1220,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( if (language == "Swift") { this->EmitSwiftDependencyInfo(source, config); } else { - this->GetGlobalGenerator()->WriteBuild( - this->GetConfigFileStream(fileConfig), objBuild, commandLineLengthLimit); + this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), + objBuild, commandLineLengthLimit); } if (const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) { @@ -1221,8 +1231,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::transform(build.Outputs.begin(), build.Outputs.end(), build.Outputs.begin(), MapToNinjaPath()); build.ExplicitDeps = objBuild.Outputs; - this->GetGlobalGenerator()->WriteBuild( - this->GetConfigFileStream(fileConfig), build); + this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), + build); } } @@ -1452,6 +1462,16 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc, config); + // Reject files that collide with files from the Ninja file's native config. + if (config != this->FileConfig) { + std::string nativeMacdir = + this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory( + pkgloc, this->FileConfig); + if (macdir == nativeMacdir) { + return; + } + } + // Get the input file location. std::string input = source.GetFullPath(); input = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(input); @@ -1462,8 +1482,8 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( output = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(output); // Write a build statement to copy the content into the bundle. - this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, output, - config); + this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild( + input, output, this->FileConfig); // Add as a dependency to the target so that it gets called. this->Generator->Configs[config].ExtraFiles.push_back(std::move(output)); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 22dd7b8..8678dc3 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -9,6 +9,7 @@ #include <memory> #include <set> #include <string> +#include <utility> #include <vector> #include "cm_jsoncpp_value.h" @@ -47,7 +48,7 @@ public: protected: bool SetMsvcTargetPdbVariable(cmNinjaVars&, const std::string& config) const; - cmGeneratedFileStream& GetConfigFileStream(const std::string& config) const; + cmGeneratedFileStream& GetImplFileStream(const std::string& config) const; cmGeneratedFileStream& GetCommonFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; @@ -173,8 +174,10 @@ protected: struct MacOSXContentGeneratorType : cmOSXBundleGenerator::MacOSXContentGeneratorType { - MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) + MacOSXContentGeneratorType(cmNinjaTargetGenerator* g, + std::string fileConfig) : Generator(g) + , FileConfig(std::move(fileConfig)) { } @@ -183,10 +186,10 @@ protected: private: cmNinjaTargetGenerator* Generator; + std::string FileConfig; }; friend struct MacOSXContentGeneratorType; - std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; // Properly initialized by sub-classes. std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator; std::set<std::string> MacContentFolders; @@ -209,6 +212,7 @@ private: Json::Value SwiftOutputMap; std::vector<cmCustomCommand const*> CustomCommands; cmNinjaDeps ExtraFiles; + std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator; }; std::map<std::string, ByConfig> Configs; diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 0cddb12..a42d65d 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -164,6 +164,6 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config) cmNinjaBuild phonyAlias("phony"); gg->AppendTargetOutputs(genTarget, phonyAlias.Outputs, ""); phonyAlias.ExplicitDeps = phonyBuild.Outputs; - gg->WriteBuild(this->GetConfigFileStream(config), phonyAlias); + gg->WriteBuild(this->GetImplFileStream(config), phonyAlias); } } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index eef41c0..1366ff0 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -302,7 +302,10 @@ class cmMakefile; 17, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0101, \ "target_compile_options honors BEFORE keyword in all scopes.", 3, \ - 17, 0, cmPolicies::WARN) + 17, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0102, \ + "mark_as_advanced() does nothing if a cache entry does not exist.", \ + 3, 17, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index a3d4946..d4b3552 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -20,11 +20,11 @@ void cmPropertyMap::SetProperty(const std::string& name, const char* value) Map_[name] = value; } -void cmPropertyMap::AppendProperty(const std::string& name, const char* value, - bool asString) +void cmPropertyMap::AppendProperty(const std::string& name, + const std::string& value, bool asString) { // Skip if nothing to append. - if (!value || !*value) { + if (value.empty()) { return; } diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 9aed349..bea4372 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -27,7 +27,7 @@ public: void SetProperty(const std::string& name, const char* value); //! Append to the property value - void AppendProperty(const std::string& name, const char* value, + void AppendProperty(const std::string& name, const std::string& value, bool asString = false); //! Get the property value diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ebb522b..43e159c 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -42,7 +42,6 @@ #include "cmSourceGroup.h" #include "cmState.h" #include "cmStateTypes.h" -#include "cmString.hxx" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -1172,13 +1171,58 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() } } + std::vector<std::string> dependencies( + this->AutogenTarget.DependFiles.begin(), + this->AutogenTarget.DependFiles.end()); + + const bool useNinjaDepfile = this->QtVersion >= IntegerVersion(5, 15) && + this->GlobalGen->GetName().find("Ninja") != std::string::npos; + if (useNinjaDepfile) { + // Create a custom command that generates a timestamp file and + // has a depfile assigned. The depfile is created by JobDepFilesMergeT. + + // Add additional autogen target dependencies + for (const cmTarget* t : this->AutogenTarget.DependTargets) { + dependencies.push_back(t->GetName()); + } + const char timestampFileName[] = "timestamp"; + const std::string outputFile = + cmStrCat(this->Dir.Build, "/", timestampFileName); + this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps"); + auto relativeBinaryDir = cmSystemTools::RelativePath( + this->LocalGen->GetBinaryDirectory(), + this->LocalGen->GetCurrentBinaryDirectory()); + if (!relativeBinaryDir.empty()) { + relativeBinaryDir = cmStrCat(relativeBinaryDir, "/"); + } + this->AutogenTarget.DepFileRuleName = + cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/", + timestampFileName); + commandLines.push_back(cmMakeCommandLine( + { cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile })); + + this->AddGeneratedSource(outputFile, this->Moc); + const std::string no_main_dependency; + this->LocalGen->AddCustomCommandToOutput( + outputFile, dependencies, no_main_dependency, commandLines, + autogenComment.c_str(), this->Dir.Work.c_str(), /*replace=*/false, + /*escapeOldStyle=*/false, + /*uses_terminal=*/false, + /*command_expand_lists=*/false, this->AutogenTarget.DepFile); + + // Alter variables for the autogen target which now merely wraps the + // custom command + dependencies.clear(); + dependencies.push_back(outputFile); + commandLines.clear(); + autogenComment.clear(); + } + // Create autogen target cmTarget* autogenTarget = this->LocalGen->AddUtilityCommand( this->AutogenTarget.Name, true, this->Dir.Work.c_str(), /*byproducts=*/autogenProvides, - std::vector<std::string>(this->AutogenTarget.DependFiles.begin(), - this->AutogenTarget.DependFiles.end()), - commandLines, false, autogenComment.c_str()); + /*depends=*/dependencies, commandLines, false, autogenComment.c_str()); // Create autogen generator target this->LocalGen->AddGeneratorTarget( cm::make_unique<cmGeneratorTarget>(autogenTarget, this->LocalGen)); @@ -1189,9 +1233,11 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() autogenTarget->AddUtility(depName.Value, this->Makefile); } } - // Add additional autogen target dependencies to autogen target - for (cmTarget* depTarget : this->AutogenTarget.DependTargets) { - autogenTarget->AddUtility(depTarget->GetName(), this->Makefile); + if (!useNinjaDepfile) { + // Add additional autogen target dependencies to autogen target + for (cmTarget* depTarget : this->AutogenTarget.DependTargets) { + autogenTarget->AddUtility(depTarget->GetName(), this->Makefile); + } } // Set FOLDER property in autogen target @@ -1409,12 +1455,15 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() info.SetConfig("INCLUDE_DIR", this->Dir.Include); info.SetUInt("QT_VERSION_MAJOR", this->QtVersion.Major); + info.SetUInt("QT_VERSION_MINOR", this->QtVersion.Minor); info.Set("QT_MOC_EXECUTABLE", this->Moc.Executable); info.Set("QT_UIC_EXECUTABLE", this->Uic.Executable); info.Set("CMAKE_EXECUTABLE", cmSystemTools::GetCMakeCommand()); info.SetConfig("SETTINGS_FILE", this->AutogenTarget.SettingsFile); info.SetConfig("PARSE_CACHE_FILE", this->AutogenTarget.ParseCacheFile); + info.Set("DEP_FILE", this->AutogenTarget.DepFile); + info.Set("DEP_FILE_RULE_NAME", this->AutogenTarget.DepFileRuleName); info.SetArray("HEADER_EXTENSIONS", this->Makefile->GetCMakeInstance()->GetHeaderExtensions()); info.SetArrayArray( diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 8cedf14..48ec1a0 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -191,6 +191,8 @@ private: bool DependOrigin = false; std::set<std::string> DependFiles; std::set<cmTarget*> DependTargets; + std::string DepFile; + std::string DepFileRuleName; // Sources to process std::unordered_map<cmSourceFile*, MUFileHandle> Headers; std::unordered_map<cmSourceFile*, MUFileHandle> Sources; diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index fa5129d..893bd6b 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -25,6 +25,8 @@ #include "cmCryptoHash.h" #include "cmFileTime.h" +#include "cmGccDepfileReader.h" +#include "cmGccDepfileReaderTypes.h" #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" @@ -170,7 +172,7 @@ public: // -- Attributes // - Config bool MultiConfig = false; - unsigned int QtVersionMajor = 4; + IntegerVersion QtVersion = { 4, 0 }; unsigned int ThreadCount = 0; // - Directories std::string AutogenBuildDir; @@ -179,6 +181,8 @@ public: std::string CMakeExecutable; cmFileTime CMakeExecutableTime; std::string ParseCacheFile; + std::string DepFile; + std::string DepFileRuleName; std::vector<std::string> HeaderExtensions; }; @@ -216,6 +220,7 @@ public: bool SettingsChanged = false; bool RelaxedMode = false; bool PathPrefix = false; + bool CanOutputDependencies = false; cmFileTime ExecutableTime; std::string Executable; std::string CompFileAbs; @@ -485,8 +490,17 @@ public: class JobCompileMocT : public JobCompileT { public: - using JobCompileT::JobCompileT; + JobCompileMocT(MappingHandleT uicMapping, + std::unique_ptr<std::string> reason, + ParseCacheT::FileHandleT cacheEntry) + : JobCompileT(std::move(uicMapping), std::move(reason)) + , CacheEntry(std::move(cacheEntry)) + { + } void Process() override; + + protected: + ParseCacheT::FileHandleT CacheEntry; }; /** uic compiles a file. */ @@ -504,6 +518,12 @@ public: void Process() override; }; + class JobDepFilesMergeT : public JobFenceT + { + private: + void Process() override; + }; + /** @brief The last job. */ class JobFinishT : public JobFenceT { @@ -546,6 +566,9 @@ private: void Abort(bool error); // -- Generation bool CreateDirectories(); + // -- Support for depfiles + static std::vector<std::string> dependenciesFromDepFile( + const char* filePath); private: // -- Settings @@ -951,7 +974,7 @@ void cmQtAutoMocUicT::JobParseT::MocMacro() void cmQtAutoMocUicT::JobParseT::MocDependecies() { - if (MocConst().DependFilters.empty()) { + if (MocConst().DependFilters.empty() || MocConst().CanOutputDependencies) { return; } @@ -1674,8 +1697,13 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Generate(MappingHandleT const& mapping, if (Probe(*mapping, reason.get())) { // Register the parent directory for creation MocEval().OutputDirs.emplace(cmQtAutoGen::ParentDir(mapping->OutputFile)); + // Fetch the cache entry for the source file + std::string const& sourceFile = mapping->SourceFile->FileName; + ParseCacheT::GetOrInsertT cacheEntry = + BaseEval().ParseCache.GetOrInsert(sourceFile); // Add moc job - Gen()->WorkerPool().EmplaceJob<JobCompileMocT>(mapping, std::move(reason)); + Gen()->WorkerPool().EmplaceJob<JobCompileMocT>( + mapping, std::move(reason), std::move(cacheEntry.first)); // Check if a moc job for a mocs_compilation.cpp entry was generated if (compFile) { MocEval().CompUpdated = true; @@ -1779,6 +1807,14 @@ cmQtAutoMocUicT::JobProbeDepsMocT::FindDependency( std::string const& sourceDir, std::string const& includeString) const { using ResPair = std::pair<std::string, cmFileTime>; + // moc's dependency file contains absolute paths + if (MocConst().CanOutputDependencies) { + ResPair res{ includeString, {} }; + if (res.second.Load(res.first)) { + return res; + } + return {}; + } // Search in vicinity of the source { ResPair res{ sourceDir + includeString, {} }; @@ -1898,6 +1934,11 @@ void cmQtAutoMocUicT::JobProbeDepsFinishT::Process() Gen()->WorkerPool().EmplaceJob<JobMocsCompilationT>(); } + if (!BaseConst().DepFile.empty()) { + // Add job to merge dep files + Gen()->WorkerPool().EmplaceJob<JobDepFilesMergeT>(); + } + // Add finish job Gen()->WorkerPool().EmplaceJob<JobFinishT>(); } @@ -1947,6 +1988,9 @@ void cmQtAutoMocUicT::JobCompileMocT::Process() } // Add extra options cm::append(cmd, MocConst().OptionsExtra); + if (MocConst().CanOutputDependencies) { + cmd.emplace_back("--output-dep-file"); + } // Add output file cmd.emplace_back("-o"); cmd.push_back(outputFile); @@ -1956,12 +2000,7 @@ void cmQtAutoMocUicT::JobCompileMocT::Process() // Execute moc command cmWorkerPool::ProcessResultT result; - if (RunProcess(GenT::MOC, result, cmd, Reason.get())) { - // Moc command success. Print moc output. - if (!result.StdOut.empty()) { - Log().Info(GenT::MOC, result.StdOut); - } - } else { + if (!RunProcess(GenT::MOC, result, cmd, Reason.get())) { // Moc command failed std::string includers; if (!Mapping->IncluderFiles.empty()) { @@ -1976,6 +2015,28 @@ void cmQtAutoMocUicT::JobCompileMocT::Process() MessagePath(outputFile), '\n', includers, result.ErrorMessage), cmd, result.StdOut); + return; + } + + // Moc command success. Print moc output. + if (!result.StdOut.empty()) { + Log().Info(GenT::MOC, result.StdOut); + } + + // Extract dependencies from the dep file moc generated for us + if (MocConst().CanOutputDependencies) { + const std::string depfile = outputFile + ".d"; + if (Log().Verbose()) { + Log().Info(GenT::MOC, + "Reading dependencies from " + MessagePath(depfile)); + } + if (!cmSystemTools::FileExists(depfile)) { + Log().Warning(GenT::MOC, + "Dependency file " + MessagePath(depfile) + + " does not exist."); + return; + } + CacheEntry->Moc.Depends = dependenciesFromDepFile(depfile.c_str()); } } @@ -1992,7 +2053,7 @@ void cmQtAutoMocUicT::JobCompileUicT::Process() auto optionIt = UicConst().UiFiles.find(sourceFile); if (optionIt != UicConst().UiFiles.end()) { UicMergeOptions(allOpts, optionIt->second.Options, - (BaseConst().QtVersionMajor == 5)); + (BaseConst().QtVersion.Major == 5)); } cm::append(cmd, allOpts); } @@ -2067,6 +2128,106 @@ void cmQtAutoMocUicT::JobMocsCompilationT::Process() } } +/* + * Escapes paths for Ninja depfiles. + * This is a re-implementation of what moc does when writing depfiles. + */ +std::string escapeDependencyPath(cm::string_view path) +{ + std::string escapedPath; + escapedPath.reserve(path.size()); + const size_t s = path.size(); + int backslashCount = 0; + for (size_t i = 0; i < s; ++i) { + if (path[i] == '\\') { + ++backslashCount; + } else { + if (path[i] == '$') { + escapedPath.push_back('$'); + } else if (path[i] == '#') { + escapedPath.push_back('\\'); + } else if (path[i] == ' ') { + // Double the amount of written backslashes, + // and add one more to escape the space. + while (backslashCount-- >= 0) { + escapedPath.push_back('\\'); + } + } + backslashCount = 0; + } + escapedPath.push_back(path[i]); + } + return escapedPath; +} + +void cmQtAutoMocUicT::JobDepFilesMergeT::Process() +{ + if (Log().Verbose()) { + Log().Info(GenT::MOC, "Merging MOC dependencies"); + } + auto processDepFile = + [](const std::string& mocOutputFile) -> std::vector<std::string> { + std::string f = mocOutputFile + ".d"; + if (!cmSystemTools::FileExists(f)) { + return {}; + } + return dependenciesFromDepFile(f.c_str()); + }; + + std::vector<std::string> dependencies; + ParseCacheT& parseCache = BaseEval().ParseCache; + auto processMappingEntry = [&](const MappingMapT::value_type& m) { + auto cacheEntry = parseCache.GetOrInsert(m.first); + if (cacheEntry.first->Moc.Depends.empty()) { + cacheEntry.first->Moc.Depends = processDepFile(m.second->OutputFile); + } + dependencies.insert(dependencies.end(), + cacheEntry.first->Moc.Depends.begin(), + cacheEntry.first->Moc.Depends.end()); + }; + + std::for_each(MocEval().HeaderMappings.begin(), + MocEval().HeaderMappings.end(), processMappingEntry); + std::for_each(MocEval().SourceMappings.begin(), + MocEval().SourceMappings.end(), processMappingEntry); + + // Remove duplicates to make the depfile smaller + std::sort(dependencies.begin(), dependencies.end()); + dependencies.erase(std::unique(dependencies.begin(), dependencies.end()), + dependencies.end()); + + // Add form files + for (const auto& uif : UicEval().UiFiles) { + dependencies.push_back(uif.first); + } + + // Write the file + cmsys::ofstream ofs; + ofs.open(BaseConst().DepFile.c_str(), + (std::ios::out | std::ios::binary | std::ios::trunc)); + if (!ofs) { + LogError(GenT::GEN, + cmStrCat("Cannot open ", MessagePath(BaseConst().DepFile), + " for writing.")); + return; + } + ofs << BaseConst().DepFileRuleName << ": \\" << std::endl; + for (const std::string& file : dependencies) { + ofs << '\t' << escapeDependencyPath(file) << " \\" << std::endl; + if (!ofs.good()) { + LogError(GenT::GEN, + cmStrCat("Writing depfile", MessagePath(BaseConst().DepFile), + " failed.")); + return; + } + } + + // Add the CMake executable to re-new cache data if necessary. + // Also, this is the last entry, so don't add a backslash. + ofs << '\t' << escapeDependencyPath(BaseConst().CMakeExecutable) + << std::endl; +} + void cmQtAutoMocUicT::JobFinishT::Process() { Gen()->AbortSuccess(); @@ -2082,7 +2243,8 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) { // -- Required settings if (!info.GetBool("MULTI_CONFIG", BaseConst_.MultiConfig, true) || - !info.GetUInt("QT_VERSION_MAJOR", BaseConst_.QtVersionMajor, true) || + !info.GetUInt("QT_VERSION_MAJOR", BaseConst_.QtVersion.Major, true) || + !info.GetUInt("QT_VERSION_MINOR", BaseConst_.QtVersion.Minor, true) || !info.GetUInt("PARALLEL", BaseConst_.ThreadCount, false) || !info.GetString("BUILD_DIR", BaseConst_.AutogenBuildDir, true) || !info.GetStringConfig("INCLUDE_DIR", BaseConst_.AutogenIncludeDir, @@ -2090,6 +2252,9 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) !info.GetString("CMAKE_EXECUTABLE", BaseConst_.CMakeExecutable, true) || !info.GetStringConfig("PARSE_CACHE_FILE", BaseConst_.ParseCacheFile, true) || + !info.GetString("DEP_FILE", BaseConst_.DepFile, false) || + !info.GetString("DEP_FILE_RULE_NAME", BaseConst_.DepFileRuleName, + false) || !info.GetStringConfig("SETTINGS_FILE", SettingsFile_, true) || !info.GetArray("HEADER_EXTENSIONS", BaseConst_.HeaderExtensions, true) || !info.GetString("QT_MOC_EXECUTABLE", MocConst_.Executable, false) || @@ -2143,8 +2308,10 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) MocConst_.MacroFilters.emplace_back( item, ("[\n][ \t]*{?[ \t]*" + item).append("[^a-zA-Z0-9_]")); } - // Dependency filters - { + // Can moc output dependencies or do we need to setup dependency filters? + if (BaseConst_.QtVersion >= IntegerVersion(5, 15)) { + MocConst_.CanOutputDependencies = true; + } else { Json::Value const& val = info.GetValue("MOC_DEPEND_FILTERS"); if (!val.isArray()) { return info.LogError("MOC_DEPEND_FILTERS JSON value is not an array."); @@ -2660,6 +2827,19 @@ bool cmQtAutoMocUicT::CreateDirectories() return true; } +std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile( + const char* filePath) +{ + cmGccDepfileContent content = cmReadGccDepfile(filePath); + if (content.empty()) { + return {}; + } + + // Moc outputs a depfile with exactly one rule. + // Discard the rule and return the dependencies. + return content.front().paths; +} + void cmQtAutoMocUicT::Abort(bool error) { if (error) { diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 0a1d109..5ab1b3a 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -85,6 +85,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( return replaceValues.ObjectsQuoted; } } + if (replaceValues.AIXExports) { + if (variable == "AIX_EXPORTS") { + return replaceValues.AIXExports; + } + } if (replaceValues.Defines && variable == "DEFINES") { return replaceValues.Defines; } diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index 8f36196..09e8a3b 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -36,6 +36,7 @@ public: const char* TargetVersionMajor; const char* TargetVersionMinor; const char* Language; + const char* AIXExports; const char* Objects; const char* Target; const char* LinkLibraries; diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index c8bb1ab..7d676c9 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -71,7 +71,7 @@ protected: std::string CreateConfigTest(const std::string& config); std::string CreateConfigTest(std::vector<std::string> const& configs); - std::string CreateComponentTest(const char* component); + std::string CreateComponentTest(const std::string& component); // Information shared by most generator types. std::string RuntimeConfigVariable; diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index d15ce57..766d347 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -181,7 +181,13 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, const char* arch = this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if (arch && *arch) { - this->AddPathInternal(dir + subdir + "/" + arch, base); + if (this->FC->Makefile->IsDefinitionSet("CMAKE_SYSROOT") && + this->FC->Makefile->IsDefinitionSet( + "CMAKE_PREFIX_LIBRARY_ARCHITECTURE")) { + this->AddPathInternal(cmStrCat('/', arch, dir, subdir), base); + } else { + this->AddPathInternal(cmStrCat(dir, subdir, '/', arch), base); + } } } std::string add = dir + subdir; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 112d832..3705727 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -194,9 +194,8 @@ namespace { bool HandleGlobalMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { if (!names.empty()) { status.SetError("given names for GLOBAL scope."); @@ -205,14 +204,14 @@ bool HandleGlobalMode(cmExecutionStatus& status, // Set or append the property. cmake* cm = status.GetMakefile().GetCMakeInstance(); - const char* value = propertyValue.c_str(); - if (remove) { - value = nullptr; - } if (appendMode) { - cm->AppendProperty(propertyName, value ? value : "", appendAsString); + cm->AppendProperty(propertyName, propertyValue, appendAsString); } else { - cm->SetProperty(propertyName, value); + if (remove) { + cm->SetProperty(propertyName, nullptr); + } else { + cm->SetProperty(propertyName, propertyValue.c_str()); + } } return true; @@ -221,9 +220,8 @@ bool HandleGlobalMode(cmExecutionStatus& status, bool HandleDirectoryMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { if (names.size() > 1) { status.SetError("allows at most one name for DIRECTORY scope."); @@ -258,14 +256,14 @@ bool HandleDirectoryMode(cmExecutionStatus& status, } // Set or append the property. - const char* value = propertyValue.c_str(); - if (remove) { - value = nullptr; - } if (appendMode) { - mf->AppendProperty(propertyName, value ? value : "", appendAsString); + mf->AppendProperty(propertyName, propertyValue, appendAsString); } else { - mf->SetProperty(propertyName, value); + if (remove) { + mf->SetProperty(propertyName, nullptr); + } else { + mf->SetProperty(propertyName, propertyValue.c_str()); + } } return true; @@ -274,9 +272,8 @@ bool HandleDirectoryMode(cmExecutionStatus& status, bool HandleTargetMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { for (std::string const& name : names) { if (status.GetMakefile().IsAlias(name)) { @@ -300,18 +297,18 @@ bool HandleTargetMode(cmExecutionStatus& status, bool HandleTarget(cmTarget* target, cmMakefile& makefile, const std::string& propertyName, - const std::string& propertyValue, const bool appendAsString, - const bool appendMode, const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Set or append the property. - const char* value = propertyValue.c_str(); - if (remove) { - value = nullptr; - } if (appendMode) { - target->AppendProperty(propertyName, value, appendAsString); + target->AppendProperty(propertyName, propertyValue, appendAsString); } else { - target->SetProperty(propertyName, value); + if (remove) { + target->SetProperty(propertyName, nullptr); + } else { + target->SetProperty(propertyName, propertyValue.c_str()); + } } // Check the resulting value. @@ -323,9 +320,8 @@ bool HandleTarget(cmTarget* target, cmMakefile& makefile, bool HandleSourceMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { for (std::string const& name : names) { // Get the source file. @@ -344,28 +340,26 @@ bool HandleSourceMode(cmExecutionStatus& status, } bool HandleSource(cmSourceFile* sf, const std::string& propertyName, - const std::string& propertyValue, const bool appendAsString, - const bool appendMode, const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Set or append the property. - const char* value = propertyValue.c_str(); - if (remove) { - value = nullptr; - } - if (appendMode) { - sf->AppendProperty(propertyName, value, appendAsString); + sf->AppendProperty(propertyName, propertyValue, appendAsString); } else { - sf->SetProperty(propertyName, value); + if (remove) { + sf->SetProperty(propertyName, nullptr); + } else { + sf->SetProperty(propertyName, propertyValue.c_str()); + } } return true; } bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Look for tests with all names given. std::set<std::string>::iterator next; @@ -396,18 +390,18 @@ bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names, } bool HandleTest(cmTest* test, const std::string& propertyName, - const std::string& propertyValue, const bool appendAsString, - const bool appendMode, const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Set or append the property. - const char* value = propertyValue.c_str(); - if (remove) { - value = nullptr; - } if (appendMode) { - test->AppendProperty(propertyName, value, appendAsString); + test->AppendProperty(propertyName, propertyValue, appendAsString); } else { - test->SetProperty(propertyName, value); + if (remove) { + test->SetProperty(propertyName, nullptr); + } else { + test->SetProperty(propertyName, propertyValue.c_str()); + } } return true; @@ -416,9 +410,8 @@ bool HandleTest(cmTest* test, const std::string& propertyName, bool HandleCacheMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { if (propertyName == "ADVANCED") { if (!remove && !cmIsOn(propertyValue) && !cmIsOff(propertyValue)) { @@ -463,9 +456,8 @@ bool HandleCacheMode(cmExecutionStatus& status, bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Set or append the property. const char* value = propertyValue.c_str(); @@ -486,9 +478,8 @@ bool HandleCacheEntry(std::string const& cacheKey, const cmMakefile& makefile, bool HandleInstallMode(cmExecutionStatus& status, const std::set<std::string>& names, const std::string& propertyName, - const std::string& propertyValue, - const bool appendAsString, const bool appendMode, - const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { cmake* cm = status.GetMakefile().GetCMakeInstance(); @@ -510,8 +501,8 @@ bool HandleInstallMode(cmExecutionStatus& status, bool HandleInstall(cmInstalledFile* file, cmMakefile& makefile, const std::string& propertyName, - const std::string& propertyValue, const bool appendAsString, - const bool appendMode, const bool remove) + const std::string& propertyValue, bool appendAsString, + bool appendMode, bool remove) { // Set or append the property. const char* value = propertyValue.c_str(); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 60adf7f..fd9cacd 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -260,21 +260,21 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value) } } -void cmSourceFile::AppendProperty(const std::string& prop, const char* value, - bool asString) +void cmSourceFile::AppendProperty(const std::string& prop, + const std::string& value, bool asString) { if (prop == propINCLUDE_DIRECTORIES) { - if (value && *value) { + if (!value.empty()) { cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace(); this->IncludeDirectories.emplace_back(value, lfbt); } } else if (prop == propCOMPILE_OPTIONS) { - if (value && *value) { + if (!value.empty()) { cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace(); this->CompileOptions.emplace_back(value, lfbt); } } else if (prop == propCOMPILE_DEFINITIONS) { - if (value && *value) { + if (!value.empty()) { cmListFileBacktrace lfbt = this->Location.GetMakefile()->GetBacktrace(); this->CompileDefinitions.emplace_back(value, lfbt); } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 19a0d29..e22829f 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -42,7 +42,7 @@ public: //! Set/Get a property of this source file void SetProperty(const std::string& prop, const char* value); - void AppendProperty(const std::string& prop, const char* value, + void AppendProperty(const std::string& prop, const std::string& value, bool asString = false); //! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 35f07a1..9fc7615 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -141,6 +141,16 @@ const char* cmState::GetCacheEntryValue(std::string const& key) const return e->Value.c_str(); } +std::string cmState::GetSafeCacheEntryValue(std::string const& key) const +{ + std::string retval; + auto val = this->GetCacheEntryValue(key); + if (val) { + retval = val; + } + return retval; +} + const std::string* cmState::GetInitializedCacheValue( std::string const& key) const { @@ -557,8 +567,8 @@ void cmState::SetGlobalProperty(const std::string& prop, const char* value) this->GlobalProperties.SetProperty(prop, value); } -void cmState::AppendGlobalProperty(const std::string& prop, const char* value, - bool asString) +void cmState::AppendGlobalProperty(const std::string& prop, + const std::string& value, bool asString) { this->GlobalProperties.AppendProperty(prop, value, asString); } diff --git a/Source/cmState.h b/Source/cmState.h index a744266..6ee2b0c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -88,6 +88,7 @@ public: std::vector<std::string> GetCacheEntryKeys() const; const char* GetCacheEntryValue(std::string const& key) const; + std::string GetSafeCacheEntryValue(std::string const& key) const; const std::string* GetInitializedCacheValue(std::string const& key) const; cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const; void SetCacheEntryValue(std::string const& key, std::string const& value); @@ -168,7 +169,7 @@ public: std::vector<std::string> GetCommandNames() const; void SetGlobalProperty(const std::string& prop, const char* value); - void AppendGlobalProperty(const std::string& prop, const char* value, + void AppendGlobalProperty(const std::string& prop, const std::string& value, bool asString = false); const char* GetGlobalProperty(const std::string& prop); bool GetGlobalPropertyAsBool(const std::string& prop); diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 97fdbbe..4f003ed 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -521,7 +521,7 @@ void cmStateDirectory::SetProperty(const std::string& prop, const char* value, } void cmStateDirectory::AppendProperty(const std::string& prop, - const char* value, bool asString, + const std::string& value, bool asString, cmListFileBacktrace const& lfbt) { if (prop == "INCLUDE_DIRECTORIES") { diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index fe15563..53a2d54 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -84,7 +84,7 @@ public: void SetProperty(const std::string& prop, const char* value, cmListFileBacktrace const& lfbt); - void AppendProperty(const std::string& prop, const char* value, + void AppendProperty(const std::string& prop, const std::string& value, bool asString, cmListFileBacktrace const& lfbt); const char* GetProperty(const std::string& prop) const; const char* GetProperty(const std::string& prop, bool chain) const; diff --git a/Source/cmString.hxx b/Source/cmString.hxx index 073f4c9..9e91986 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -88,18 +88,6 @@ struct IntoString<std::string> : std::true_type }; template <> -struct IntoString<string_view> : std::true_type -{ - static std::string into_string(string_view s) { return std::string(s); } -}; - -template <> -struct IntoString<static_string_view> : std::true_type -{ - static string_view into_string(static_string_view s) { return s; } -}; - -template <> struct IntoString<char> : std::true_type { static std::string into_string(char const& c) { return std::string(1, c); } @@ -239,6 +227,25 @@ public: { } + /** + * Construct via static_string_view constructor. + * explicit is required to avoid ambiguous overloaded operators (i.e ==, + * etc...) with the ones provided by string_view. + */ + explicit String(static_string_view s) + : String(s, Private()) + { + } + /** + * Construct via string_view constructor. + * explicit is required to avoid ambiguous overloaded operators (i.e ==, + * etc...) with the ones provided by string_view. + */ + explicit String(string_view s) + : String(std::string(s), Private()) + { + } + /** Construct via std::string initializer list constructor. */ String(std::initializer_list<char> il) : String(std::string(il)) @@ -306,6 +313,17 @@ public: This shares ownership of the other string's buffer. */ String& operator=(String const&) noexcept = default; + String& operator=(static_string_view s) + { + *this = String(s); + return *this; + } + String& operator=(string_view s) + { + *this = String(s); + return *this; + } + /** Assign from any type implementing the IntoString trait. */ template <typename T> typename // NOLINT(*) @@ -328,6 +346,7 @@ public: /** Return a view of the string. */ string_view view() const noexcept { return view_; } + operator string_view() const noexcept { return this->view(); } /** Return true if the instance is an empty stringn or null string. */ bool empty() const noexcept { return view_.empty(); } @@ -638,58 +657,155 @@ private: string_view view_; }; -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator==(L&& l, R&& r) +/** + * Trait for comparable types. + */ +template <typename T> +struct IsComparable : std::false_type +{ +}; + +template <typename T> +struct IsComparable<T&> : IsComparable<T> +{ +}; + +template <typename T> +struct IsComparable<T const> : IsComparable<T> +{ +}; + +template <typename T> +struct IsComparable<T const*> : IsComparable<T*> +{ +}; + +template <typename T, std::string::size_type N> +struct IsComparable<T const[N]> : IsComparable<T[N]> +{ +}; + +template <> +struct IsComparable<char*> : std::true_type { - return (AsStringView<L>::view(std::forward<L>(l)) == - AsStringView<R>::view(std::forward<R>(r))); +}; + +template <std::string::size_type N> +struct IsComparable<char[N]> : std::true_type +{ +}; + +template <> +struct IsComparable<std::string> : std::true_type +{ +}; + +template <> +struct IsComparable<char> : std::true_type +{ +}; + +/** comparison operators */ +inline bool operator==(const String& l, const String& r) +{ + return l.view() == r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator==( + L&& l, const String& r) +{ + return AsStringView<L>::view(std::forward<L>(l)) == r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator==( + const String& l, R&& r) +{ + return l.view() == AsStringView<R>::view(std::forward<R>(r)); } -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator!=(L&& l, R&& r) +inline bool operator!=(const String& l, const String& r) +{ + return l.view() != r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator!=( + L&& l, const String& r) { - return (AsStringView<L>::view(std::forward<L>(l)) != - AsStringView<R>::view(std::forward<R>(r))); + return AsStringView<L>::view(std::forward<L>(l)) != r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator!=( + const String& l, R&& r) +{ + return l.view() != AsStringView<R>::view(std::forward<R>(r)); } -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator<(L&& l, R&& r) +inline bool operator<(const String& l, const String& r) { - return (AsStringView<L>::view(std::forward<L>(l)) < - AsStringView<R>::view(std::forward<R>(r))); + return l.view() < r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator<( + L&& l, const String& r) +{ + return AsStringView<L>::view(std::forward<L>(l)) < r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator<( + const String& l, R&& r) +{ + return l.view() < AsStringView<R>::view(std::forward<R>(r)); } -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator<=(L&& l, R&& r) +inline bool operator<=(const String& l, const String& r) +{ + return l.view() <= r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator<=( + L&& l, const String& r) +{ + return AsStringView<L>::view(std::forward<L>(l)) <= r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator<=( + const String& l, R&& r) { - return (AsStringView<L>::view(std::forward<L>(l)) <= - AsStringView<R>::view(std::forward<R>(r))); + return l.view() <= AsStringView<R>::view(std::forward<R>(r)); } -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator>(L&& l, R&& r) +inline bool operator>(const String& l, const String& r) +{ + return l.view() > r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator>( + L&& l, const String& r) +{ + return AsStringView<L>::view(std::forward<L>(l)) > r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator>( + const String& l, R&& r) { - return (AsStringView<L>::view(std::forward<L>(l)) > - AsStringView<R>::view(std::forward<R>(r))); + return l.view() > AsStringView<R>::view(std::forward<R>(r)); } -template <typename L, typename R> -typename std::enable_if<AsStringView<L>::value && AsStringView<R>::value, - bool>::type -operator>=(L&& l, R&& r) +inline bool operator>=(const String& l, const String& r) +{ + return l.view() >= r.view(); +} +template <typename L> +typename std::enable_if<IsComparable<L>::value, bool>::type operator>=( + L&& l, const String& r) +{ + return AsStringView<L>::view(std::forward<L>(l)) >= r.view(); +} +template <typename R> +typename std::enable_if<IsComparable<R>::value, bool>::type operator>=( + const String& l, R&& r) { - return (AsStringView<L>::view(std::forward<L>(l)) >= - AsStringView<R>::view(std::forward<R>(r))); + return l.view() >= AsStringView<R>::view(std::forward<R>(r)); } std::ostream& operator<<(std::ostream& os, String const& s); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0b3138..d0b6f10 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -39,13 +39,13 @@ #include "cmake.h" template <> -const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>( +const std::string& cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>( cmTarget const* tgt) { static std::string loc; if (tgt->IsImported()) { loc = tgt->ImportedGetFullPath("", cmStateEnums::RuntimeBinaryArtifact); - return loc.c_str(); + return loc; } cmGlobalGenerator* gg = tgt->GetGlobalGenerator(); @@ -54,18 +54,18 @@ const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>( } cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName()); loc = gt->GetLocationForBuild(); - return loc.c_str(); + return loc; } template <> -const char* cmTargetPropertyComputer::ComputeLocation<cmTarget>( +const std::string& cmTargetPropertyComputer::ComputeLocation<cmTarget>( cmTarget const* tgt, const std::string& config) { static std::string loc; if (tgt->IsImported()) { loc = tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); - return loc.c_str(); + return loc; } cmGlobalGenerator* gg = tgt->GetGlobalGenerator(); @@ -74,7 +74,7 @@ const char* cmTargetPropertyComputer::ComputeLocation<cmTarget>( } cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName()); loc = gt->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact); - return loc.c_str(); + return loc; } template <> @@ -358,6 +358,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("CUDA_COMPILER_LAUNCHER"); initProp("CUDA_SEPARABLE_COMPILATION"); initProp("CUDA_RESOLVE_DEVICE_SYMBOLS"); + initProp("CUDA_RUNTIME_LIBRARY"); initProp("LINK_SEARCH_START_STATIC"); initProp("LINK_SEARCH_END_STATIC"); initProp("Swift_LANGUAGE_VERSION"); @@ -490,6 +491,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, } if (impl->TargetType == cmStateEnums::SHARED_LIBRARY || impl->TargetType == cmStateEnums::EXECUTABLE) { + initProp("AIX_EXPORT_ALL_SYMBOLS"); initProp("WINDOWS_EXPORT_ALL_SYMBOLS"); } @@ -517,6 +519,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, } if (impl->TargetType <= cmStateEnums::UTILITY) { + initProp("DOTNET_TARGET_FRAMEWORK"); initProp("DOTNET_TARGET_FRAMEWORK_VERSION"); } @@ -1296,8 +1299,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } } -void cmTarget::AppendProperty(const std::string& prop, const char* value, - bool asString) +void cmTarget::AppendProperty(const std::string& prop, + const std::string& value, bool asString) { if (!cmTargetPropertyComputer::PassesWhitelist( this->GetType(), prop, impl->Makefile->GetMessenger(), @@ -1332,37 +1335,37 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, return; } if (prop == "INCLUDE_DIRECTORIES") { - if (value && *value) { + if (!value.empty()) { impl->IncludeDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->IncludeDirectoriesBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_OPTIONS") { - if (value && *value) { + if (!value.empty()) { impl->CompileOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->CompileOptionsBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_FEATURES") { - if (value && *value) { + if (!value.empty()) { impl->CompileFeaturesEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->CompileFeaturesBacktraces.push_back(lfbt); } } else if (prop == "COMPILE_DEFINITIONS") { - if (value && *value) { + if (!value.empty()) { impl->CompileDefinitionsEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->CompileDefinitionsBacktraces.push_back(lfbt); } } else if (prop == "LINK_OPTIONS") { - if (value && *value) { + if (!value.empty()) { impl->LinkOptionsEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->LinkOptionsBacktraces.push_back(lfbt); } } else if (prop == "LINK_DIRECTORIES") { - if (value && *value) { + if (!value.empty()) { impl->LinkDirectoriesEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->LinkDirectoriesBacktraces.push_back(lfbt); @@ -1376,13 +1379,13 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); return; } - if (value && *value) { + if (!value.empty()) { impl->PrecompileHeadersEntries.emplace_back(value); cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->PrecompileHeadersBacktraces.push_back(lfbt); } } else if (prop == "LINK_LIBRARIES") { - if (value && *value) { + if (!value.empty()) { cmListFileBacktrace lfbt = impl->Makefile->GetBacktrace(); impl->LinkImplementationPropertyEntries.emplace_back(value); impl->LinkImplementationPropertyBacktraces.push_back(lfbt); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ca37f0d..d4cca23 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -166,13 +166,8 @@ public: { SetProperty(prop, value.c_str()); } - void AppendProperty(const std::string& prop, const char* value, - bool asString = false); void AppendProperty(const std::string& prop, const std::string& value, - bool asString = false) - { - AppendProperty(prop, value.c_str(), asString); - } + bool asString = false); //! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; //! Always returns a valid pointer diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index 3b11acd..df34f18 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -46,10 +46,10 @@ private: cmListFileBacktrace const& context); template <typename Target> - static const char* ComputeLocationForBuild(Target const* tgt); + static const std::string& ComputeLocationForBuild(Target const* tgt); template <typename Target> - static const char* ComputeLocation(Target const* tgt, - std::string const& config); + static const std::string& ComputeLocation(Target const* tgt, + std::string const& config); template <typename Target> static const char* GetLocation(Target const* tgt, std::string const& prop, @@ -71,7 +71,7 @@ private: context)) { return nullptr; } - return ComputeLocationForBuild(tgt); + return ComputeLocationForBuild(tgt).c_str(); } // Support "LOCATION_<CONFIG>". @@ -82,7 +82,7 @@ private: return nullptr; } std::string configName = prop.substr(9); - return ComputeLocation(tgt, configName); + return ComputeLocation(tgt, configName).c_str(); } // Support "<CONFIG>_LOCATION". @@ -95,7 +95,7 @@ private: context)) { return nullptr; } - return ComputeLocation(tgt, configName); + return ComputeLocation(tgt, configName).c_str(); } } } diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index d5c61c1..3b731cc 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -55,7 +55,7 @@ void cmTest::SetProperty(const std::string& prop, const char* value) this->Properties.SetProperty(prop, value); } -void cmTest::AppendProperty(const std::string& prop, const char* value, +void cmTest::AppendProperty(const std::string& prop, const std::string& value, bool asString) { this->Properties.AppendProperty(prop, value, asString); diff --git a/Source/cmTest.h b/Source/cmTest.h index dd246c4..72d4ed9 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -35,7 +35,7 @@ public: //! Set/Get a property of this source file void SetProperty(const std::string& prop, const char* value); - void AppendProperty(const std::string& prop, const char* value, + void AppendProperty(const std::string& prop, const std::string& value, bool asString = false); const char* GetProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f707bb4..6b45442 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -6,6 +6,7 @@ #include <set> #include <cm/memory> +#include <cm/vector> #include "windows.h" @@ -483,23 +484,33 @@ void cmVisualStudio10TargetGenerator::Generate() } e1.Element("ProjectName", projLabel); { - // TODO: add deprecation warning for VS_* property? - const char* targetFrameworkVersion = - this->GeneratorTarget->GetProperty( - "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); - if (!targetFrameworkVersion) { - 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); + const char* targetFramework = + this->GeneratorTarget->GetProperty("DOTNET_TARGET_FRAMEWORK"); + if (targetFramework) { + if (std::strchr(targetFramework, ';') != nullptr) { + e1.Element("TargetFrameworks", targetFramework); + } else { + e1.Element("TargetFramework", targetFramework); + } + } else { + // TODO: add deprecation warning for VS_* property? + const char* targetFrameworkVersion = + this->GeneratorTarget->GetProperty( + "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); + if (!targetFrameworkVersion) { + 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 == vcxproj && this->GlobalGenerator->TargetsWindowsCE()) { @@ -1444,6 +1455,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( std::string comment = lg->ConstructComment(ccg); comment = cmVS10EscapeComment(comment); std::string script = lg->ConstructScript(ccg); + bool symbolic = false; // input files for custom command std::stringstream additional_inputs; { @@ -1470,6 +1482,12 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( ConvertToWindowsSlash(dep); additional_inputs << sep << dep; sep = ";"; + if (!symbolic) { + if (cmSourceFile* sf = this->Makefile->GetSource( + dep, cmSourceFileLocationKind::Known)) { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } } } if (this->ProjectType != csproj) { @@ -1478,7 +1496,6 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } // output files for custom command std::stringstream outputs; - bool symbolic = false; { const char* sep = ""; for (std::string const& o : ccg.GetOutputs()) { @@ -2098,9 +2115,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) const bool haveUnityBuild = this->GeneratorTarget->GetPropertyAsBool("UNITY_BUILD"); - if (haveUnityBuild && - this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS15) { + if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) { Elem e1(e0, "PropertyGroup"); e1.Element("EnableUnitySupport", "true"); } @@ -2206,9 +2221,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) this->WriteSource(e2, si.Source); bool useNativeUnityBuild = false; - if (haveUnityBuild && - this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS15) { + if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) { // Magic value taken from cmGlobalVisualStudioVersionedGenerator.cxx static const std::string vs15 = "141"; std::string toolset = @@ -2235,7 +2248,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) si.Source->GetProperty("UNITY_SOURCE_FILE")); e2.Attribute("UnityFilesDirectory", unityDir); } else { - // Visual Studio versions prior to 2017 do not know about unity + // Visual Studio versions prior to 2017 15.8 do not know about unity // builds, thus we exclude the files alredy part of unity sources. if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) { exclude_configs = si.Configs; @@ -2801,6 +2814,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( case csproj: this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName, "CSharp"); + cm::erase_if(targetDefines, [](std::string const& def) { + return def.find('=') != std::string::npos; + }); break; } clOptions.AddDefines(targetDefines); @@ -3636,18 +3652,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( this->AddLibraries(cli, libVec, vsTargetVec, config); if (cmContains(linkClosure->Languages, "CUDA") && this->CudaOptions[config] != nullptr) { - switch (this->CudaOptions[config]->GetCudaRuntime()) { - case cmVisualStudioGeneratorOptions::CudaRuntimeStatic: - libVec.push_back("cudadevrt.lib"); - libVec.push_back("cudart_static.lib"); - break; - case cmVisualStudioGeneratorOptions::CudaRuntimeShared: - libVec.push_back("cudadevrt.lib"); - libVec.push_back("cudart.lib"); - break; - case cmVisualStudioGeneratorOptions::CudaRuntimeNone: - break; - } + this->CudaOptions[config]->FixCudaRuntime(this->GeneratorTarget); } std::string standardLibsVar = cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LIBRARIES"); @@ -4110,6 +4115,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); + if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) { + e2.Element("SkipGetTargetFrameworkProperties", "true"); + } // Don't reference targets that don't produce any output. if (dt->GetManagedType("") == cmGeneratorTarget::ManagedType::Undefined) { diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 18c19b7..4004b66 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -3,6 +3,8 @@ #include <cm/iterator> #include "cmAlgorithms.h" +#include "cmGeneratorExpression.h" +#include "cmGeneratorTarget.h" #include "cmLocalVisualStudioGenerator.h" #include "cmOutputConverter.h" #include "cmSystemTools.h" @@ -149,25 +151,33 @@ bool cmVisualStudioGeneratorOptions::UsingSBCS() const return false; } -cmVisualStudioGeneratorOptions::CudaRuntime -cmVisualStudioGeneratorOptions::GetCudaRuntime() const +void cmVisualStudioGeneratorOptions::FixCudaRuntime(cmGeneratorTarget* target) { std::map<std::string, FlagValue>::const_iterator i = this->FlagMap.find("CudaRuntime"); - if (i != this->FlagMap.end() && i->second.size() == 1) { - std::string const& cudaRuntime = i->second[0]; - if (cudaRuntime == "Static") { - return CudaRuntimeStatic; - } - if (cudaRuntime == "Shared") { - return CudaRuntimeShared; - } - if (cudaRuntime == "None") { - return CudaRuntimeNone; + if (i == this->FlagMap.end()) { + // User didn't provide am override so get the property value + const char* runtimeLibraryValue = + target->GetProperty("CUDA_RUNTIME_LIBRARY"); + if (runtimeLibraryValue) { + std::string cudaRuntime = + cmSystemTools::UpperCase(cmGeneratorExpression::Evaluate( + runtimeLibraryValue, this->LocalGenerator, this->Configuration, + target)); + if (cudaRuntime == "STATIC") { + this->AddFlag("CudaRuntime", "Static"); + } + if (cudaRuntime == "SHARED") { + this->AddFlag("CudaRuntime", "Shared"); + } + if (cudaRuntime == "NONE") { + this->AddFlag("CudaRuntime", "None"); + } + } else { + // nvcc default is static + this->AddFlag("CudaRuntime", "Static"); } } - // nvcc default is static - return CudaRuntimeStatic; } void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index d8dcfe2..b335694 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -13,6 +13,7 @@ #include "cmIDEOptions.h" class cmLocalVisualStudioGenerator; +class cmGeneratorTarget; using cmVS7FlagTable = cmIDEFlagTable; @@ -61,15 +62,8 @@ public: bool UsingUnicode() const; bool UsingSBCS() const; - enum CudaRuntime - { - CudaRuntimeStatic, - CudaRuntimeShared, - CudaRuntimeNone - }; - CudaRuntime GetCudaRuntime() const; - void FixCudaCodeGeneration(); + void FixCudaRuntime(cmGeneratorTarget* target); void FixManifestUACFlags(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ab76df9..f4b9f16 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -389,7 +389,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } cmsys::RegularExpression regex( - cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); + cmsys::Glob::PatternToRegex(entryPattern, true, true)); // go through all cache entries and collect the vars which will be // removed std::vector<std::string> entriesToDelete; @@ -663,6 +663,8 @@ void cmake::SetArgs(const std::vector<std::string>& args) } else if ((i < args.size() - 1) && (arg.find("--check-stamp-list", 0) == 0)) { this->CheckStampList = args[++i]; + } else if (arg == "--regenerate-during-build") { + this->RegenerateDuringBuild = true; } #if defined(CMAKE_HAVE_VS_GENERATORS) else if ((i < args.size() - 1) && @@ -2374,7 +2376,7 @@ void cmake::SetProperty(const std::string& prop, const char* value) this->State->SetGlobalProperty(prop, value); } -void cmake::AppendProperty(const std::string& prop, const char* value, +void cmake::AppendProperty(const std::string& prop, const std::string& value, bool asString) { this->State->AppendGlobalProperty(prop, value, asString); @@ -2765,6 +2767,10 @@ int cmake::Build(int jobs, const std::string& dir, } #endif + if (!this->GlobalGenerator->ReadCacheEntriesForBuild(*this->State)) { + return 1; + } + this->GlobalGenerator->PrintBuildCommandAdvice(std::cerr, jobs); return this->GlobalGenerator->Build( jobs, "", dir, projName, targets, output, "", config, clean, false, diff --git a/Source/cmake.h b/Source/cmake.h index 22d3c39..35425ec 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -359,7 +359,7 @@ public: //! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); - void AppendProperty(const std::string& prop, const char* value, + void AppendProperty(const std::string& prop, const std::string& value, bool asString = false); const char* GetProperty(const std::string& prop); bool GetPropertyAsBool(const std::string& prop); @@ -547,6 +547,8 @@ public: } cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; } + bool GetRegenerateDuringBuild() const { return this->RegenerateDuringBuild; } + protected: void RunCheckForUnusedVariables(); int HandleDeleteCacheVariables(const std::string& var); @@ -621,6 +623,7 @@ private: FileExtensions FortranFileExtensions; bool ClearBuildSystem = false; bool DebugTryCompile = false; + bool RegenerateDuringBuild = false; std::unique_ptr<cmFileTimeCache> FileTimeCache; std::string GraphVizFile; InstalledFilesMap InstalledFiles; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5579ae1..494d5d9 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -350,7 +350,7 @@ int do_build(int ac, char const* const* av) #else int jobs = cmake::NO_BUILD_PARALLEL_LEVEL; std::vector<std::string> targets; - std::string config = "Debug"; + std::string config; std::string dir; std::vector<std::string> nativeOptions; bool cleanFirst = false; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 67c776e..7eeb97f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -4,6 +4,10 @@ #include <cmext/algorithm> +#include <fcntl.h> + +#include "cm_uv.h" + #include "cmAlgorithms.h" #include "cmDuration.h" #include "cmGlobalGenerator.h" @@ -17,6 +21,7 @@ #include "cmStateSnapshot.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmUVProcessChain.h" #include "cmUtils.hxx" #include "cmVersion.h" #include "cmake.h" @@ -1129,6 +1134,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) return cmcmd::VisualStudioLink(args, 2); } + if (args[1] == "cmake_llvm_rc") { + return cmcmd::RunLLVMRC(args); + } + // Internal CMake color makefile support. if (args[1] == "cmake_echo_color") { return cmcmd::ExecuteEchoColor(args); @@ -1660,6 +1669,108 @@ int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name) return -1; } +int cmcmd::RunPreprocessor(const std::vector<std::string>& command, + const std::string& intermediate_file) +{ + + cmUVProcessChainBuilder builder; + + uv_fs_t fs_req; + int preprocessedFile = + uv_fs_open(nullptr, &fs_req, intermediate_file.c_str(), O_CREAT | O_RDWR, + 0644, nullptr); + uv_fs_req_cleanup(&fs_req); + + builder + .SetExternalStream(cmUVProcessChainBuilder::Stream_OUTPUT, + preprocessedFile) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR) + .AddCommand(command); + auto process = builder.Start(); + if (!process.Valid()) { + std::cerr << "Failed to start preprocessor."; + return 1; + } + if (!process.Wait()) { + std::cerr << "Failed to wait for preprocessor"; + return 1; + } + auto status = process.GetStatus(); + if (!status[0] || status[0]->ExitStatus != 0) { + return 1; + } + + return 0; +} + +int cmcmd::RunLLVMRC(std::vector<std::string> const& args) +{ + // The arguments are + // args[0] == <cmake-executable> + // args[1] == cmake_llvm_rc + // args[2] == intermediate_file + // args[3..n] == preprocess+args + // args[n+1] == -- + // args[n+2...] == llvm-rc+args + if (args.size() < 3) { + std::cerr << "Invalid cmake_llvm_rc arguments"; + return 1; + } + const std::string& intermediate_file = args[2]; + std::vector<std::string> preprocess; + std::vector<std::string> resource_compile; + std::vector<std::string>* pArgTgt = &preprocess; + for (std::string const& arg : cmMakeRange(args).advance(3)) { + if (arg == "--") { + pArgTgt = &resource_compile; + } else { + pArgTgt->push_back(arg); + } + } + if (preprocess.empty()) { + std::cerr << "Empty preprocessing command"; + return 1; + } + if (resource_compile.empty()) { + std::cerr << "Empty resource compilation command"; + return 1; + } + + auto result = RunPreprocessor(preprocess, intermediate_file); + if (result != 0) { + + cmSystemTools::RemoveFile(intermediate_file); + return result; + } + cmUVProcessChainBuilder builder; + + builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR) + .AddCommand(resource_compile); + auto process = builder.Start(); + result = 0; + if (!process.Valid()) { + std::cerr << "Failed to start resource compiler."; + result = 1; + } else { + if (!process.Wait()) { + std::cerr << "Failed to wait for resource compiler"; + result = 1; + } + } + + cmSystemTools::RemoveFile(intermediate_file); + if (result != 0) { + return result; + } + auto status = process.GetStatus(); + if (!status[0] || status[0]->ExitStatus != 0) { + return 1; + } + + return 0; +} + class cmVSLink { int Type; diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 17f2f9a..5b6c813 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -31,6 +31,9 @@ protected: static int ExecuteLinkScript(std::vector<std::string> const& args); static int WindowsCEEnvironment(const char* version, const std::string& name); + static int RunPreprocessor(const std::vector<std::string>& command, + const std::string& intermediate_file); + static int RunLLVMRC(std::vector<std::string> const& args); static int VisualStudioLink(std::vector<std::string> const& args, int type); }; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 9b45bb0..fbdf75a 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -144,6 +144,8 @@ static const char* cmDocumentationOptions[][2] = { { "--http1.0", "Submit using HTTP 1.0." }, { "--no-compress-output", "Do not compress test output when submitting." }, { "--print-labels", "Print all available test labels." }, + { "--no-tests=<[error|ignore]>", + "Regard no tests found either as 'error' or 'ignore' it." }, { nullptr, nullptr } }; diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 21b265c..a3c9946 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.8) project(Assembler C) message("CTEST_FULL_OUTPUT ") set(CMAKE_VERBOSE_MAKEFILE 1) @@ -22,7 +22,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND set(SRCS main.s) add_custom_command( OUTPUT main.s - COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s + COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} + "$<$<CONFIG:Debug>:${CMAKE_C_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL}>" + "$<$<NOT:$<CONFIG:Debug>>:${CMAKE_C_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL}>" + -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s + COMMAND_EXPAND_LISTS DEPENDS main.c VERBATIM ) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 25d2de6..bb50d76 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -11,6 +11,7 @@ set(CMakeLib_TESTS testCTestResourceAllocator.cxx testCTestResourceSpec.cxx testCTestResourceGroups.cxx + testGccDepfileReader.cxx testGeneratedFileStream.cxx testRST.cxx testRange.cxx @@ -35,6 +36,7 @@ set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>) set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>) set(testCTestResourceSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) +set(testGccDepfileReader_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) if(WIN32) list(APPEND CMakeLib_TESTS diff --git a/Tests/CMakeLib/testCMExtAlgorithm.cxx b/Tests/CMakeLib/testCMExtAlgorithm.cxx index c731b72..b8319c3 100644 --- a/Tests/CMakeLib/testCMExtAlgorithm.cxx +++ b/Tests/CMakeLib/testCMExtAlgorithm.cxx @@ -1,5 +1,6 @@ #include <iostream> #include <memory> +#include <type_traits> #include <utility> #include <vector> diff --git a/Tests/CMakeLib/testGccDepfileReader.cxx b/Tests/CMakeLib/testGccDepfileReader.cxx new file mode 100644 index 0000000..924d87b --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader.cxx @@ -0,0 +1,131 @@ +#include <cstddef> +#include <iostream> +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "cmsys/FStream.hxx" + +#include "cmGccDepfileReader.h" +#include "cmGccDepfileReaderTypes.h" // for cmGccDepfileContent, cmGccStyle... +#include "cmSystemTools.h" + +namespace { + +cmGccDepfileContent readPlainDepfile(const char* filePath) +{ + cmGccDepfileContent result; + cmsys::ifstream is(filePath); + if (!is.is_open()) + return result; + std::string line; + + cmGccStyleDependency dep; + bool readingRules = true; + while (cmSystemTools::GetLineFromStream(is, line)) { + if (line == "--RULES--") { + if (!dep.rules.empty()) { + result.push_back(std::move(dep)); + dep = cmGccStyleDependency(); + } + readingRules = true; + } else if (line == "--DEPENDENCIES--") { + readingRules = false; + } else { + std::vector<std::string>& dst = readingRules ? dep.rules : dep.paths; + dst.push_back(std::move(line)); + line = std::string(); + } + } + + if (!dep.rules.empty()) { + result.push_back(std::move(dep)); + } + + return result; +} + +bool compare(const std::vector<std::string>& actual, + const std::vector<std::string>& expected, const char* msg) +{ + if (actual.size() != expected.size()) { + std::cerr << msg << "expected " << expected.size() << " entries." + << std::endl + << "Actual number of entries: " << actual.size() << std::endl; + return false; + } + for (std::size_t i = 0; i < actual.size(); ++i) { + if (actual[i] != expected[i]) { + std::cerr << msg << std::endl + << "expected: " << expected[i] << std::endl + << "actual: " << actual[i] << std::endl; + return false; + } + } + return true; +} + +bool compare(const cmGccDepfileContent& actual, + const cmGccDepfileContent& expected) +{ + if (actual.size() != expected.size()) { + std::cerr << "Expected " << expected.size() << " entries." << std::endl + << "Actual number of entries: " << actual.size() << std::endl; + return false; + } + for (std::size_t i = 0; i < actual.size(); ++i) { + if (!compare(actual[i].rules, expected[i].rules, "Rules differ: ") || + !compare(actual[i].paths, expected[i].paths, "Paths differ: ")) { + return false; + } + } + return true; +} + +void dump(const char* label, const cmGccDepfileContent& dfc) +{ + std::cerr << label << std::endl; + for (const auto& entry : dfc) { + auto rit = entry.rules.cbegin(); + if (rit != entry.rules.cend()) { + std::cerr << *rit; + for (++rit; rit != entry.rules.cend(); ++rit) { + std::cerr << " " << *rit; + } + std::cerr << ": " << std::endl; + } + for (const auto& path : entry.paths) { + std::cerr << " " << path << std::endl; + } + } +} + +} // anonymous namespace + +int testGccDepfileReader(int argc, char* argv[]) +{ + if (argc < 2) { + std::cout << "Invalid arguments.\n"; + return -1; + } + + std::string dataDirPath = argv[1]; + dataDirPath += "/testGccDepfileReader_data"; + const int numberOfTestFiles = 3; + for (int i = 1; i <= numberOfTestFiles; ++i) { + const std::string base = dataDirPath + "/deps" + std::to_string(i); + const std::string depfile = base + ".d"; + const std::string plainDepfile = base + ".txt"; + std::cout << "Comparing " << base << " with " << plainDepfile << std::endl; + const auto actual = cmReadGccDepfile(depfile.c_str()); + const auto expected = readPlainDepfile(plainDepfile.c_str()); + if (!compare(actual, expected)) { + dump("actual", actual); + dump("expected", expected); + return 1; + } + } + + return 0; +} diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps1.d b/Tests/CMakeLib/testGccDepfileReader_data/deps1.d new file mode 100644 index 0000000..9e34863 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps1.d @@ -0,0 +1,20 @@ +main.o: main.cpp /usr/include/stdc-predef.h /usr/include/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/bits/long-double.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h \ + /usr/lib/gcc/x86_64-linux-gnu/8/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \ + /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \ + /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt new file mode 100644 index 0000000..fd2679f --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt @@ -0,0 +1,26 @@ +--RULES-- +main.o +--DEPENDENCIES-- +main.cpp +/usr/include/stdc-predef.h +/usr/include/stdio.h +/usr/include/x86_64-linux-gnu/bits/libc-header-start.h +/usr/include/features.h +/usr/include/x86_64-linux-gnu/sys/cdefs.h +/usr/include/x86_64-linux-gnu/bits/wordsize.h +/usr/include/x86_64-linux-gnu/bits/long-double.h +/usr/include/x86_64-linux-gnu/gnu/stubs.h +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h +/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h +/usr/lib/gcc/x86_64-linux-gnu/8/include/stdarg.h +/usr/include/x86_64-linux-gnu/bits/types.h +/usr/include/x86_64-linux-gnu/bits/typesizes.h +/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h +/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h +/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h +/usr/include/x86_64-linux-gnu/bits/types/__FILE.h +/usr/include/x86_64-linux-gnu/bits/types/FILE.h +/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h +/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps2.d b/Tests/CMakeLib/testGccDepfileReader_data/deps2.d new file mode 100644 index 0000000..25f0d78 --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps2.d @@ -0,0 +1 @@ +foo.o bar.o: foobar.c diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps2.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps2.txt new file mode 100644 index 0000000..afaf78e --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps2.txt @@ -0,0 +1,5 @@ +--RULES-- +foo.o +bar.o +--DEPENDENCIES-- +foobar.c diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps3.d b/Tests/CMakeLib/testGccDepfileReader_data/deps3.d new file mode 100644 index 0000000..d75ceed --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps3.d @@ -0,0 +1,2 @@ +main.o: main.cpp foo\#bar.h foo\\#bar.h foo\ bar.h \ + foo\\\ bar.h foo\\\\\ bar.h foo\\\\ foo$$bar.h diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt new file mode 100644 index 0000000..448f69c --- /dev/null +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt @@ -0,0 +1,11 @@ +--RULES-- +main.o +--DEPENDENCIES-- +main.cpp +foo#bar.h +foo\#bar.h +foo bar.h +foo\ bar.h +foo\\ bar.h +foo\\\\ +foo$bar.h diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index d7b3200..1fd3f38 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -191,7 +191,7 @@ static bool testConstructFromView() { std::cout << "testConstructFromView()\n"; cm::string_view view = cstr; - return testFromCStr(view); + return testFromCStr(cm::String(view)); } static bool testAssignFromView() @@ -297,7 +297,7 @@ static bool testFromStaticStringView(cm::String str) static bool testConstructFromStaticStringView() { std::cout << "testConstructFromStaticStringView()\n"; - return testFromStaticStringView(staticStringView); + return testFromStaticStringView(cm::String(staticStringView)); } static bool testAssignFromStaticStringView() @@ -796,7 +796,7 @@ static bool testMethod_substr_AtEnd(cm::String str) static bool testMethod_substr_AtEndBorrowed() { std::cout << "testMethod_substr_AtEndBorrowed()\n"; - return testMethod_substr_AtEnd("abc"_s); + return testMethod_substr_AtEnd(cm::String("abc"_s)); } static bool testMethod_substr_AtEndOwned() @@ -855,7 +855,7 @@ static bool testMethod_substr_AtStart(cm::String str) static bool testMethod_substr_AtStartBorrowed() { std::cout << "testMethod_substr_AtStartBorrowed()\n"; - return testMethod_substr_AtStart("abc"_s); + return testMethod_substr_AtStart(cm::String("abc"_s)); } static bool testMethod_substr_AtStartOwned() @@ -1146,7 +1146,7 @@ static bool testAddition() static bool testStability() { std::cout << "testStability()\n"; - cm::String str = "abc"_s; + cm::String str("abc"_s); ASSERT_TRUE(!str.is_stable()); ASSERT_TRUE(str.str_if_stable() == nullptr); str.stabilize(); diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt index a584505..859ec41 100644 --- a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}") include(CheckStructHasMember) -foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) +foreach(_config_type Release RelWithDebInfo Debug) set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) unset(CSHM_RESULT_S1_${_config_type} CACHE) unset(CSHM_RESULT_S2_${_config_type} CACHE) @@ -26,7 +26,7 @@ foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) endif() endforeach() -foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) +foreach(_config_type Release RelWithDebInfo Debug) set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) unset(CSHM_RESULT_S1_${_config_type}_C CACHE) unset(CSHM_RESULT_S2_${_config_type}_C CACHE) @@ -46,7 +46,7 @@ foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) endif() endforeach() -foreach(_config_type Release RelWithDebInfo MinSizeRel Debug) +foreach(_config_type Release RelWithDebInfo Debug) set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type}) unset(CSHM_RESULT_S1_${_config_type}_CXX CACHE) unset(CSHM_RESULT_S2_${_config_type}_CXX CACHE) diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index 0ae8af1..c531e8b 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -7,6 +7,13 @@ if(make_program) set(maybe_make_program "-DCMAKE_MAKE_PROGRAM=${make_program}") endif() +set(_isMultiConfig "@_isMultiConfig@") +if(_isMultiConfig) + set(cfg_opts "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;RelWithDebInfo") +else() + set(cfg_opts) +endif() + set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}") set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build") file(REMOVE_RECURSE "${binary_dir}") @@ -16,6 +23,7 @@ execute_process( "${source_dir}" -G "@CMAKE_GENERATOR@" -A "@CMAKE_GENERATOR_PLATFORM@" -T "@CMAKE_GENERATOR_TOOLSET@" + ${cfg_opts} ${maybe_make_program} WORKING_DIRECTORY "${binary_dir}" RESULT_VARIABLE result diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 5bd3803..76c0000 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -138,9 +138,9 @@ message(STATUS "${status}") message(STATUS "FileDownload:11") file(DOWNLOAD - badhostname.png + badhostname.invalid ${dir}/file11.png - TIMEOUT ${timeout} + TIMEOUT 30 STATUS status ) message(STATUS "${status}") diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in index 4bb1262..34824e3 100644 --- a/Tests/CTestConfig/dashboard.cmake.in +++ b/Tests/CTestConfig/dashboard.cmake.in @@ -13,6 +13,8 @@ message("CMAKE_CTEST_COMMAND='${CMAKE_CTEST_COMMAND}'") set(arg "") if(NOT _isMultiConfig) set(arg "-DCMAKE_BUILD_TYPE:STRING=@cfg@") +else() + set(arg "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") endif() message("cmake initial configure") diff --git a/Tests/CTestConfig/script.cmake.in b/Tests/CTestConfig/script.cmake.in index 973c7b8..59c585b 100644 --- a/Tests/CTestConfig/script.cmake.in +++ b/Tests/CTestConfig/script.cmake.in @@ -6,7 +6,14 @@ set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-script") ctest_start(Experimental) -ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE rv) +set(_isMultiConfig "@_isMultiConfig@") +if(_isMultiConfig) + set(cfg_opts "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") +else() + set(cfg_opts) +endif() + +ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "${cfg_opts}" RETURN_VALUE rv) if(NOT rv STREQUAL 0) message(FATAL_ERROR "*** error in ctest_configure ***") endif() diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index d3d4b7c..08d1e16 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -22,18 +22,11 @@ set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) add_library(CudaComplexCppBase SHARED dynamic.cpp) -add_library(CudaComplexSeperableLib STATIC file1.cu file2.cu file3.cu) -set_target_properties(CudaComplexSeperableLib - PROPERTIES CUDA_SEPARABLE_COMPILATION ON) -set_target_properties( CudaComplexSeperableLib - PROPERTIES POSITION_INDEPENDENT_CODE ON) - add_library(CudaComplexSharedLib SHARED dynamic.cu) target_link_libraries(CudaComplexSharedLib PUBLIC CudaComplexCppBase) +add_library(CudaComplexSeperableLib STATIC file1.cu file2.cu file3.cu) add_library(CudaComplexMixedLib SHARED mixed.cpp mixed.cu) -set_target_properties(CudaComplexMixedLib - PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_link_libraries(CudaComplexMixedLib PUBLIC CudaComplexSharedLib PRIVATE CudaComplexSeperableLib) @@ -41,7 +34,27 @@ target_link_libraries(CudaComplexMixedLib add_executable(CudaComplex main.cpp) target_link_libraries(CudaComplex PUBLIC CudaComplexMixedLib) + +set_target_properties(CudaComplexMixedLib + CudaComplexSeperableLib + PROPERTIES + POSITION_INDEPENDENT_CODE ON + CUDA_SEPARABLE_COMPILATION ON + ) +set_target_properties(CudaComplexMixedLib + CudaComplexSharedLib + PROPERTIES + CUDA_RUNTIME_LIBRARY shared + ) + + if(APPLE) # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. set_property(TARGET CudaComplex PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) endif() + +if(UNIX) + # Help the shared cuda runtime find libcudart as it is not located + # in a default system searched location + set_property(TARGET CudaComplexMixedLib PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu index 9da8853..7f2f2b5 100644 --- a/Tests/Cuda/Complex/dynamic.cu +++ b/Tests/Cuda/Complex/dynamic.cu @@ -54,17 +54,20 @@ EXPORT int choose_cuda_device() return 1; } -EXPORT void cuda_dynamic_lib_func() +EXPORT bool cuda_dynamic_lib_func() { - DetermineIfValidCudaDevice<<<1, 1>>>(); cudaError_t err = cudaGetLastError(); if (err != cudaSuccess) { - std::cerr << "DetermineIfValidCudaDevice [SYNC] failed: " + std::cerr << "DetermineIfValidCudaDevice [Per Launch] failed: " << cudaGetErrorString(err) << std::endl; + return false; } + DetermineIfValidCudaDevice<<<1, 1>>>(); err = cudaDeviceSynchronize(); if (err != cudaSuccess) { - std::cerr << "DetermineIfValidCudaDevice [ASYNC] failed: " + std::cerr << "DetermineIfValidCudaDevice [SYNC] failed: " << cudaGetErrorString(cudaGetLastError()) << std::endl; + return false; } + return true; } diff --git a/Tests/Cuda/Complex/main.cpp b/Tests/Cuda/Complex/main.cpp index 6ca5952..da09b44 100644 --- a/Tests/Cuda/Complex/main.cpp +++ b/Tests/Cuda/Complex/main.cpp @@ -22,5 +22,6 @@ int main(int argc, char** argv) int r1 = call_cuda_seperable_code(42); int r2 = mixed_launch_kernel(42); + return (r1 == 42 || r2 == 42) ? 1 : 0; } diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu index 5b85aec..76119ad 100644 --- a/Tests/Cuda/Complex/mixed.cu +++ b/Tests/Cuda/Complex/mixed.cu @@ -15,7 +15,7 @@ result_type __device__ file1_func(int x); result_type_dynamic __device__ file2_func(int x); -IMPORT void __host__ cuda_dynamic_lib_func(); +IMPORT bool __host__ cuda_dynamic_lib_func(); static __global__ void mixed_kernel(result_type* r, int x) { @@ -25,7 +25,9 @@ static __global__ void mixed_kernel(result_type* r, int x) EXPORT int mixed_launch_kernel(int x) { - cuda_dynamic_lib_func(); + if (!cuda_dynamic_lib_func()) { + return x; + } result_type* r; cudaError_t err = cudaMallocManaged(&r, sizeof(result_type)); diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index a0575cd..cc1ee1a 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -5,10 +5,21 @@ ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation) +ADD_TEST_MACRO(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit) ADD_TEST_MACRO(CudaOnly.Standard98 CudaOnlyStandard98) ADD_TEST_MACRO(CudaOnly.Toolkit CudaOnlyToolkit) ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs) +# The CUDA only ships the shared version of the toolkit libraries +# on windows +if(NOT WIN32) + ADD_TEST_MACRO(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit) +endif() + +if(MSVC) + ADD_TEST_MACRO(CudaOnly.PDB CudaOnlyPDB) +endif() + add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -20,6 +31,14 @@ add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) -if(MSVC) - ADD_TEST_MACRO(CudaOnly.PDB CudaOnlyPDB) -endif() +add_test(NAME CudaOnly.RuntimeControls COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMAKE_CURRENT_SOURCE_DIR}/RuntimeControls/" + "${CMAKE_CURRENT_BINARY_DIR}/RuntimeControls/" + --build-two-config + ${build_generator_args} + --build-project RuntimeControls + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/CudaOnly/RuntimeControls/CMakeLists.txt b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt new file mode 100644 index 0000000..8b58fec --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.7) +project (RuntimeControls CUDA) + +# Find nm and dumpbin +if(CMAKE_NM) + set(dump_command ${CMAKE_NM}) + set(dump_args -g) +else() + include(GetPrerequisites) + message(STATUS "calling list_prerequisites to find dumpbin") + list_prerequisites("${CMAKE_COMMAND}" 0 0 0) + if(gp_dumpbin) + set(dump_command ${gp_dumpbin}) + set(dump_args /ARCHIVEMEMBERS) + endif() +endif() + +string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") + +set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_RUNTIME_LIBRARY static) + +if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") + add_library(UsesNoCudaRT SHARED file1.cu) + set_target_properties(UsesNoCudaRT PROPERTIES CUDA_RUNTIME_LIBRARY none) +endif() + +add_library(UsesStaticCudaRT SHARED file2.cu) + +add_executable(CudaOnlyRuntimeControls main.cu) +set_target_properties(CudaOnlyRuntimeControls PROPERTIES CUDA_RUNTIME_LIBRARY shared) + +target_link_libraries(CudaOnlyRuntimeControls PRIVATE $<TARGET_NAME_IF_EXISTS:UsesNoCudaRT> UsesStaticCudaRT) + + +if(dump_command) + if(TARGET UsesNoCudaRT) + add_custom_command(TARGET UsesNoCudaRT POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DDUMP_COMMAND=${dump_command} + -DDUMP_ARGS=${dump_args} + -DTEST_LIBRARY_PATH=$<TARGET_FILE:UsesNoCudaRT> + -P ${CMAKE_CURRENT_SOURCE_DIR}/no_runtime.cmake + ) + endif() + add_custom_command(TARGET UsesStaticCudaRT POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DDUMP_COMMAND=${dump_command} + -DDUMP_ARGS=${dump_args} + -DTEST_LIBRARY_PATH=$<TARGET_FILE:UsesStaticCudaRT> + -P ${CMAKE_CURRENT_SOURCE_DIR}/uses_static_runtime.cmake + ) + string(REPLACE ";" "|" dirs "${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") + add_custom_command(TARGET CudaOnlyRuntimeControls POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DEXEC_PATH=$<TARGET_FILE:CudaOnlyRuntimeControls> + -DEXTRA_LIB_DIRS="${dirs}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/verify_runtime.cmake + ) +endif() diff --git a/Tests/CudaOnly/RuntimeControls/file1.cu b/Tests/CudaOnly/RuntimeControls/file1.cu new file mode 100644 index 0000000..28beb5e --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/file1.cu @@ -0,0 +1,18 @@ + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +void __global__ file1_kernel(int x, int& r) +{ + r = -x; +} + +EXPORT int file1_launch_kernel(int x) +{ + int r = 0; + file1_kernel<<<1, 1>>>(x, r); + return r; +} diff --git a/Tests/CudaOnly/RuntimeControls/file2.cu b/Tests/CudaOnly/RuntimeControls/file2.cu new file mode 100644 index 0000000..ff68a70 --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/file2.cu @@ -0,0 +1,18 @@ + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +void __global__ file2_kernel(int x, int& r) +{ + r = -x; +} + +EXPORT int file2_launch_kernel(int x) +{ + int r = 0; + file2_kernel<<<1, 1>>>(x, r); + return r; +} diff --git a/Tests/CudaOnly/RuntimeControls/main.cu b/Tests/CudaOnly/RuntimeControls/main.cu new file mode 100644 index 0000000..0be22af --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/main.cu @@ -0,0 +1,81 @@ + +#include <iostream> + +#include "cuda.h" + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + +#ifndef _WIN32 +IMPORT int file1_launch_kernel(int x); +#endif + +IMPORT int file2_launch_kernel(int x); + +int choose_cuda_device() +{ + int nDevices = 0; + cudaError_t err = cudaGetDeviceCount(&nDevices); + if (err != cudaSuccess) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices" + << std::endl; + return 1; + } + for (int i = 0; i < nDevices; ++i) { + cudaDeviceProp prop; + cudaError_t err = cudaGetDeviceProperties(&prop, i); + if (err != cudaSuccess) { + std::cerr << "Could not retrieve properties from CUDA device " << i + << std::endl; + return 1; + } + std::cout << "prop.major: " << prop.major << std::endl; + if (prop.major >= 3) { + err = cudaSetDevice(i); + if (err != cudaSuccess) { + std::cout << "Could not select CUDA device " << i << std::endl; + } else { + return 0; + } + } + } + + std::cout << "Could not find a CUDA enabled card supporting compute >=3.0" + << std::endl; + + return 1; +} + +int main(int argc, char** argv) +{ + int ret = choose_cuda_device(); + if (ret) { + return 0; + } + + cudaError_t err; +#ifndef _WIN32 + file1_launch_kernel(1); + err = cudaGetLastError(); + if (err != cudaSuccess) { + std::cerr << "file1_launch_kernel: kernel launch should have passed.\n " + "Error message: " + << cudaGetErrorString(err) << std::endl; + return 1; + } +#endif + + file2_launch_kernel(1); + err = cudaGetLastError(); + if (err != cudaSuccess) { + std::cerr << "file2_launch_kernel: kernel launch should have passed.\n " + "Error message: " + << cudaGetErrorString(err) << std::endl; + return 1; + } + + return 0; +} diff --git a/Tests/CudaOnly/RuntimeControls/no_runtime.cmake b/Tests/CudaOnly/RuntimeControls/no_runtime.cmake new file mode 100644 index 0000000..55f28cc --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/no_runtime.cmake @@ -0,0 +1,14 @@ +execute_process(COMMAND ${DUMP_COMMAND} ${DUMP_ARGS} ${TEST_LIBRARY_PATH} + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE ERROR +) + +if(NOT "${RESULT}" STREQUAL "0") + message(FATAL_ERROR "${DUMP_COMMAND} failed [${RESULT}] [${OUTPUT}] [${ERROR}]") +endif() + +if(NOT "${OUTPUT}" MATCHES "(__cuda)") + message(FATAL_ERROR + "not missing cuda device symbols, static runtime linking was used.") +endif() diff --git a/Tests/CudaOnly/RuntimeControls/uses_static_runtime.cmake b/Tests/CudaOnly/RuntimeControls/uses_static_runtime.cmake new file mode 100644 index 0000000..b372fea --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/uses_static_runtime.cmake @@ -0,0 +1,14 @@ +execute_process(COMMAND ${DUMP_COMMAND} ${DUMP_ARGS} ${TEST_LIBRARY_PATH} + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE ERROR +) + +if(NOT "${RESULT}" STREQUAL "0") + message(FATAL_ERROR "${DUMP_COMMAND} failed [${RESULT}] [${OUTPUT}] [${ERROR}]") +endif() + +if("${OUTPUT}" MATCHES "__cuda") + message(FATAL_ERROR + "missing cuda device symbols, static runtime linking was not used.") +endif() diff --git a/Tests/CudaOnly/RuntimeControls/verify_runtime.cmake b/Tests/CudaOnly/RuntimeControls/verify_runtime.cmake new file mode 100644 index 0000000..b313dac --- /dev/null +++ b/Tests/CudaOnly/RuntimeControls/verify_runtime.cmake @@ -0,0 +1,16 @@ + +string(REPLACE "|" ";" dirs "${EXTRA_LIB_DIRS}") +file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR resolved_libs + UNRESOLVED_DEPENDENCIES_VAR unresolved_libs + DIRECTORIES ${dirs} + EXECUTABLES ${EXEC_PATH} + ) + +list(FILTER resolved_libs INCLUDE REGEX ".*cudart.*") +list(LENGTH resolved_libs has_cudart) + +if(has_cudart EQUAL 0) + message(FATAL_ERROR + "missing cudart shared library from runtime dependency output.") +endif() diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt new file mode 100644 index 0000000..03fba22 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.15) +project(SharedRuntimePlusToolkit CUDA) + +#Goal for this example: +# Validate that with c++ we can use some components of the CUDA toolkit, and +# specify the cuda runtime +find_package(CUDAToolkit REQUIRED) + +add_library(Common OBJECT curand.cu nppif.cu) +target_link_libraries(Common PRIVATE CUDA::toolkit) +set_target_properties(Common PROPERTIES POSITION_INDEPENDENT_CODE ON) + +#shared runtime with shared toolkit libraries +add_library(SharedToolkit SHARED shared.cu) +target_link_libraries(SharedToolkit PRIVATE Common PUBLIC CUDA::curand CUDA::nppif) +set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none) +target_link_libraries(SharedToolkit PUBLIC CUDA::cudart) + +# The CUDA only ships the shared version of the toolkit libraries +# on windows +if(NOT WIN32) + #shared runtime with static toolkit libraries + add_library(StaticToolkit SHARED static.cu) + target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) + set_target_properties(StaticToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared) + + #static runtime with mixed toolkit libraries + add_library(MixedToolkit SHARED mixed.cu) + target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand_static CUDA::nppif) + set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Shared) +endif() + +add_executable(CudaOnlySharedRuntimePlusToolkit main.cu) +target_link_libraries(CudaOnlySharedRuntimePlusToolkit PRIVATE SharedToolkit + $<TARGET_NAME_IF_EXISTS:StaticToolkit> + $<TARGET_NAME_IF_EXISTS:MixedToolkit>) + +if(UNIX) + # Help the shared cuda runtime find libcudart as it is not located + # in a default system searched location + set_property(TARGET CudaOnlySharedRuntimePlusToolkit PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/curand.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/curand.cu new file mode 100644 index 0000000..fdd7b53 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/curand.cu @@ -0,0 +1,65 @@ +// Comes from: +// https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +/* + * This program uses the host CURAND API to generate 100 + * pseudorandom floats. + */ +#include <cuda.h> +#include <curand.h> +#include <stdio.h> +#include <stdlib.h> + +#define CUDA_CALL(x) \ + do { \ + if ((x) != cudaSuccess) { \ + printf("Error at %s:%d\n", __FILE__, __LINE__); \ + return EXIT_FAILURE; \ + } \ + } while (0) +#define CURAND_CALL(x) \ + do { \ + if ((x) != CURAND_STATUS_SUCCESS) { \ + printf("Error at %s:%d\n", __FILE__, __LINE__); \ + return EXIT_FAILURE; \ + } \ + } while (0) + +EXPORT int curand_main() +{ + size_t n = 100; + size_t i; + curandGenerator_t gen; + float *devData, *hostData; + + /* Allocate n floats on host */ + hostData = (float*)calloc(n, sizeof(float)); + + /* Allocate n floats on device */ + CUDA_CALL(cudaMalloc((void**)&devData, n * sizeof(float))); + + /* Create pseudo-random number generator */ + CURAND_CALL(curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT)); + + /* Set seed */ + CURAND_CALL(curandSetPseudoRandomGeneratorSeed(gen, 1234ULL)); + + /* Generate n floats on device */ + CURAND_CALL(curandGenerateUniform(gen, devData, n)); + + /* Copy device memory to host */ + CUDA_CALL( + cudaMemcpy(hostData, devData, n * sizeof(float), cudaMemcpyDeviceToHost)); + + /* Cleanup */ + CURAND_CALL(curandDestroyGenerator(gen)); + CUDA_CALL(cudaFree(devData)); + free(hostData); + return EXIT_SUCCESS; +} diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu new file mode 100644 index 0000000..2a4da22 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/main.cu @@ -0,0 +1,23 @@ + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +IMPORT int shared_version(); +int static_version() +{ + return 0; +} +int mixed_version() +{ + return 0; +} +#else +int shared_version(); +int static_version(); +int mixed_version(); +#endif + +int main() +{ + return mixed_version() == 0 && shared_version() == 0 && + static_version() == 0; +} diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/mixed.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/mixed.cu new file mode 100644 index 0000000..6de6886 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/mixed.cu @@ -0,0 +1,16 @@ + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif + +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int mixed_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu new file mode 100644 index 0000000..ac5341c --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu @@ -0,0 +1,92 @@ +// Comes from +// https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066 + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +#include <cstdio> +#include <iostream> + +#include <assert.h> +#include <cuda_runtime_api.h> +#include <nppi_filtering_functions.h> + +EXPORT int nppif_main() +{ + /** + * 8-bit unsigned single-channel 1D row convolution. + */ + const int simgrows = 32; + const int simgcols = 32; + Npp8u *d_pSrc, *d_pDst; + const int nMaskSize = 3; + NppiSize oROI; + oROI.width = simgcols - nMaskSize; + oROI.height = simgrows; + const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]); + const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]); + const int simgpix = simgrows * simgcols; + const int dimgpix = oROI.width * oROI.height; + const int nSrcStep = simgcols * sizeof(d_pSrc[0]); + const int nDstStep = oROI.width * sizeof(d_pDst[0]); + const int pixval = 1; + const int nDivisor = 1; + const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval }; + Npp32s* d_pKernel; + const Npp32s nAnchor = 2; + cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMalloc((void**)&d_pDst, dimgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMalloc((void**)&d_pKernel, nMaskSize * sizeof(d_pKernel[0])); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // set image to pixval initially + err = cudaMemset(d_pSrc, pixval, simgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMemset(d_pDst, 0, dimgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMemcpy(d_pKernel, h_pKernel, nMaskSize * sizeof(d_pKernel[0]), + cudaMemcpyHostToDevice); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // copy src to dst + NppStatus ret = + nppiFilterRow_8u_C1R(d_pSrc, nSrcStep, d_pDst, nDstStep, oROI, d_pKernel, + nMaskSize, nAnchor, nDivisor); + assert(ret == NPP_NO_ERROR); + Npp8u* h_imgres = new Npp8u[dimgpix]; + err = cudaMemcpy(h_imgres, d_pDst, dimgsize, cudaMemcpyDeviceToHost); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // test for filtering + for (int i = 0; i < dimgpix; i++) { + if (h_imgres[i] != (pixval * pixval * nMaskSize)) { + fprintf(stderr, "h_imgres at index %d failed to match\n", i); + return 1; + } + } + + return 0; +} diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/shared.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/shared.cu new file mode 100644 index 0000000..f3c3dbc --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/shared.cu @@ -0,0 +1,16 @@ + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif + +int curand_main(); +int nppif_main(); + +EXPORT int shared_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/static.cu b/Tests/CudaOnly/SharedRuntimePlusToolkit/static.cu new file mode 100644 index 0000000..6932fa3 --- /dev/null +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/static.cu @@ -0,0 +1,16 @@ + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +# define EXPORT __declspec(dllexport) +#else +# define IMPORT +# define EXPORT +#endif + +IMPORT int curand_main(); +IMPORT int nppif_main(); + +EXPORT int static_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt new file mode 100644 index 0000000..97ac229 --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15) +project(StaticRuntimePlusToolkit CUDA) + +#Goal for this example: +# Validate that with cuda we can use some components of the CUDA toolkit, and +# specify the cuda runtime +find_package(CUDAToolkit REQUIRED) + +add_library(Common OBJECT curand.cu nppif.cu) +target_link_libraries(Common PRIVATE CUDA::toolkit) +set_target_properties(Common PROPERTIES POSITION_INDEPENDENT_CODE ON) + +#static runtime with shared toolkit libraries +add_library(SharedToolkit SHARED shared.cu) +target_link_libraries(SharedToolkit PRIVATE Common CUDA::curand CUDA::nppif ) +set_target_properties(SharedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY none) +target_link_libraries(SharedToolkit PUBLIC CUDA::cudart_static) + +#static runtime with static toolkit libraries +add_library(StaticToolkit SHARED static.cu) +target_link_libraries(StaticToolkit PRIVATE Common CUDA::curand_static CUDA::nppif_static) + +#static runtime with mixed toolkit libraries +add_library(MixedToolkit SHARED mixed.cu) +target_link_libraries(MixedToolkit PRIVATE Common CUDA::curand CUDA::nppif_static) +set_target_properties(MixedToolkit PROPERTIES CUDA_RUNTIME_LIBRARY Static) + +add_executable(CudaOnlyStaticRuntimePlusToolkit main.cu) +target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit StaticToolkit MixedToolkit) diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu new file mode 100644 index 0000000..95872f0 --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/curand.cu @@ -0,0 +1,59 @@ +// Comes from: +// https://docs.nvidia.com/cuda/curand/host-api-overview.html#host-api-example + +/* + * This program uses the host CURAND API to generate 100 + * pseudorandom floats. + */ +#include <cuda.h> +#include <curand.h> +#include <stdio.h> +#include <stdlib.h> + +#define CUDA_CALL(x) \ + do { \ + if ((x) != cudaSuccess) { \ + printf("Error at %s:%d\n", __FILE__, __LINE__); \ + return EXIT_FAILURE; \ + } \ + } while (0) +#define CURAND_CALL(x) \ + do { \ + if ((x) != CURAND_STATUS_SUCCESS) { \ + printf("Error at %s:%d\n", __FILE__, __LINE__); \ + return EXIT_FAILURE; \ + } \ + } while (0) + +int curand_main() +{ + size_t n = 100; + size_t i; + curandGenerator_t gen; + float *devData, *hostData; + + /* Allocate n floats on host */ + hostData = (float*)calloc(n, sizeof(float)); + + /* Allocate n floats on device */ + CUDA_CALL(cudaMalloc((void**)&devData, n * sizeof(float))); + + /* Create pseudo-random number generator */ + CURAND_CALL(curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT)); + + /* Set seed */ + CURAND_CALL(curandSetPseudoRandomGeneratorSeed(gen, 1234ULL)); + + /* Generate n floats on device */ + CURAND_CALL(curandGenerateUniform(gen, devData, n)); + + /* Copy device memory to host */ + CUDA_CALL( + cudaMemcpy(hostData, devData, n * sizeof(float), cudaMemcpyDeviceToHost)); + + /* Cleanup */ + CURAND_CALL(curandDestroyGenerator(gen)); + CUDA_CALL(cudaFree(devData)); + free(hostData); + return EXIT_SUCCESS; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu new file mode 100644 index 0000000..5a09f8e --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/main.cu @@ -0,0 +1,11 @@ + + +int shared_version(); +int static_version(); +int mixed_version(); + +int main() +{ + return mixed_version() == 0 && shared_version() == 0 && + static_version() == 0; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu new file mode 100644 index 0000000..a05140d --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/mixed.cu @@ -0,0 +1,8 @@ + +int curand_main(); +int nppif_main(); + +int mixed_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu new file mode 100644 index 0000000..2871090 --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu @@ -0,0 +1,86 @@ +// Comes from +// https://devtalk.nvidia.com/default/topic/1037482/gpu-accelerated-libraries/help-me-help-you-with-modern-cmake-and-cuda-mwe-for-npp/post/5271066/#5271066 + +#include <cstdio> +#include <iostream> + +#include <assert.h> +#include <cuda_runtime_api.h> +#include <nppi_filtering_functions.h> + +int nppif_main() +{ + /** + * 8-bit unsigned single-channel 1D row convolution. + */ + const int simgrows = 32; + const int simgcols = 32; + Npp8u *d_pSrc, *d_pDst; + const int nMaskSize = 3; + NppiSize oROI; + oROI.width = simgcols - nMaskSize; + oROI.height = simgrows; + const int simgsize = simgrows * simgcols * sizeof(d_pSrc[0]); + const int dimgsize = oROI.width * oROI.height * sizeof(d_pSrc[0]); + const int simgpix = simgrows * simgcols; + const int dimgpix = oROI.width * oROI.height; + const int nSrcStep = simgcols * sizeof(d_pSrc[0]); + const int nDstStep = oROI.width * sizeof(d_pDst[0]); + const int pixval = 1; + const int nDivisor = 1; + const Npp32s h_pKernel[nMaskSize] = { pixval, pixval, pixval }; + Npp32s* d_pKernel; + const Npp32s nAnchor = 2; + cudaError_t err = cudaMalloc((void**)&d_pSrc, simgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMalloc((void**)&d_pDst, dimgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMalloc((void**)&d_pKernel, nMaskSize * sizeof(d_pKernel[0])); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // set image to pixval initially + err = cudaMemset(d_pSrc, pixval, simgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMemset(d_pDst, 0, dimgsize); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + err = cudaMemcpy(d_pKernel, h_pKernel, nMaskSize * sizeof(d_pKernel[0]), + cudaMemcpyHostToDevice); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // copy src to dst + NppStatus ret = + nppiFilterRow_8u_C1R(d_pSrc, nSrcStep, d_pDst, nDstStep, oROI, d_pKernel, + nMaskSize, nAnchor, nDivisor); + assert(ret == NPP_NO_ERROR); + Npp8u* h_imgres = new Npp8u[dimgpix]; + err = cudaMemcpy(h_imgres, d_pDst, dimgsize, cudaMemcpyDeviceToHost); + if (err != cudaSuccess) { + fprintf(stderr, "Cuda error %d\n", __LINE__); + return 1; + } + // test for filtering + for (int i = 0; i < dimgpix; i++) { + if (h_imgres[i] != (pixval * pixval * nMaskSize)) { + fprintf(stderr, "h_imgres at index %d failed to match\n", i); + return 1; + } + } + + return 0; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu new file mode 100644 index 0000000..9967b66 --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/shared.cu @@ -0,0 +1,8 @@ + +int curand_main(); +int nppif_main(); + +int shared_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu new file mode 100644 index 0000000..ca7eb4c --- /dev/null +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/static.cu @@ -0,0 +1,8 @@ + +int curand_main(); +int nppif_main(); + +int static_version() +{ + return curand_main() == 0 && nppif_main() == 0; +} diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 196fea3..53d56bf 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -566,3 +566,11 @@ add_custom_command( ) add_custom_target(depends_on_in_rel_source_path ALL DEPENDS "depends_on_in_rel_source_path.txt") + +add_library(mac_fw SHARED mac_fw.c) +set_target_properties(mac_fw PROPERTIES + FRAMEWORK 1 + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib + ) +add_custom_command(OUTPUT mac_fw.txt COMMAND ${CMAKE_COMMAND} -E touch mac_fw.txt DEPENDS mac_fw) +add_custom_target(drive_mac_fw ALL DEPENDS mac_fw.txt) diff --git a/Tests/CustomCommand/mac_fw.c b/Tests/CustomCommand/mac_fw.c new file mode 100644 index 0000000..cb35b44 --- /dev/null +++ b/Tests/CustomCommand/mac_fw.c @@ -0,0 +1,4 @@ +int mac_fw(void) +{ + return 0; +} diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt index b65b9d2..6537238 100644 --- a/Tests/FindGTest/Test/CMakeLists.txt +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -8,6 +8,10 @@ add_executable(test_gtest_tgt main.cxx) target_link_libraries(test_gtest_tgt GTest::Main) add_test(NAME test_gtest_tgt COMMAND test_gtest_tgt) +add_executable(test_gtest_tgt_upstream main.cxx) +target_link_libraries(test_gtest_tgt_upstream GTest::gtest_main) +add_test(NAME test_gtest_tgt_upstream COMMAND test_gtest_tgt_upstream) + add_executable(test_gtest_var main.cxx) target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS}) target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp index e1fdf0b..198ae98 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp @@ -10,7 +10,7 @@ class StyleA : public QStylePlugin Q_OBJECT // Json file in source local directory Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json") - A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg) + A_CUSTOM_MACRO(org.styles.A, "StyleA_Custom.json", AnotherArg) public: QStyle* create(const QString& key); }; diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp index 7550d0c..8ce8d77 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp @@ -10,7 +10,7 @@ class StyleB : public QStylePlugin Q_OBJECT // Json file in source local subdirectory Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json") - A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg) + A_CUSTOM_MACRO(org.styles.B, "jsonIn/StyleB_Custom.json", AnotherArg) public: QStyle* create(const QString& key); }; diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp index ec71bec..53171e3 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp @@ -10,7 +10,7 @@ class StyleC : public QStylePlugin Q_OBJECT // Json file in global root directory Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json") - A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg) + A_CUSTOM_MACRO(org.styles.C, "StyleC_Custom.json", AnotherArg) public: QStyle* create(const QString& key); }; diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp index 3c093b9..29674f9 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp @@ -10,7 +10,7 @@ class StyleD : public QStylePlugin Q_OBJECT // Json file in global sub director Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json") - A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg) + A_CUSTOM_MACRO(org.styles.D, "sub/StyleD_Custom.json", AnotherArg) public: QStyle* create(const QString& key); }; diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp index 5f10fb4..7318220 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp @@ -10,7 +10,7 @@ class StyleE : public QStylePlugin Q_OBJECT // Json files in global root directory Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json") - A_CUSTOM_MACRO(SomeArg, "StyleE_Custom.json", AnotherArg) + A_CUSTOM_MACRO(org.styles.E, "StyleE_Custom.json", AnotherArg) public: QStyle* create(const QString& key); }; diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp index 53a4284..2f558a8 100644 --- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp @@ -1,7 +1,7 @@ #ifndef UTILITYMACROS_HPP #define UTILITYMACROS_HPP -// Empty test macro definition -#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations) +#define A_CUSTOM_MACRO(url, jsonFile, pluginRegistrations) \ + Q_PLUGIN_METADATA(IID #url FILE jsonFile) #endif diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-result.txt b/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-stdout.txt b/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-stdout.txt new file mode 100644 index 0000000..760ba3c --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicit-build-stdout.txt @@ -0,0 +1 @@ +ERROR: Undefined symbol: .AIXNotExported diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicit.cmake b/Tests/RunCMake/AutoExportDll/AIXExportExplicit.cmake new file mode 100644 index 0000000..d23b172 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicit.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF) +add_library(AIXExportExplicitLib SHARED AIXExportExplicitLib.c) +add_executable(AIXExportExplicitMain AIXExportExplicitMain.c) +target_link_options(AIXExportExplicitLib PRIVATE LINKER:-bE:${CMAKE_CURRENT_SOURCE_DIR}/AIXExportExplicitLib.exp) +target_link_libraries(AIXExportExplicitMain PRIVATE AIXExportExplicitLib) diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.c b/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.c new file mode 100644 index 0000000..58fd5ac --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.c @@ -0,0 +1,8 @@ +int AIXNotExported(void) +{ + return 0; +} +int AIXExportedSymbol(void) +{ + return 0; +} diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.exp b/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.exp new file mode 100644 index 0000000..9eb7bf8 --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicitLib.exp @@ -0,0 +1 @@ +AIXExportedSymbol diff --git a/Tests/RunCMake/AutoExportDll/AIXExportExplicitMain.c b/Tests/RunCMake/AutoExportDll/AIXExportExplicitMain.c new file mode 100644 index 0000000..ad9c8ec --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/AIXExportExplicitMain.c @@ -0,0 +1,7 @@ +extern int AIXNotExported(void); +extern int AIXExportedSymbol(void); + +int main(void) +{ + return AIXNotExported() + AIXExportedSymbol(); +} diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index 6c9be4b..75130f2 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -55,3 +55,14 @@ if(EXPORTS) message(SEND_ERROR "\"${EXPORTS_DEF}\" has been updated.") endif() endif() + +function(run_AIXExportExplicit) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/AIXExpotExplicit-build") + run_cmake(AIXExportExplicit) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + run_cmake_command(AIXExportExplicit-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() +if(CMAKE_SYSTEM_NAME STREQUAL "AIX") + run_AIXExportExplicit() +endif() diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake index 98274f0..5952279 100644 --- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -1,5 +1,24 @@ include(RunCMake) +if(RunCMake_GENERATOR MATCHES "^Ninja") + # Detect ninja version so we know what tests can be supported. + execute_process( + COMMAND "${RunCMake_MAKE_PROGRAM}" --version + OUTPUT_VARIABLE ninja_out + ERROR_VARIABLE ninja_out + RESULT_VARIABLE ninja_res + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+") + set(ninja_version "${ninja_out}") + message(STATUS "ninja version: ${ninja_version}") + else() + message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") + endif() +else() + set(ninja_version "") +endif() + run_cmake(CMP0037-OLD-space) run_cmake(CMP0037-NEW-space) run_cmake(CMP0037-WARN-space) @@ -9,8 +28,10 @@ if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make")) run_cmake(CMP0037-WARN-colon) endif() -run_cmake(CMP0037-WARN-reserved) -run_cmake(CMP0037-OLD-reserved) +if(NOT ninja_version VERSION_GREATER_EQUAL 1.10) + run_cmake(CMP0037-WARN-reserved) + run_cmake(CMP0037-OLD-reserved) +endif() run_cmake(CMP0037-NEW-reserved) run_cmake(NEW-cond) diff --git a/Tests/RunCMake/CMP0102/CMP0102-Common.cmake b/Tests/RunCMake/CMP0102/CMP0102-Common.cmake new file mode 100644 index 0000000..61fdad6 --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-Common.cmake @@ -0,0 +1,2 @@ + +mark_as_advanced(CMP0102_TEST_VARIABLE) diff --git a/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake b/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake new file mode 100644 index 0000000..bdf769f --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake @@ -0,0 +1,13 @@ + +cmake_policy(SET CMP0102 NEW) + +include (CMP0102-Common.cmake) +get_property(is_type_set CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE SET) +if (is_type_set) + get_property(type CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE) + message(FATAL_ERROR + "There is a cache entry for an undefined variable after " + "`mark_as_advanced`.") +endif () diff --git a/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake b/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake new file mode 100644 index 0000000..5c20dd3 --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake @@ -0,0 +1,18 @@ + +cmake_policy(SET CMP0102 OLD) + +include (CMP0102-Common.cmake) +get_property(is_type_set CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE SET) +if (NOT is_type_set) + message(FATAL_ERROR + "There is a cache entry for an undefined variable after " + "`mark_as_advanced`.") +endif () +get_property(type CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE) +if (NOT type STREQUAL "UNINITIALIZED") + message(FATAL_ERROR + "The cache type for CMP0102_TEST_VARIABLE is not " + "UNINITIALIZED") +endif () diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake b/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake new file mode 100644 index 0000000..d6ebe4d --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake @@ -0,0 +1,16 @@ + +include (CMP0102-Common.cmake) +get_property(is_type_set CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE SET) +if (NOT is_type_set) + message(FATAL_ERROR + "There is a cache entry for an undefined variable after " + "`mark_as_advanced`.") +endif () +get_property(type CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE) +if (NOT type STREQUAL "UNINITIALIZED") + message(FATAL_ERROR + "The cache type for CMP0102_TEST_VARIABLE is not " + "UNINITIALIZED") +endif () diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt b/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt new file mode 100644 index 0000000..bb56ec2 --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0102-Common.cmake:2 \(mark_as_advanced\): + Policy CMP0102 is not set: The variable named "CMP0102_TEST_VARIABLE" is + not in the cache. This results in an empty cache entry which is no longer + created when policy CMP0102 is set to NEW. Run "cmake --help-policy + CMP0102" for policy details. Use the cmake_policy command to set the + policy and suppress this warning. +Call Stack \(most recent call first\): + CMP0102-WARN.cmake:4 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake b/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake new file mode 100644 index 0000000..e9a45f1 --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake @@ -0,0 +1,18 @@ + +set(CMAKE_POLICY_WARNING_CMP0102 1) + +include (CMP0102-Common.cmake) +get_property(is_type_set CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE SET) +if (NOT is_type_set) + message(FATAL_ERROR + "There is a cache entry for an undefined variable after " + "`mark_as_advanced`.") +endif () +get_property(type CACHE CMP0102_TEST_VARIABLE + PROPERTY TYPE) +if (NOT type STREQUAL "UNINITIALIZED") + message(FATAL_ERROR + "The cache type for CMP0102_TEST_VARIABLE is not " + "UNINITIALIZED") +endif () diff --git a/Tests/RunCMake/CMP0102/CMakeLists.txt b/Tests/RunCMake/CMP0102/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/CMP0102/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0102/RunCMakeTest.cmake b/Tests/RunCMake/CMP0102/RunCMakeTest.cmake new file mode 100644 index 0000000..9b5df74 --- /dev/null +++ b/Tests/RunCMake/CMP0102/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0102-OLD) +run_cmake(CMP0102-NEW) +run_cmake(CMP0102-WARN) +run_cmake(CMP0102-WARN-Default) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d302fe3..e9f8bca 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -115,6 +115,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) endif() add_RunCMake_test(CMP0069) add_RunCMake_test(CMP0081) +add_RunCMake_test(CMP0102) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -305,6 +306,7 @@ add_RunCMake_test(test_include_dirs) add_RunCMake_test(BundleUtilities) if(APPLE) add_RunCMake_test(INSTALL_NAME_DIR) + add_RunCMake_test(MacOSVersions) endif() function(add_RunCMake_test_try_compile) @@ -472,7 +474,9 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DCMAK -DCMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN=${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} - -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT}) + -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT} + -DCMake_INSTALL_NAME_TOOL_BUG=${CMake_INSTALL_NAME_TOOL_BUG} + ) add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) @@ -610,7 +614,10 @@ endif() add_RunCMake_test_group(CPack "${cpack_tests}") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used -add_RunCMake_test(AutoExportDll -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}) +add_RunCMake_test(AutoExportDll + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} + ) add_RunCMake_test(AndroidMK) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 0fb0cc4..3be1fd0 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -38,7 +38,7 @@ run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_B run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests( DEB_DESCRIPTION - "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION" + "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_COMPONENT_COMP_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION" "DEB.DEB_DESCRIPTION" false "MONOLITHIC;COMPONENT" diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake index a8e2e7a..bfe2059 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake @@ -58,6 +58,8 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE" AND PACKAGI string(APPEND _expected_description "\n ." ) elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION") set(_expected_description [[ Description: This is the summary line]]) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION") + set(_expected_description [[ Description: One line description]]) endif() foreach(_file_no RANGE 1 ${EXPECTED_FILES_COUNT}) diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake index ce3f651..893eb01 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake @@ -34,6 +34,16 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION") set(CPACK_PACKAGE_DESCRIPTION "${_description}") endif() +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION") + # NOTE Documented fallback variable without CPACK_PACKAGE_DESCRIPTION_SUMMARY + if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENT_SATU_DESCRIPTION "One line description") + set(CPACK_COMPONENT_DUA_DESCRIPTION "One line description") + else() + set(CPACK_PACKAGE_DESCRIPTION "One line description") + endif() + unset(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE") # NOTE Getting the description from the file set(_file "${CMAKE_CURRENT_BINARY_DIR}/description.txt") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake index c47b40e..b4bdb61 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake @@ -8,9 +8,6 @@ endfunction() if(GENERATOR_TYPE STREQUAL "DEB") set(name_ "Package") set(group_ "Section") - # NOTE For a Debian package the first line of the `Description` - # field is generated by CMake and gonna be ignored - set(ignore_rest_cond_ ".*\n") elseif(GENERATOR_TYPE STREQUAL "RPM") set(name_ "Name") set(group_ "Group") @@ -36,6 +33,6 @@ if(GENERATOR_TYPE STREQUAL "RPM") endif() # check package description -checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_1") -checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_2") -checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_3") +checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1") +checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2") +checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3") diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index b2de596..9b9ae65 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -314,5 +314,34 @@ function(run_ShowOnly) endfunction() run_ShowOnly() +function(run_NoTests) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoTests) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "") + run_cmake_command(no-tests_ignore ${CMAKE_CTEST_COMMAND} --no-tests=ignore) + run_cmake_command(no-tests_error ${CMAKE_CTEST_COMMAND} --no-tests=error) + run_cmake_command(no-tests_bad ${CMAKE_CTEST_COMMAND} --no-tests=bad) + run_cmake_command(no-tests_legacy ${CMAKE_CTEST_COMMAND}) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake" " + set(CTEST_COMMAND \"${CMAKE_CTEST_COMMAND}\") + set(CTEST_SOURCE_DIRECTORY \"${RunCMake_SOURCE_DIR}\") + set(CTEST_BINARY_DIRECTORY \"${RunCMake_TEST_BINARY_DIR}\") + ctest_start(Experimental) + ctest_test() +") + run_cmake_command( + no-tests-script_ignore ${CMAKE_CTEST_COMMAND} --no-tests=ignore + -S "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake") + run_cmake_command( + no-tests-script_error ${CMAKE_CTEST_COMMAND} --no-tests=error + -S "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake") + run_cmake_command( + no-tests-script_legacy ${CMAKE_CTEST_COMMAND} + -S "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake") +endfunction() +run_NoTests() + # Check the configuration type variable is passed run_ctest(check-configuration-type) diff --git a/Tests/RunCMake/CTestCommandLine/no-tests-script_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests-script_error-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests-script_error-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestCommandLine/no-tests-script_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests-script_error-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests-script_error-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests-script_legacy-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_bad-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_bad-stderr.txt new file mode 100644 index 0000000..1703539 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_bad-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--no-tests=' given unknown value 'bad'$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_error-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_error-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_error-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_error-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_legacy-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_legacy-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_legacy-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4bdc759..087ef21 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -667,3 +667,33 @@ if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") run_cmake_command(closed_stderr sh -c "\"${CMAKE_COMMAND}\" --version 2>&-") run_cmake_command(closed_stdall sh -c "\"${CMAKE_COMMAND}\" --version <&- >&- 2>&-") endif() + +function(run_llvm_rc) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/llvm_rc-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc) + run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E false -- ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E false ) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp) + message(SEND_ERROR "${test} - FAILED:\n" + "test.tmp was not deleted") + endif() + run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E copy test.tmp llvmrc.result ) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp) + message(SEND_ERROR "${test} - FAILED:\n" + "test.tmp was not deleted") + endif() + file(READ ${RunCMake_TEST_BINARY_DIR}/llvmrc.result LLVMRC_RESULT) + if(NOT "${LLVMRC_RESULT}" STREQUAL "This is a test\n") + message(SEND_ERROR "${test} - FAILED:\n" + "llvmrc.result was not created") + endif() + # file(REMOVE ${RunCMake_TEST_BINARY_DIR}/llvmrc.result) + unset(LLVMRC_RESULT) +endfunction() +run_llvm_rc() diff --git a/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt new file mode 100644 index 0000000..cb69366 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt @@ -0,0 +1 @@ +Empty preprocessing command diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt new file mode 100644 index 0000000..9c140b7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt @@ -0,0 +1 @@ +Empty resource compilation command diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt new file mode 100644 index 0000000..d66b547 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt @@ -0,0 +1 @@ +Invalid cmake_llvm_rc arguments diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.py b/Tests/RunCMake/CommandLine/trace-json-v1-check.py index 14febaf..e617b76 100755 --- a/Tests/RunCMake/CommandLine/trace-json-v1-check.py +++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.py @@ -46,6 +46,7 @@ required_traces = [ { 'args': msg_args, 'cmd': 'message', + 'frame': 3 if expand else 2 }, ] @@ -59,14 +60,17 @@ with open(trace_file, 'r') as fp: for i in fp.readlines(): line = json.loads(i) - assert sorted(line.keys()) == ['args', 'cmd', 'file', 'line'] + assert sorted(line.keys()) == ['args', 'cmd', 'file', 'frame', 'line', 'time'] assert isinstance(line['args'], list) assert isinstance(line['cmd'], unicode) assert isinstance(line['file'], unicode) + assert isinstance(line['frame'], int) assert isinstance(line['line'], int) + assert isinstance(line['time'], float) for j in required_traces: - if j['cmd'] == line['cmd'] and j['args'] == line['args']: - j['found'] = True + # Compare the subset of required keys with line + if {k: line[k] for k in j} == j: + required_traces.remove(j) -assert all([x.get('found', False) == True for x in required_traces]) +assert not required_traces diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index f8adb64..8cdc00c 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -34,6 +34,10 @@ function(check_python case) endif() endfunction() +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") +endif() + run_cmake(Nothing) run_cmake(Empty) run_cmake(EmptyClient) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index de6253f..9ee0c20 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -1,8 +1,14 @@ from check_index import * +import json import sys import os +def read_codemodel_json_data(filename): + abs_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), "codemodel-v2-data", filename) + with open(abs_filename, "r") as f: + return json.load(f) + def check_objects(o, g): assert is_list(o) assert len(o) == 1 @@ -471,154 +477,15 @@ def check_project(c): def gen_check_directories(c, g): expected = [ - { - "source": "^\\.$", - "build": "^\\.$", - "parentSource": None, - "childSources": [ - "^alias$", - "^custom$", - "^cxx$", - "^imported$", - "^object$", - "^.*/Tests/RunCMake/FileAPIExternalSource$", - "^dir$", - ], - "targetIds": [ - "^ALL_BUILD::@6890427a1f51a3e7e1df$", - "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "^c_exe::@6890427a1f51a3e7e1df$", - "^c_lib::@6890427a1f51a3e7e1df$", - "^c_shared_exe::@6890427a1f51a3e7e1df$", - "^c_shared_lib::@6890427a1f51a3e7e1df$", - "^c_static_exe::@6890427a1f51a3e7e1df$", - "^c_static_lib::@6890427a1f51a3e7e1df$", - "^interface_exe::@6890427a1f51a3e7e1df$", - ], - "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", - "hasInstallRule": True, - }, - { - "source": "^alias$", - "build": "^alias$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@53632cba2752272bb008$", - "^ZERO_CHECK::@53632cba2752272bb008$", - "^c_alias_exe::@53632cba2752272bb008$", - "^cxx_alias_exe::@53632cba2752272bb008$", - ], - "projectName": "Alias", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^custom$", - "build": "^custom$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@c11385ffed57b860da63$", - "^ZERO_CHECK::@c11385ffed57b860da63$", - "^custom_exe::@c11385ffed57b860da63$", - "^custom_tgt::@c11385ffed57b860da63$", - ], - "projectName": "Custom", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^cxx$", - "build": "^cxx$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@a56b12a3f5c0529fb296$", - "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "^cxx_exe::@a56b12a3f5c0529fb296$", - "^cxx_lib::@a56b12a3f5c0529fb296$", - "^cxx_shared_exe::@a56b12a3f5c0529fb296$", - "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "^cxx_static_exe::@a56b12a3f5c0529fb296$", - "^cxx_static_lib::@a56b12a3f5c0529fb296$", - ], - "projectName": "Cxx", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^imported$", - "build": "^imported$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@ba7eb709d0b48779c6c8$", - "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "^link_imported_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", - ], - "projectName": "Imported", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^object$", - "build": "^object$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@5ed5358f70faf8d8af7a$", - "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "^c_object_exe::@5ed5358f70faf8d8af7a$", - "^c_object_lib::@5ed5358f70faf8d8af7a$", - "^cxx_object_exe::@5ed5358f70faf8d8af7a$", - "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - ], - "projectName": "Object", - "minimumCMakeVersion": "3.13", - "hasInstallRule": True, - }, - { - "source": "^dir$", - "build": "^dir$", - "parentSource": "^\\.$", - "childSources": [ - "^dir/dir$", - ], - "targetIds": None, - "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^dir/dir$", - "build": "^dir/dir$", - "parentSource": "^dir$", - "childSources": None, - "targetIds": None, - "projectName": "codemodel-v2", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, - { - "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", - "parentSource": "^\\.$", - "childSources": None, - "targetIds": [ - "^ALL_BUILD::@[0-9a-f]+$", - "^ZERO_CHECK::@[0-9a-f]+$", - "^generated_exe::@[0-9a-f]+$", - ], - "projectName": "External", - "minimumCMakeVersion": "3.12", - "hasInstallRule": None, - }, + read_codemodel_json_data("directories/top.json"), + read_codemodel_json_data("directories/alias.json"), + read_codemodel_json_data("directories/custom.json"), + read_codemodel_json_data("directories/cxx.json"), + read_codemodel_json_data("directories/imported.json"), + read_codemodel_json_data("directories/object.json"), + read_codemodel_json_data("directories/dir.json"), + read_codemodel_json_data("directories/dir_dir.json"), + read_codemodel_json_data("directories/external.json"), ] if matches(g["name"], "^Visual Studio "): @@ -646,4428 +513,52 @@ def check_directories(c, g): def gen_check_targets(c, g, inSource): expected = [ - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^interface_exe::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_lib::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_exe::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_shared_exe::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_static_lib::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_static_exe::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - { - "id": "^c_alias_exe::@53632cba2752272bb008$", - "backtrace": None, - }, - { - "id": "^cxx_alias_exe::@53632cba2752272bb008$", - "backtrace": None, - }, - { - "id": "^cxx_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^custom_exe::@c11385ffed57b860da63$", - "backtrace": None, - }, - { - "id": "^generated_exe::@[0-9a-f]+$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "interface_exe", - "id": "^interface_exe::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^include_test\\.cmake$", - "line": 3, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^include_test\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": [ - { - "define": "interface_exe_EXPORTS", - "backtrace": None, - }, - ], - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^include_test\\.cmake$", - "line": 3, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^include_test\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^my_interface_exe\\.myexe$", - "artifacts": [ - { - "path": "^bin/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?my_interface_exe\\.myexe$", - "_dllExtra": False, - }, - { - "path": "^lib/my_interface_exe\\.imp$", - "_aixExtra": True, - "_dllExtra": False, - }, - { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?my_interface_exe\\.(dll\\.a|lib)$", - "_dllExtra": True, - }, - { - "path": "^bin/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?my_interface_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_lib", - "id": "^c_lib::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "STATIC_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 5, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 5, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib)?c_lib\\.(a|lib)$", - "artifacts": [ - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_lib\\.(a|lib)$", - "_dllExtra": False, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": None, - "archive": { - "lto": None, - }, - "dependencies": [ - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_exe", - "id": "^c_exe::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 6, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 6, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^c_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^c_lib::@6890427a1f51a3e7e1df$", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 7, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_shared_lib", - "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "SHARED_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": [ - { - "define": "c_shared_lib_EXPORTS", - "backtrace": None, - }, - ], - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", - "artifacts": [ - { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", - "_dllExtra": False, - }, - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_shared_lib\\.(dll\\.a|lib)$", - "_dllExtra": True, - }, - { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": { - "language": "C", - "lto": True, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_shared_exe", - "id": "^c_shared_exe::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^c_shared_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_shared_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_shared_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": { - "language": "C", - "lto": True, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 11, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_static_lib", - "id": "^c_static_lib::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "STATIC_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 13, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 13, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib)?c_static_lib\\.(a|lib)$", - "artifacts": [ - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_static_lib\\.(a|lib)$", - "_dllExtra": False, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": None, - "archive": { - "lto": True, - }, - "dependencies": [ - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "c_static_exe", - "id": "^c_static_exe::@6890427a1f51a3e7e1df$", - "directorySource": "^\\.$", - "projectName": "codemodel-v2", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 14, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 14, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^c_static_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_static_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_static_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^\\.$", - "source": "^\\.$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^c_static_lib::@6890427a1f51a3e7e1df$", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 15, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - { - "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "cxx_lib", - "id": "^cxx_lib::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "STATIC_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 4, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 4, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib)?cxx_lib\\.(a|lib)$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_lib\\.(a|lib)$", - "_dllExtra": False, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": None, - "archive": { - "lto": None, - }, - "dependencies": [ - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_exe", - "id": "^cxx_exe::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": [ - { - "fragment" : "TargetCompileOptions", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 17, - "command": "target_compile_options", - "hasParent": True, - }, - { - "file" : "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - } - ], - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": "bin", - "nameOnDisk": "^cxx_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": { - "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", - "destinations": [ - { - "path": "bin", - "backtrace": [ - { - "file": "^codemodel-v2\\.cmake$", - "line": 37, - "command": "install", - "hasParent": True, - }, - { - "file": "^codemodel-v2\\.cmake$", - "line": None, - "command": None, - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": 3, - "command": "include", - "hasParent": True, - }, - { - "file": "^CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - }, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": [ - { - "fragment" : "TargetLinkOptions", - "role" : "flags", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 18, - "command": "target_link_options", - "hasParent": True, - }, - { - "file" : "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "fragment" : ".*TargetLinkDir\\\"?$", - "role" : "libraryPath", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 19, - "command": "target_link_directories", - "hasParent": True, - }, - { - "file" : "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "fragment" : ".*cxx_lib.*", - "role" : "libraries", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 6, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file" : "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - }, - "archive": None, - "dependencies": [ - { - "id": "^cxx_lib::@a56b12a3f5c0529fb296$", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 6, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_shared_lib", - "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "SHARED_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": [ - { - "define": "cxx_shared_lib_EXPORTS", - "backtrace": None, - }, - ], - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", - "_dllExtra": False, - }, - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_shared_lib\\.(dll\\.a|lib)$", - "_dllExtra": True, - }, - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_shared_exe", - "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^cxx_shared_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_shared_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_shared_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 11, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_static_lib", - "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "STATIC_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 13, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 13, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^(lib)?cxx_static_lib\\.(a|lib)$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_static_lib\\.(a|lib)$", - "_dllExtra": False, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": None, - "archive": { - "lto": None, - }, - "dependencies": [ - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_static_exe", - "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", - "directorySource": "^cxx$", - "projectName": "Cxx", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 14, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 14, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^cxx_static_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_static_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_static_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^cxx$", - "source": "^cxx$", - "install": None, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", - "backtrace": [ - { - "file": "^cxx/CMakeLists\\.txt$", - "line": 15, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^cxx/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@53632cba2752272bb008$", - "directorySource": "^alias$", - "projectName": "Alias", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^alias$", - "source": "^alias$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@53632cba2752272bb008$", - "backtrace": None, - }, - { - "id": "^c_alias_exe::@53632cba2752272bb008$", - "backtrace": None, - }, - { - "id": "^cxx_alias_exe::@53632cba2752272bb008$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@53632cba2752272bb008$", - "directorySource": "^alias$", - "projectName": "Alias", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^alias$", - "source": "^alias$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "c_alias_exe", - "id": "^c_alias_exe::@53632cba2752272bb008$", - "directorySource": "^alias$", - "projectName": "Alias", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^c_alias_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_alias_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_alias_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^alias$", - "source": "^alias$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^c_lib::@6890427a1f51a3e7e1df$", - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 6, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@53632cba2752272bb008$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_alias_exe", - "id": "^cxx_alias_exe::@53632cba2752272bb008$", - "directorySource": "^alias$", - "projectName": "Alias", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 9, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 9, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^cxx_alias_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_alias_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_alias_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^alias$", - "source": "^alias$", - "install": None, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^cxx_lib::@a56b12a3f5c0529fb296$", - "backtrace": [ - { - "file": "^alias/CMakeLists\\.txt$", - "line": 10, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^alias/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@53632cba2752272bb008$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^object$", - "source": "^object$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - { - "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^object$", - "source": "^object$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "c_object_lib", - "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "OBJECT_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 5, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 5, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": [ - { - "path": "^object/.*/empty(\\.c)?\\.o(bj)?$", - "_dllExtra": False, - }, - ], - "build": "^object$", - "source": "^object$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - ], - }, - { - "name": "c_object_exe", - "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 6, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$", - "isGenerated": True, - "sourceGroupName": "Object Libraries", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 7, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - { - "name": "Object Libraries", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 6, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^c_object_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_object_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_object_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^object$", - "source": "^object$", - "install": { - "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", - "destinations": [ - { - "path": "bin", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 13, - "command": "install", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - }, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - # FIXME: Add a backtrace here when it becomes available. - # You'll know when it's available, because this test will - # fail. - "backtrace": None, - }, - { - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_object_lib", - "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "OBJECT_LIBRARY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 9, - "command": "add_library", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": [ - { - "path": "^object/.*/empty(\\.cxx)?\\.o(bj)?$", - "_dllExtra": False, - }, - ], - "build": "^object$", - "source": "^object$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - ], - }, - { - "name": "cxx_object_exe", - "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", - "directorySource": "^object$", - "projectName": "Object", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.cxx$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$", - "isGenerated": True, - "sourceGroupName": "Object Libraries", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 11, - "command": "target_link_libraries", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.cxx$", - ], - }, - { - "name": "Object Libraries", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$", - ], - }, - ], - "compileGroups": [ - { - "language": "CXX", - "sourcePaths": [ - "^empty\\.cxx$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 10, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^cxx_object_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_object_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_object_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^object$", - "source": "^object$", - "install": { - "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", - "destinations": [ - { - "path": "bin", - "backtrace": [ - { - "file": "^object/CMakeLists\\.txt$", - "line": 13, - "command": "install", - "hasParent": True, - }, - { - "file": "^object/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - }, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - # FIXME: Add a backtrace here when it becomes available. - # You'll know when it's available, because this test will - # fail. - "backtrace": None, - }, - { - "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - { - "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "link_imported_exe", - "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^link_imported_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "link_imported_shared_exe", - "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 9, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 9, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^link_imported_shared_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_shared_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_shared_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "link_imported_static_exe", - "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 13, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 13, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^link_imported_static_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_static_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_static_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "link_imported_object_exe", - "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 18, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 18, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^link_imported_object_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_object_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_object_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "link_imported_interface_exe", - "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", - "directorySource": "^imported$", - "projectName": "Imported", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 23, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^imported/CMakeLists\\.txt$", - "line": 23, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^imported/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^link_imported_interface_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_interface_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_interface_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^imported$", - "source": "^imported$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@c11385ffed57b860da63$", - "directorySource": "^custom$", - "projectName": "Custom", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^custom$", - "source": "^custom$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@c11385ffed57b860da63$", - "backtrace": None, - }, - { - "id": "^custom_exe::@c11385ffed57b860da63$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@c11385ffed57b860da63$", - "directorySource": "^custom$", - "projectName": "Custom", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^custom$", - "source": "^custom$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "custom_tgt", - "id": "^custom_tgt::@c11385ffed57b860da63$", - "directorySource": "^custom$", - "projectName": "Custom", - "type": "UTILITY", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": 3, - "command": "add_custom_target", - "hasParent": True, - }, - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": 3, - "command": "add_custom_target", - "hasParent": True, - }, - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^custom$", - "source": "^custom$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@c11385ffed57b860da63$", - "backtrace": None, - }, - ], - }, - { - "name": "custom_exe", - "id": "^custom_exe::@c11385ffed57b860da63$", - "directorySource": "^custom$", - "projectName": "Custom", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": 4, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^empty\\.c$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^empty\\.c$", - ], - "includes": None, - "defines": None, - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": 4, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^custom_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^custom/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?custom_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^custom/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?custom_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^custom$", - "source": "^custom$", - "install": None, - "link": { - "language": "C", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^custom_tgt::@c11385ffed57b860da63$", - "backtrace": [ - { - "file": "^custom/CMakeLists\\.txt$", - "line": 5, - "command": "add_dependencies", - "hasParent": True, - }, - { - "file": "^custom/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "id": "^ZERO_CHECK::@c11385ffed57b860da63$", - "backtrace": None, - }, - ], - }, - { - "name": "ALL_BUILD", - "id": "^ALL_BUILD::@[0-9a-f]+$", - "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "projectName": "External", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", - "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "install": None, - "link": None, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@[0-9a-f]+$", - "backtrace": None, - }, - { - "id": "^generated_exe::@[0-9a-f]+$", - "backtrace": None, - }, - ], - }, - { - "name": "ZERO_CHECK", - "id": "^ZERO_CHECK::@[0-9a-f]+$", - "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "projectName": "External", - "type": "UTILITY", - "isGeneratorProvided": True, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK$", - "isGenerated": True, - "sourceGroupName": "", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK\\.rule$", - "isGenerated": True, - "sourceGroupName": "CMake Rules", - "compileGroupLanguage": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK$", - ], - }, - { - "name": "CMake Rules", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK\\.rule$", - ], - }, - ], - "compileGroups": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": None, - "artifacts": None, - "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", - "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "install": None, - "link": None, - "archive": None, - "dependencies": None, - }, - { - "name": "generated_exe", - "id": "^generated_exe::@[0-9a-f]+$", - "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "projectName": "External", - "type": "EXECUTABLE", - "isGeneratorProvided": None, - "sources": [ - { - "path": "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$", - "isGenerated": None, - "sourceGroupName": "Source Files", - "compileGroupLanguage": "C", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$", - "isGenerated": True, - "sourceGroupName": "Generated Source Files", - "compileGroupLanguage": "CXX", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 6, - "command": "target_sources", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "sourceGroups": [ - { - "name": "Source Files", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$", - ], - }, - { - "name": "Generated Source Files", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$", - ], - }, - ], - "compileGroups": [ - { - "language": "C", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$", - ], - "includes": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", - "isSystem": None, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 10, - "command": "set_property", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "path": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "isSystem": True, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 11, - "command": "target_include_directories", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "defines": [ - { - "define": "EMPTY_C=1", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 9, - "command": "set_property", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "define": "SRC_DUMMY", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 9, - "command": "set_property", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "define": "GENERATED_EXE=1", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 12, - "command": "target_compile_definitions", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "define": "TGT_DUMMY", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 12, - "command": "target_compile_definitions", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "compileCommandFragments": [ - { - "fragment" : "SRC_COMPILE_OPTIONS_DUMMY", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 13, - "command": "set_source_files_properties", - "hasParent": True, - }, - { - "file" : "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - } - ], - }, - { - "language": "CXX", - "sourcePaths": [ - "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$", - ], - "includes": [ - { - "path": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "isSystem": True, - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 11, - "command": "target_include_directories", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "defines": [ - { - "define": "GENERATED_EXE=1", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 12, - "command": "target_compile_definitions", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - { - "define": "TGT_DUMMY", - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 12, - "command": "target_compile_definitions", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - }, - ], - "compileCommandFragments": None, - }, - ], - "backtrace": [ - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": 5, - "command": "add_executable", - "hasParent": True, - }, - { - "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", - "line": None, - "command": None, - "hasParent": False, - }, - ], - "folder": None, - "nameOnDisk": "^generated_exe(\\.exe)?$", - "artifacts": [ - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?generated_exe(\\.exe)?$", - "_dllExtra": False, - }, - { - "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?generated_exe\\.pdb$", - "_dllExtra": True, - }, - ], - "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", - "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", - "install": None, - "link": { - "language": "CXX", - "lto": None, - "commandFragments": None, - }, - "archive": None, - "dependencies": [ - { - "id": "^ZERO_CHECK::@[0-9a-f]+$", - "backtrace": None, - }, - ], - }, + read_codemodel_json_data("targets/all_build_top.json"), + read_codemodel_json_data("targets/zero_check_top.json"), + read_codemodel_json_data("targets/interface_exe.json"), + read_codemodel_json_data("targets/c_lib.json"), + read_codemodel_json_data("targets/c_exe.json"), + read_codemodel_json_data("targets/c_shared_lib.json"), + read_codemodel_json_data("targets/c_shared_exe.json"), + read_codemodel_json_data("targets/c_static_lib.json"), + read_codemodel_json_data("targets/c_static_exe.json"), + + read_codemodel_json_data("targets/all_build_cxx.json"), + read_codemodel_json_data("targets/zero_check_cxx.json"), + read_codemodel_json_data("targets/cxx_lib.json"), + read_codemodel_json_data("targets/cxx_exe.json"), + read_codemodel_json_data("targets/cxx_shared_lib.json"), + read_codemodel_json_data("targets/cxx_shared_exe.json"), + read_codemodel_json_data("targets/cxx_static_lib.json"), + read_codemodel_json_data("targets/cxx_static_exe.json"), + + read_codemodel_json_data("targets/all_build_alias.json"), + read_codemodel_json_data("targets/zero_check_alias.json"), + read_codemodel_json_data("targets/c_alias_exe.json"), + read_codemodel_json_data("targets/cxx_alias_exe.json"), + + read_codemodel_json_data("targets/all_build_object.json"), + read_codemodel_json_data("targets/zero_check_object.json"), + read_codemodel_json_data("targets/c_object_lib.json"), + read_codemodel_json_data("targets/c_object_exe.json"), + read_codemodel_json_data("targets/cxx_object_lib.json"), + read_codemodel_json_data("targets/cxx_object_exe.json"), + + read_codemodel_json_data("targets/all_build_imported.json"), + read_codemodel_json_data("targets/zero_check_imported.json"), + read_codemodel_json_data("targets/link_imported_exe.json"), + read_codemodel_json_data("targets/link_imported_shared_exe.json"), + read_codemodel_json_data("targets/link_imported_static_exe.json"), + read_codemodel_json_data("targets/link_imported_object_exe.json"), + read_codemodel_json_data("targets/link_imported_interface_exe.json"), + + read_codemodel_json_data("targets/all_build_custom.json"), + read_codemodel_json_data("targets/zero_check_custom.json"), + read_codemodel_json_data("targets/custom_tgt.json"), + read_codemodel_json_data("targets/custom_exe.json"), + read_codemodel_json_data("targets/all_build_external.json"), + read_codemodel_json_data("targets/zero_check_external.json"), + read_codemodel_json_data("targets/generated_exe.json"), ] if not os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "ipo_enabled.txt")): @@ -5164,126 +655,13 @@ def check_targets(c, g, inSource): def gen_check_projects(c, g): expected = [ - { - "name": "codemodel-v2", - "parentName": None, - "childNames": [ - "Alias", - "Custom", - "Cxx", - "Imported", - "Object", - "External", - ], - "directorySources": [ - "^\\.$", - "^dir$", - "^dir/dir$", - ], - "targetIds": [ - "^ALL_BUILD::@6890427a1f51a3e7e1df$", - "^ZERO_CHECK::@6890427a1f51a3e7e1df$", - "^interface_exe::@6890427a1f51a3e7e1df$", - "^c_lib::@6890427a1f51a3e7e1df$", - "^c_exe::@6890427a1f51a3e7e1df$", - "^c_shared_lib::@6890427a1f51a3e7e1df$", - "^c_shared_exe::@6890427a1f51a3e7e1df$", - "^c_static_lib::@6890427a1f51a3e7e1df$", - "^c_static_exe::@6890427a1f51a3e7e1df$", - ], - }, - { - "name": "Cxx", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^cxx$", - ], - "targetIds": [ - "^ALL_BUILD::@a56b12a3f5c0529fb296$", - "^ZERO_CHECK::@a56b12a3f5c0529fb296$", - "^cxx_lib::@a56b12a3f5c0529fb296$", - "^cxx_exe::@a56b12a3f5c0529fb296$", - "^cxx_shared_lib::@a56b12a3f5c0529fb296$", - "^cxx_shared_exe::@a56b12a3f5c0529fb296$", - "^cxx_static_lib::@a56b12a3f5c0529fb296$", - "^cxx_static_exe::@a56b12a3f5c0529fb296$", - ], - }, - { - "name": "Alias", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^alias$", - ], - "targetIds": [ - "^ALL_BUILD::@53632cba2752272bb008$", - "^ZERO_CHECK::@53632cba2752272bb008$", - "^c_alias_exe::@53632cba2752272bb008$", - "^cxx_alias_exe::@53632cba2752272bb008$", - ], - }, - { - "name": "Object", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^object$", - ], - "targetIds": [ - "^ALL_BUILD::@5ed5358f70faf8d8af7a$", - "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", - "^c_object_lib::@5ed5358f70faf8d8af7a$", - "^c_object_exe::@5ed5358f70faf8d8af7a$", - "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "^cxx_object_exe::@5ed5358f70faf8d8af7a$", - ], - }, - { - "name": "Imported", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^imported$", - ], - "targetIds": [ - "^ALL_BUILD::@ba7eb709d0b48779c6c8$", - "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", - "^link_imported_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", - "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", - ], - }, - { - "name": "Custom", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^custom$", - ], - "targetIds": [ - "^ALL_BUILD::@c11385ffed57b860da63$", - "^ZERO_CHECK::@c11385ffed57b860da63$", - "^custom_tgt::@c11385ffed57b860da63$", - "^custom_exe::@c11385ffed57b860da63$", - ], - }, - { - "name": "External", - "parentName": "codemodel-v2", - "childNames": None, - "directorySources": [ - "^.*/Tests/RunCMake/FileAPIExternalSource$", - ], - "targetIds": [ - "^ALL_BUILD::@[0-9a-f]+$", - "^ZERO_CHECK::@[0-9a-f]+$", - "^generated_exe::@[0-9a-f]+$", - ], - }, + read_codemodel_json_data("projects/codemodel-v2.json"), + read_codemodel_json_data("projects/cxx.json"), + read_codemodel_json_data("projects/alias.json"), + read_codemodel_json_data("projects/object.json"), + read_codemodel_json_data("projects/imported.json"), + read_codemodel_json_data("projects/custom.json"), + read_codemodel_json_data("projects/external.json"), ] if matches(g["name"], "^Visual Studio "): diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json new file mode 100644 index 0000000..9f0c48a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json @@ -0,0 +1,15 @@ +{ + "source": "^alias$", + "build": "^alias$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@53632cba2752272bb008$", + "^ZERO_CHECK::@53632cba2752272bb008$", + "^c_alias_exe::@53632cba2752272bb008$", + "^cxx_alias_exe::@53632cba2752272bb008$" + ], + "projectName": "Alias", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json new file mode 100644 index 0000000..afd41f3 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json @@ -0,0 +1,15 @@ +{ + "source": "^custom$", + "build": "^custom$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@c11385ffed57b860da63$", + "^ZERO_CHECK::@c11385ffed57b860da63$", + "^custom_exe::@c11385ffed57b860da63$", + "^custom_tgt::@c11385ffed57b860da63$" + ], + "projectName": "Custom", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json new file mode 100644 index 0000000..ebe717a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -0,0 +1,19 @@ +{ + "source": "^cxx$", + "build": "^cxx$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@a56b12a3f5c0529fb296$", + "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_lib::@a56b12a3f5c0529fb296$", + "^cxx_shared_exe::@a56b12a3f5c0529fb296$", + "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "^cxx_static_exe::@a56b12a3f5c0529fb296$", + "^cxx_static_lib::@a56b12a3f5c0529fb296$" + ], + "projectName": "Cxx", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json new file mode 100644 index 0000000..afbd43a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json @@ -0,0 +1,12 @@ +{ + "source": "^dir$", + "build": "^dir$", + "parentSource": "^\\.$", + "childSources": [ + "^dir/dir$" + ], + "targetIds": null, + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json new file mode 100644 index 0000000..3737ad5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json @@ -0,0 +1,10 @@ +{ + "source": "^dir/dir$", + "build": "^dir/dir$", + "parentSource": "^dir$", + "childSources": null, + "targetIds": null, + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json new file mode 100644 index 0000000..521e3c7 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json @@ -0,0 +1,14 @@ +{ + "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@[0-9a-f]+$", + "^ZERO_CHECK::@[0-9a-f]+$", + "^generated_exe::@[0-9a-f]+$" + ], + "projectName": "External", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json new file mode 100644 index 0000000..a41b79b --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -0,0 +1,18 @@ +{ + "source": "^imported$", + "build": "^imported$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@ba7eb709d0b48779c6c8$", + "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "^link_imported_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_static_exe::@ba7eb709d0b48779c6c8$" + ], + "projectName": "Imported", + "minimumCMakeVersion": "3.12", + "hasInstallRule": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json new file mode 100644 index 0000000..1e647ad --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json @@ -0,0 +1,17 @@ +{ + "source": "^object$", + "build": "^object$", + "parentSource": "^\\.$", + "childSources": null, + "targetIds": [ + "^ALL_BUILD::@5ed5358f70faf8d8af7a$", + "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "^c_object_exe::@5ed5358f70faf8d8af7a$", + "^c_object_lib::@5ed5358f70faf8d8af7a$", + "^cxx_object_exe::@5ed5358f70faf8d8af7a$", + "^cxx_object_lib::@5ed5358f70faf8d8af7a$" + ], + "projectName": "Object", + "minimumCMakeVersion": "3.13", + "hasInstallRule": true +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json new file mode 100644 index 0000000..c144953 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -0,0 +1,28 @@ +{ + "source": "^\\.$", + "build": "^\\.$", + "parentSource": null, + "childSources": [ + "^alias$", + "^custom$", + "^cxx$", + "^imported$", + "^object$", + "^.*/Tests/RunCMake/FileAPIExternalSource$", + "^dir$" + ], + "targetIds": [ + "^ALL_BUILD::@6890427a1f51a3e7e1df$", + "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "^c_exe::@6890427a1f51a3e7e1df$", + "^c_lib::@6890427a1f51a3e7e1df$", + "^c_shared_exe::@6890427a1f51a3e7e1df$", + "^c_shared_lib::@6890427a1f51a3e7e1df$", + "^c_static_exe::@6890427a1f51a3e7e1df$", + "^c_static_lib::@6890427a1f51a3e7e1df$", + "^interface_exe::@6890427a1f51a3e7e1df$" + ], + "projectName": "codemodel-v2", + "minimumCMakeVersion": "3.12", + "hasInstallRule": true +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/alias.json new file mode 100644 index 0000000..8ede60f --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/alias.json @@ -0,0 +1,14 @@ +{ + "name": "Alias", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^alias$" + ], + "targetIds": [ + "^ALL_BUILD::@53632cba2752272bb008$", + "^ZERO_CHECK::@53632cba2752272bb008$", + "^c_alias_exe::@53632cba2752272bb008$", + "^cxx_alias_exe::@53632cba2752272bb008$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json new file mode 100644 index 0000000..f3aac63 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json @@ -0,0 +1,28 @@ +{ + "name": "codemodel-v2", + "parentName": null, + "childNames": [ + "Alias", + "Custom", + "Cxx", + "Imported", + "Object", + "External" + ], + "directorySources": [ + "^\\.$", + "^dir$", + "^dir/dir$" + ], + "targetIds": [ + "^ALL_BUILD::@6890427a1f51a3e7e1df$", + "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "^interface_exe::@6890427a1f51a3e7e1df$", + "^c_lib::@6890427a1f51a3e7e1df$", + "^c_exe::@6890427a1f51a3e7e1df$", + "^c_shared_lib::@6890427a1f51a3e7e1df$", + "^c_shared_exe::@6890427a1f51a3e7e1df$", + "^c_static_lib::@6890427a1f51a3e7e1df$", + "^c_static_exe::@6890427a1f51a3e7e1df$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/custom.json new file mode 100644 index 0000000..0aeb727 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/custom.json @@ -0,0 +1,14 @@ +{ + "name": "Custom", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^custom$" + ], + "targetIds": [ + "^ALL_BUILD::@c11385ffed57b860da63$", + "^ZERO_CHECK::@c11385ffed57b860da63$", + "^custom_tgt::@c11385ffed57b860da63$", + "^custom_exe::@c11385ffed57b860da63$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json new file mode 100644 index 0000000..296ae6c --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/cxx.json @@ -0,0 +1,18 @@ +{ + "name": "Cxx", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^cxx$" + ], + "targetIds": [ + "^ALL_BUILD::@a56b12a3f5c0529fb296$", + "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "^cxx_lib::@a56b12a3f5c0529fb296$", + "^cxx_exe::@a56b12a3f5c0529fb296$", + "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "^cxx_shared_exe::@a56b12a3f5c0529fb296$", + "^cxx_static_lib::@a56b12a3f5c0529fb296$", + "^cxx_static_exe::@a56b12a3f5c0529fb296$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/external.json new file mode 100644 index 0000000..3c9afff --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/external.json @@ -0,0 +1,13 @@ +{ + "name": "External", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^.*/Tests/RunCMake/FileAPIExternalSource$" + ], + "targetIds": [ + "^ALL_BUILD::@[0-9a-f]+$", + "^ZERO_CHECK::@[0-9a-f]+$", + "^generated_exe::@[0-9a-f]+$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json new file mode 100644 index 0000000..dc40b72 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/imported.json @@ -0,0 +1,17 @@ +{ + "name": "Imported", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^imported$" + ], + "targetIds": [ + "^ALL_BUILD::@ba7eb709d0b48779c6c8$", + "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "^link_imported_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", + "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/object.json new file mode 100644 index 0000000..219f4eb --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/object.json @@ -0,0 +1,16 @@ +{ + "name": "Object", + "parentName": "codemodel-v2", + "childNames": null, + "directorySources": [ + "^object$" + ], + "targetIds": [ + "^ALL_BUILD::@5ed5358f70faf8d8af7a$", + "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "^c_object_lib::@5ed5358f70faf8d8af7a$", + "^c_object_exe::@5ed5358f70faf8d8af7a$", + "^cxx_object_lib::@5ed5358f70faf8d8af7a$", + "^cxx_object_exe::@5ed5358f70faf8d8af7a$" + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json new file mode 100644 index 0000000..eabf739 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_alias.json @@ -0,0 +1,83 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@53632cba2752272bb008$", + "directorySource": "^alias$", + "projectName": "Alias", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^alias$", + "source": "^alias$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@53632cba2752272bb008$", + "backtrace": null + }, + { + "id": "^c_alias_exe::@53632cba2752272bb008$", + "backtrace": null + }, + { + "id": "^cxx_alias_exe::@53632cba2752272bb008$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json new file mode 100644 index 0000000..a5ff686 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_custom.json @@ -0,0 +1,79 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@c11385ffed57b860da63$", + "directorySource": "^custom$", + "projectName": "Custom", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^custom$", + "source": "^custom$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@c11385ffed57b860da63$", + "backtrace": null + }, + { + "id": "^custom_exe::@c11385ffed57b860da63$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json new file mode 100644 index 0000000..92a7944 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_cxx.json @@ -0,0 +1,99 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json new file mode 100644 index 0000000..017335c --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_external.json @@ -0,0 +1,79 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@[0-9a-f]+$", + "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "projectName": "External", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", + "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@[0-9a-f]+$", + "backtrace": null + }, + { + "id": "^generated_exe::@[0-9a-f]+$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json new file mode 100644 index 0000000..2de5b15 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_imported.json @@ -0,0 +1,95 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json new file mode 100644 index 0000000..9d8899a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_object.json @@ -0,0 +1,91 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^object$", + "source": "^object$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json new file mode 100644 index 0000000..b4def78 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json @@ -0,0 +1,179 @@ +{ + "name": "ALL_BUILD", + "id": "^ALL_BUILD::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ALL_BUILD\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^interface_exe::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_exe::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_shared_exe::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_static_lib::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_static_exe::@6890427a1f51a3e7e1df$", + "backtrace": null + }, + { + "id": "^c_alias_exe::@53632cba2752272bb008$", + "backtrace": null + }, + { + "id": "^cxx_alias_exe::@53632cba2752272bb008$", + "backtrace": null + }, + { + "id": "^cxx_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", + "backtrace": null + }, + { + "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", + "backtrace": null + }, + { + "id": "^custom_exe::@c11385ffed57b860da63$", + "backtrace": null + }, + { + "id": "^generated_exe::@[0-9a-f]+$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json new file mode 100644 index 0000000..ac7c94d --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json @@ -0,0 +1,107 @@ +{ + "name": "c_alias_exe", + "id": "^c_alias_exe::@53632cba2752272bb008$", + "directorySource": "^alias$", + "projectName": "Alias", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^c_alias_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_alias_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_alias_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^alias$", + "source": "^alias$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 6, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@53632cba2752272bb008$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json new file mode 100644 index 0000000..7af74c4 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json @@ -0,0 +1,143 @@ +{ + "name": "c_exe", + "id": "^c_exe::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 6, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 6, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^c_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 7, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json new file mode 100644 index 0000000..0ca1962 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json @@ -0,0 +1,108 @@ +{ + "name": "c_lib", + "id": "^c_lib::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 5, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 5, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_lib\\.(a|lib)$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_lib\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json new file mode 100644 index 0000000..91951c3 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json @@ -0,0 +1,141 @@ +{ + "name": "c_object_exe", + "id": "^c_object_exe::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 6, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$", + "isGenerated": true, + "sourceGroupName": "Object Libraries", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 7, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + }, + { + "name": "Object Libraries", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 6, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^c_object_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_object_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_object_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^object$", + "source": "^object$", + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "bin", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 13, + "command": "install", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json new file mode 100644 index 0000000..e3a20df --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json @@ -0,0 +1,82 @@ +{ + "name": "c_object_lib", + "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "OBJECT_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 5, + "command": "add_library", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 5, + "command": "add_library", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": [ + { + "path": "^object/.*/empty(\\.c)?\\.o(bj)?$", + "_dllExtra": false + } + ], + "build": "^object$", + "source": "^object$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json new file mode 100644 index 0000000..0d4018a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json @@ -0,0 +1,143 @@ +{ + "name": "c_shared_exe", + "id": "^c_shared_exe::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^c_shared_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_shared_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_shared_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": { + "language": "C", + "lto": true, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 11, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json new file mode 100644 index 0000000..176a857 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -0,0 +1,123 @@ +{ + "name": "c_shared_lib", + "id": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "SHARED_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": [ + { + "define": "c_shared_lib_EXPORTS", + "backtrace": null + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", + "artifacts": [ + { + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", + "_dllExtra": false + }, + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_shared_lib\\.(dll\\.a|lib)$", + "_dllExtra": true + }, + { + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.pdb$", + "_dllExtra": true + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": { + "language": "C", + "lto": true, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json new file mode 100644 index 0000000..5542277 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json @@ -0,0 +1,143 @@ +{ + "name": "c_static_exe", + "id": "^c_static_exe::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 14, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 14, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^c_static_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_static_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?c_static_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^c_static_lib::@6890427a1f51a3e7e1df$", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 15, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json new file mode 100644 index 0000000..4b63897 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json @@ -0,0 +1,108 @@ +{ + "name": "c_static_lib", + "id": "^c_static_lib::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 13, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 13, + "command": "add_library", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?c_static_lib\\.(a|lib)$", + "artifacts": [ + { + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_static_lib\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": { + "lto": true + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json new file mode 100644 index 0000000..ab301e9 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json @@ -0,0 +1,107 @@ +{ + "name": "custom_exe", + "id": "^custom_exe::@c11385ffed57b860da63$", + "directorySource": "^custom$", + "projectName": "Custom", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": 4, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": 4, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^custom_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^custom/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?custom_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^custom/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?custom_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^custom$", + "source": "^custom$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^custom_tgt::@c11385ffed57b860da63$", + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": 5, + "command": "add_dependencies", + "hasParent": true + }, + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@c11385ffed57b860da63$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json new file mode 100644 index 0000000..a7106fc --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_tgt.json @@ -0,0 +1,87 @@ +{ + "name": "custom_tgt", + "id": "^custom_tgt::@c11385ffed57b860da63$", + "directorySource": "^custom$", + "projectName": "Custom", + "type": "UTILITY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": 3, + "command": "add_custom_target", + "hasParent": true + }, + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/custom_tgt$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(custom/)?CMakeFiles/([0-9a-f]+/)?custom_tgt\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": 3, + "command": "add_custom_target", + "hasParent": true + }, + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^custom$", + "source": "^custom$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@c11385ffed57b860da63$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json new file mode 100644 index 0000000..837f252 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json @@ -0,0 +1,107 @@ +{ + "name": "cxx_alias_exe", + "id": "^cxx_alias_exe::@53632cba2752272bb008$", + "directorySource": "^alias$", + "projectName": "Alias", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 9, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 9, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_alias_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_alias_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^alias/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_alias_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^alias$", + "source": "^alias$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^cxx_lib::@a56b12a3f5c0529fb296$", + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": 10, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@53632cba2752272bb008$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json new file mode 100644 index 0000000..7631837 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -0,0 +1,213 @@ +{ + "name": "cxx_exe", + "id": "^cxx_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": [ + { + "fragment" : "TargetCompileOptions", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 17, + "command": "target_compile_options", + "hasParent": true + }, + { + "file" : "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": "bin", + "nameOnDisk": "^cxx_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "bin", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 37, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": [ + { + "fragment" : "TargetLinkOptions", + "role" : "flags", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 18, + "command": "target_link_options", + "hasParent": true + }, + { + "file" : "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "fragment" : ".*TargetLinkDir\\\"?$", + "role" : "libraryPath", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 19, + "command": "target_link_directories", + "hasParent": true + }, + { + "file" : "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "fragment" : ".*cxx_lib.*", + "role" : "libraries", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 6, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file" : "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "archive": null, + "dependencies": [ + { + "id": "^cxx_lib::@a56b12a3f5c0529fb296$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 6, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json new file mode 100644 index 0000000..94ac081 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json @@ -0,0 +1,84 @@ +{ + "name": "cxx_lib", + "id": "^cxx_lib::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 4, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 4, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?cxx_lib\\.(a|lib)$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_lib\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json new file mode 100644 index 0000000..a33370a --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json @@ -0,0 +1,141 @@ +{ + "name": "cxx_object_exe", + "id": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$", + "isGenerated": true, + "sourceGroupName": "Object Libraries", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 11, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + }, + { + "name": "Object Libraries", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_object_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_object_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^object/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_object_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^object$", + "source": "^object$", + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "bin", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 13, + "command": "install", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", + "backtrace": null + }, + { + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json new file mode 100644 index 0000000..8e99f7d --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json @@ -0,0 +1,82 @@ +{ + "name": "cxx_object_lib", + "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "OBJECT_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": [ + { + "path": "^object/.*/empty(\\.cxx)?\\.o(bj)?$", + "_dllExtra": false + } + ], + "build": "^object$", + "source": "^object$", + "install": null, + "link": null, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json new file mode 100644 index 0000000..4421c8f --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json @@ -0,0 +1,107 @@ +{ + "name": "cxx_shared_exe", + "id": "^cxx_shared_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 10, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_shared_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_shared_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_shared_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 11, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json new file mode 100644 index 0000000..171a4f5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -0,0 +1,99 @@ +{ + "name": "cxx_shared_lib", + "id": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "SHARED_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": [ + { + "define": "cxx_shared_lib_EXPORTS", + "backtrace": null + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 9, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_shared_lib\\.(dll\\.a|lib)$", + "_dllExtra": true + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json new file mode 100644 index 0000000..52c42de --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json @@ -0,0 +1,107 @@ +{ + "name": "cxx_static_exe", + "id": "^cxx_static_exe::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 14, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 14, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^cxx_static_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_static_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?cxx_static_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 15, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json new file mode 100644 index 0000000..98298be --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json @@ -0,0 +1,84 @@ +{ + "name": "cxx_static_lib", + "id": "^cxx_static_lib::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "STATIC_LIBRARY", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.cxx$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 13, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "CXX", + "sourcePaths": [ + "^empty\\.cxx$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 13, + "command": "add_library", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^(lib)?cxx_static_lib\\.(a|lib)$", + "artifacts": [ + { + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_static_lib\\.(a|lib)$", + "_dllExtra": false + } + ], + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": null, + "archive": { + "lto": null + }, + "dependencies": [ + { + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json new file mode 100644 index 0000000..d41bbb2 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json @@ -0,0 +1,303 @@ +{ + "name": "generated_exe", + "id": "^generated_exe::@[0-9a-f]+$", + "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "projectName": "External", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$", + "isGenerated": true, + "sourceGroupName": "Generated Source Files", + "compileGroupLanguage": "CXX", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 6, + "command": "target_sources", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$" + ] + }, + { + "name": "Generated Source Files", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPIExternalSource/empty\\.c$" + ], + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", + "isSystem": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 10, + "command": "set_property", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "isSystem": true, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 11, + "command": "target_include_directories", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "defines": [ + { + "define": "EMPTY_C=1", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 9, + "command": "set_property", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "define": "SRC_DUMMY", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 9, + "command": "set_property", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "define": "GENERATED_EXE=1", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 12, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "define": "TGT_DUMMY", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 12, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "compileCommandFragments": [ + { + "fragment" : "SRC_COMPILE_OPTIONS_DUMMY", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 13, + "command": "set_source_files_properties", + "hasParent": true + }, + { + "file" : "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, + { + "language": "CXX", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/generated\\.cxx$" + ], + "includes": [ + { + "path": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "isSystem": true, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 11, + "command": "target_include_directories", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "defines": [ + { + "define": "GENERATED_EXE=1", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 12, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "define": "TGT_DUMMY", + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 12, + "command": "target_compile_definitions", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^generated_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?generated_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?generated_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", + "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "install": null, + "link": { + "language": "CXX", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@[0-9a-f]+$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json new file mode 100644 index 0000000..fe0524c --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -0,0 +1,152 @@ +{ + "name": "interface_exe", + "id": "^interface_exe::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^include_test\\.cmake$", + "line": 3, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^include_test\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": [ + { + "define": "interface_exe_EXPORTS", + "backtrace": null + } + ], + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^include_test\\.cmake$", + "line": 3, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^include_test\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^my_interface_exe\\.myexe$", + "artifacts": [ + { + "path": "^bin/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?my_interface_exe\\.myexe$", + "_dllExtra": false + }, + { + "path": "^lib/my_interface_exe\\.imp$", + "_aixExtra": true, + "_dllExtra": false + }, + { + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?my_interface_exe\\.(dll\\.a|lib)$", + "_dllExtra": true + }, + { + "path": "^bin/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?my_interface_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json new file mode 100644 index 0000000..312f4c5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json @@ -0,0 +1,90 @@ +{ + "name": "link_imported_exe", + "id": "^link_imported_exe::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 5, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^link_imported_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json new file mode 100644 index 0000000..7d0e6df --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -0,0 +1,90 @@ +{ + "name": "link_imported_interface_exe", + "id": "^link_imported_interface_exe::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 23, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^link_imported_interface_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_interface_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_interface_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json new file mode 100644 index 0000000..4aec524 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json @@ -0,0 +1,90 @@ +{ + "name": "link_imported_object_exe", + "id": "^link_imported_object_exe::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 18, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 18, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^link_imported_object_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_object_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_object_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json new file mode 100644 index 0000000..f5846ec --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json @@ -0,0 +1,90 @@ +{ + "name": "link_imported_shared_exe", + "id": "^link_imported_shared_exe::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 9, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 9, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^link_imported_shared_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_shared_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_shared_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json new file mode 100644 index 0000000..29a1695 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json @@ -0,0 +1,90 @@ +{ + "name": "link_imported_static_exe", + "id": "^link_imported_static_exe::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "EXECUTABLE", + "isGeneratorProvided": null, + "sources": [ + { + "path": "^empty\\.c$", + "isGenerated": null, + "sourceGroupName": "Source Files", + "compileGroupLanguage": "C", + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 13, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "Source Files", + "sourcePaths": [ + "^empty\\.c$" + ] + } + ], + "compileGroups": [ + { + "language": "C", + "sourcePaths": [ + "^empty\\.c$" + ], + "includes": null, + "defines": null, + "compileCommandFragments": null + } + ], + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": 13, + "command": "add_executable", + "hasParent": true + }, + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": "^link_imported_static_exe(\\.exe)?$", + "artifacts": [ + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_static_exe(\\.exe)?$", + "_dllExtra": false + }, + { + "path": "^imported/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?link_imported_static_exe\\.pdb$", + "_dllExtra": true + } + ], + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": { + "language": "C", + "lto": null, + "commandFragments": null + }, + "archive": null, + "dependencies": [ + { + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "backtrace": null + } + ] +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json new file mode 100644 index 0000000..941c172 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_alias.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@53632cba2752272bb008$", + "directorySource": "^alias$", + "projectName": "Alias", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/alias/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^alias/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^alias$", + "source": "^alias$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json new file mode 100644 index 0000000..98c6dd9 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_custom.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@c11385ffed57b860da63$", + "directorySource": "^custom$", + "projectName": "Custom", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/custom/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^custom/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^custom$", + "source": "^custom$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json new file mode 100644 index 0000000..b72ff82 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_cxx.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@a56b12a3f5c0529fb296$", + "directorySource": "^cxx$", + "projectName": "Cxx", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/cxx/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^cxx$", + "source": "^cxx$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json new file mode 100644 index 0000000..9e73806 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_external.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@[0-9a-f]+$", + "directorySource": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "projectName": "External", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^.*/Tests/RunCMake/FileAPI/FileAPIExternalBuild$", + "source": "^.*/Tests/RunCMake/FileAPIExternalSource$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json new file mode 100644 index 0000000..7534c84 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_imported.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@ba7eb709d0b48779c6c8$", + "directorySource": "^imported$", + "projectName": "Imported", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/imported/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^imported/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^imported$", + "source": "^imported$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json new file mode 100644 index 0000000..bcd7616 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_object.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", + "directorySource": "^object$", + "projectName": "Object", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^object$", + "source": "^object$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json new file mode 100644 index 0000000..b3030bd --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_top.json @@ -0,0 +1,70 @@ +{ + "name": "ZERO_CHECK", + "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$", + "directorySource": "^\\.$", + "projectName": "codemodel-v2", + "type": "UTILITY", + "isGeneratorProvided": true, + "sources": [ + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK$", + "isGenerated": true, + "sourceGroupName": "", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK\\.rule$", + "isGenerated": true, + "sourceGroupName": "CMake Rules", + "compileGroupLanguage": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], + "sourceGroups": [ + { + "name": "", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK$" + ] + }, + { + "name": "CMake Rules", + "sourcePaths": [ + "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/ZERO_CHECK\\.rule$" + ] + } + ], + "compileGroups": null, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ], + "folder": null, + "nameOnDisk": null, + "artifacts": null, + "build": "^\\.$", + "source": "^\\.$", + "install": null, + "link": null, + "archive": null, + "dependencies": null +} diff --git a/Tests/RunCMake/GNUInstallDirs/NoSystem-stderr.txt b/Tests/RunCMake/GNUInstallDirs/NoSystem-stderr.txt new file mode 100644 index 0000000..36f064c --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/NoSystem-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at .*/Modules/GNUInstallDirs.cmake:[0-9]+ \(message\): + Unable to determine default CMAKE_INSTALL_LIBDIR directory because no + target architecture is known. Please enable at least one language before + including GNUInstallDirs. +Call Stack \(most recent call first\): + NoSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/GNUInstallDirs/NoSystem.cmake b/Tests/RunCMake/GNUInstallDirs/NoSystem.cmake new file mode 100644 index 0000000..19cf7be --- /dev/null +++ b/Tests/RunCMake/GNUInstallDirs/NoSystem.cmake @@ -0,0 +1,2 @@ +unset(CMAKE_SYSTEM_NAME) +include(GNUInstallDirs) diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake index d671ee0..eb2c1a2 100644 --- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake @@ -16,4 +16,7 @@ foreach(case ) set(RunCMake-stderr-file ${case}${variant}-stderr.txt) run_cmake(${case}) + unset(RunCMake-stderr-file) endforeach() + +run_cmake(NoSystem) diff --git a/Tests/RunCMake/MacOSVersions/CMakeLists.txt b/Tests/RunCMake/MacOSVersions/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/MacOSVersions/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MacOSVersions/MacOSVersions-build-check.cmake b/Tests/RunCMake/MacOSVersions/MacOSVersions-build-check.cmake new file mode 100644 index 0000000..c4faa8b --- /dev/null +++ b/Tests/RunCMake/MacOSVersions/MacOSVersions-build-check.cmake @@ -0,0 +1,27 @@ +set(cfg_dir) +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(cfg_dir /Debug) +endif() + +set(lib "${RunCMake_TEST_BINARY_DIR}${cfg_dir}/libfoo.1.0.dylib") +if(NOT EXISTS "${lib}") + set(RunCMake_TEST_FAILED "Library file is missing:\n ${lib}") + return() +endif() + +execute_process(COMMAND otool -l "${lib}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res) +if(NOT res EQUAL 0) + string(REPLACE "\n" "\n " err " ${err}") + set(RunCMake_TEST_FAILED "Running 'otool -l' on file:\n ${lib}\nfailed:\n${err}") + return() +endif() + +foreach(ver + [[current version 3\.2\.1]] + [[compatibility version 2\.1\.0]] + ) + if(NOT "${out}" MATCHES "( |\n)${ver}( |\n)") + set(RunCMake_TEST_FAILED "Library file:\n ${lib}\ndoes not contain '${ver}'") + return() + endif() +endforeach() diff --git a/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake b/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake new file mode 100644 index 0000000..629e445 --- /dev/null +++ b/Tests/RunCMake/MacOSVersions/MacOSVersions.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +set_target_properties(foo PROPERTIES + VERSION 1.0 + SOVERSION 1 + OSX_COMPATIBILITY_VERSION 2.1.0 + OSX_CURRENT_VERSION 3.2.1 + ) diff --git a/Tests/RunCMake/MacOSVersions/RunCMakeTest.cmake b/Tests/RunCMake/MacOSVersions/RunCMakeTest.cmake new file mode 100644 index 0000000..eb7ca48 --- /dev/null +++ b/Tests/RunCMake/MacOSVersions/RunCMakeTest.cmake @@ -0,0 +1,11 @@ +include(RunCMake) + +function(run_MacOSVersions) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MacOSVersions-build) + run_cmake(MacOSVersions) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(MacOSVersions-build ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_MacOSVersions() diff --git a/Tests/RunCMake/MacOSVersions/foo.c b/Tests/RunCMake/MacOSVersions/foo.c new file mode 100644 index 0000000..c83d856 --- /dev/null +++ b/Tests/RunCMake/MacOSVersions/foo.c @@ -0,0 +1,4 @@ +int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake b/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake index 1e36e65..a96802a 100644 --- a/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake +++ b/Tests/RunCMake/Ninja/CustomCommandJobPool.cmake @@ -1,3 +1,4 @@ +set_property(GLOBAL PROPERTY JOB_POOLS custom_command_pool=2 custom_target_pool=2) add_custom_command( OUTPUT hello.copy.c COMMAND "${CMAKE_COMMAND}" -E copy diff --git a/Tests/RunCMake/NinjaMultiConfig/Common.cmake b/Tests/RunCMake/NinjaMultiConfig/Common.cmake index e13bd53..6c0d82a 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Common.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Common.cmake @@ -36,6 +36,11 @@ function(generate_output_files) if(type MATCHES "^(EXECUTABLE)$") set(exe_file " [==[$<TARGET_FILE_DIR:${tgt}>/$<TARGET_FILE_PREFIX:${tgt}>$<TARGET_FILE_BASE_NAME:${tgt}>$<TARGET_FILE_SUFFIX:${tgt}>]==]") set(exe_filename " [==[$<TARGET_FILE_PREFIX:${tgt}>$<TARGET_FILE_BASE_NAME:${tgt}>$<TARGET_FILE_SUFFIX:${tgt}>]==]") + + if(WIN32) + set(exe_lib_file " [==[$<TARGET_FILE_DIR:${tgt}>/$<TARGET_FILE_PREFIX:${tgt}>$<TARGET_FILE_BASE_NAME:${tgt}>.lib]==]") + string(APPEND content "set(TARGET_EXE_LIB_FILE_${tgt}_$<CONFIG>${exe_lib_file})\n") + endif() else() set(exe_file) set(exe_filename) diff --git a/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake index b0fca18..39db5ff 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CudaSimple-debug-target-build-check.cmake @@ -3,6 +3,7 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${GENERATED_FILES} ${TARGET_FILE_simplecudaexe_Debug} + ${TARGET_EXE_LIB_FILE_simplecudaexe_Debug} ${TARGET_OBJECT_FILES_simplecudaexe_Debug} ${TARGET_FILE_simplecudashared_Debug} diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake new file mode 100644 index 0000000..c595b10 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake @@ -0,0 +1,5 @@ +set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfile-build/CMakeFiles/impl-Debug.ninja") +file(READ "${log}" build_file) +if(NOT "${build_file}" MATCHES "depfile = test\\.d") + set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d") +endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake new file mode 100644 index 0000000..1a42670 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake @@ -0,0 +1,9 @@ +add_custom_command( + OUTPUT main.copy.c + COMMAND "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/main.c" + main.copy.c + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPFILE "test.d" + ) +add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c") diff --git a/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake new file mode 100644 index 0000000..bb7b160 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/DefaultBuildFileConfig.cmake @@ -0,0 +1 @@ +# Intentionally empty diff --git a/Tests/RunCMake/NinjaMultiConfig/Framework.cmake b/Tests/RunCMake/NinjaMultiConfig/Framework.cmake new file mode 100644 index 0000000..b4c35f6 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Framework.cmake @@ -0,0 +1,22 @@ +enable_language(C) + +set(header "${CMAKE_CURRENT_BINARY_DIR}/header.h") +file(GENERATE + OUTPUT "${header}" + CONTENT "/* foo */" + CONDITION "$<CONFIG:Release>" + ) +add_library(framework SHARED "${header}" empty.c) + +set_property(TARGET framework PROPERTY FRAMEWORK ON) +set_property(TARGET framework APPEND PROPERTY PUBLIC_HEADER ${header}) + +set_target_properties(framework PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "lib" + LIBRARY_OUTPUT_DIRECTORY_DEBUG "lib" + LIBRARY_OUTPUT_DIRECTORY_RELEASE "lib" + DEBUG_POSTFIX "_debug" + ) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(framework) diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-result.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-stderr.txt new file mode 100644 index 0000000..6e165e8 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error: + CMAKE_NMC_CROSS_CONFIGS is not a subset of CMAKE_CONFIGURATION_TYPES + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs.cmake b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidCrossConfigs.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-result.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-stderr.txt new file mode 100644 index 0000000..114a8a3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error: + The configuration specified by CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG + \(RelWithDebInfo\) is not present in CMAKE_CONFIGURATION_TYPES + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig.cmake b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultBuildFileConfig.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-result.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-stderr.txt new file mode 100644 index 0000000..8d52189 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error: + CMAKE_NMC_DEFAULT_CONFIGS is not a subset of CMAKE_NMC_CROSS_CONFIGS + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross.cmake b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsCross.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-result.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-stderr.txt new file mode 100644 index 0000000..f9cb56d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error: + CMAKE_NMC_DEFAULT_CONFIGS cannot be used without + CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG or CMAKE_NMC_CROSS_CONFIGS + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross.cmake b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoCross.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-result.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-stderr.txt new file mode 100644 index 0000000..f9cb56d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error: + CMAKE_NMC_DEFAULT_CONFIGS cannot be used without + CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG or CMAKE_NMC_CROSS_CONFIGS + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile.cmake b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/InvalidDefaultConfigsNoDefaultFile.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake b/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake index 6a80b1d..3a1c7f5 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake @@ -11,8 +11,20 @@ target_link_libraries(exe PRIVATE Qt5::Core) include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) generate_output_files(exe) +set(moc_writes_depfiles 0) +if(Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0") + set(moc_writes_depfiles 1) +endif() + set(autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation.cpp") +if(moc_writes_depfiles) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps") + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp") +endif() foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES) list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp") + if(moc_writes_depfiles) + list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d") + endif() endforeach() file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES [==[${autogen_files}]==])\n") diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index f3208ed..3626a29 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -62,7 +62,12 @@ function(run_cmake_build case suffix config) foreach(tgt IN LISTS ARGN) list(APPEND tgts --target ${tgt}) endforeach() - run_cmake_command(${case}-${suffix}-build "${CMAKE_COMMAND}" --build . --config ${config} ${tgts}) + if(config) + set(config_arg --config ${config}) + else() + set(config_arg) + endif() + run_cmake_command(${case}-${suffix}-build "${CMAKE_COMMAND}" --build . ${config_arg} ${tgts}) endfunction() function(run_ninja case suffix file) @@ -76,7 +81,7 @@ endfunction() set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE=RelWithDebInfo;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(Simple) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) @@ -103,6 +108,55 @@ run_ninja(Simple reconfigure-config build-Release.ninja simpleexe) execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) file(TOUCH "${RunCMake_TEST_BINARY_DIR}/empty.cmake") run_ninja(Simple reconfigure-noconfig build.ninja simpleexe) +run_ninja(Simple default-build-file-clean build.ninja clean) +run_ninja(Simple default-build-file-clean-minsizerel build.ninja clean:MinSizeRel) +run_ninja(Simple default-build-file-all build.ninja all) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleDefaultBuildAlias-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=all;-DCMAKE_NMC_CROSS_CONFIGS=all") +run_cmake_configure(SimpleDefaultBuildAlias) +unset(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_ninja(SimpleDefaultBuildAlias target build.ninja simpleexe) +run_ninja(SimpleDefaultBuildAlias all build.ninja all) +run_ninja(SimpleDefaultBuildAlias clean build.ninja clean) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleDefaultBuildAliasList-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=Debug\\;Release;-DCMAKE_NMC_CROSS_CONFIGS=all") +run_cmake_configure(SimpleDefaultBuildAliasList) +unset(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_ninja(SimpleDefaultBuildAliasList target-configs build.ninja simpleexe) +# IMPORTANT: This tests cmake --build . with no config using build.ninja +run_cmake_build(SimpleDefaultBuildAliasList all-configs "" all) +run_ninja(SimpleDefaultBuildAliasList all-relwithdebinfo build.ninja all:RelWithDebInfo) +run_ninja(SimpleDefaultBuildAliasList clean-configs build.ninja clean) + +unset(RunCMake_TEST_BINARY_DIR) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release\\;RelWithDebInfo") +run_cmake(InvalidCrossConfigs) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=RelWithDebInfo") +run_cmake(InvalidDefaultBuildFileConfig) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release;-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=Debug\\;Release\\;RelWithDebInfo") +run_cmake(InvalidDefaultConfigsCross) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release;-DCMAKE_NMC_DEFAULT_CONFIGS=all") +run_cmake(InvalidDefaultConfigsNoDefaultFile) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release;-DCMAKE_NMC_DEFAULT_CONFIGS=all") +run_cmake(InvalidDefaultConfigsNoCross) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG=Release") +run_cmake(DefaultBuildFileConfig) +unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleNoCross-build) run_cmake_configure(SimpleNoCross) @@ -116,8 +170,29 @@ run_ninja(SimpleNoCross all-target build-Debug.ninja simplestatic:all) run_ninja(SimpleNoCross all-all build-Debug.ninja all:all) run_cmake_build(SimpleNoCross all-clean Debug clean:all) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleCrossConfigs-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=Debug\\;Release") +run_cmake_configure(SimpleCrossConfigs) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_ninja(SimpleCrossConfigs release-in-release-graph build-Release.ninja simpleexe) +run_cmake_build(SimpleCrossConfigs debug-in-release-graph Release simpleexe:Debug) +run_cmake_build(SimpleCrossConfigs relwithdebinfo-in-release-graph Release simpleexe:RelWithDebInfo) +run_ninja(SimpleCrossConfigs relwithdebinfo-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simpleexe:RelWithDebInfo) +run_ninja(SimpleCrossConfigs release-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simplestatic:Release) +run_cmake_build(SimpleCrossConfigs all-in-relwithdebinfo-graph RelWithDebInfo simplestatic:all) +run_ninja(SimpleCrossConfigs clean-all-in-release-graph build-Release.ninja clean:all) +run_cmake_build(SimpleCrossConfigs all-all-in-release-graph Release all:all) +run_cmake_build(SimpleCrossConfigs all-relwithdebinfo-in-release-graph Release all:RelWithDebInfo) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Framework-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all") +run_cmake_configure(Framework) +unset(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(Framework framework Debug all) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandGenerator) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) @@ -134,7 +209,7 @@ run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja genera run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandsAndTargets) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) @@ -149,8 +224,12 @@ run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirP run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild) run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild) +unset(RunCMake_TEST_BINARY_DIR) + +run_cmake(CustomCommandDepfile) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PostfixAndLocation-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(PostfixAndLocation) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) @@ -165,14 +244,14 @@ run_ninja(Clean release-notall build-Release.ninja exenotall) run_cmake_build(Clean release-clean Release clean) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AdditionalCleanFiles-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(AdditionalCleanFiles) unset(RunCMake_TEST_OPTIONS) run_cmake_build(AdditionalCleanFiles release-clean Release clean) run_ninja(AdditionalCleanFiles all-clean build-Debug.ninja clean:all) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Install-build) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(Install) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) @@ -194,7 +273,7 @@ endif() if(CMake_TEST_Qt5) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") + set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(Qt5) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake new file mode 100644 index 0000000..4e6e654 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-all-ninja-check.cmake @@ -0,0 +1,49 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_LINKER_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake new file mode 100644 index 0000000..c09ae65 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-minsizerel-ninja-check.cmake @@ -0,0 +1,41 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake new file mode 100644 index 0000000..43213dd --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/Simple-default-build-file-clean-ninja-check.cmake @@ -0,0 +1,49 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt new file mode 100644 index 0000000..fa8b462 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt @@ -0,0 +1 @@ +^ninja: error: unknown target 'all:RelWithDebInfo'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake new file mode 100644 index 0000000..6c94369 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake new file mode 100644 index 0000000..d8b5218 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake new file mode 100644 index 0000000..1a37aa3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake @@ -0,0 +1,44 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt new file mode 100644 index 0000000..f3a825c --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt @@ -0,0 +1 @@ +^ninja: error: unknown target 'simpleexe:RelWithDebInfo'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake new file mode 100644 index 0000000..7eddb2f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake @@ -0,0 +1,43 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake new file mode 100644 index 0000000..2a5b708 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake") diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake new file mode 100644 index 0000000..c171e3d --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-all-ninja-check.cmake @@ -0,0 +1,56 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_LINKER_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_LINKER_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_FILE_simplestatic_MinSizeRel} + ${TARGET_LINKER_FILE_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_LINKER_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-clean-ninja-check.cmake new file mode 100644 index 0000000..0f919df --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-clean-ninja-check.cmake @@ -0,0 +1,25 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-target-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-target-ninja-check.cmake new file mode 100644 index 0000000..de4505c --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias-target-ninja-check.cmake @@ -0,0 +1,49 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + + ${TARGET_FILE_simpleshared_MinSizeRel} + ${TARGET_LINKER_FILE_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias.cmake new file mode 100644 index 0000000..2a5b708 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAlias.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake") diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake new file mode 100644 index 0000000..8ffdd20 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-configs-build-check.cmake @@ -0,0 +1,39 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake new file mode 100644 index 0000000..9e5baf9 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-all-relwithdebinfo-ninja-check.cmake @@ -0,0 +1,46 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake new file mode 100644 index 0000000..3829d3e --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-clean-configs-ninja-check.cmake @@ -0,0 +1,32 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_FILE_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-target-configs-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-target-configs-ninja-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList-target-configs-ninja-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList.cmake new file mode 100644 index 0000000..2a5b708 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleDefaultBuildAliasList.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake") diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake index 4817045..918df0b 100644 --- a/Tests/RunCMake/Swift/RunCMakeTest.cmake +++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake @@ -7,6 +7,10 @@ if(RunCMake_GENERATOR STREQUAL Xcode) elseif(RunCMake_GENERATOR STREQUAL Ninja) if(CMAKE_Swift_COMPILER) run_cmake(Win32ExecutableDisallowed) + + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Darwin) + run_cmake(SwiftMultiArch) + unset(RunCMake_TEST_OPTIONS) endif() else() run_cmake(NotSupported) diff --git a/Tests/RunCMake/Swift/SwiftMultiArch-result.txt b/Tests/RunCMake/Swift/SwiftMultiArch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Swift/SwiftMultiArch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Swift/SwiftMultiArch-stderr.txt b/Tests/RunCMake/Swift/SwiftMultiArch-stderr.txt new file mode 100644 index 0000000..874bdc7 --- /dev/null +++ b/Tests/RunCMake/Swift/SwiftMultiArch-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SwiftMultiArch.cmake:3 \(project\): + multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift +Call Stack \(most recent call first\): + CMakeLists.txt:3 diff --git a/Tests/RunCMake/Swift/SwiftMultiArch.cmake b/Tests/RunCMake/Swift/SwiftMultiArch.cmake new file mode 100644 index 0000000..5fdb688 --- /dev/null +++ b/Tests/RunCMake/Swift/SwiftMultiArch.cmake @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.15.1) +set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") +project(SwiftMultiArch + LANGUAGES Swift) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 5cbe333..8a04f78 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -53,3 +53,6 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR else() run_cmake(UnityBuildNative) endif() + +run_cmake(VsDotnetTargetFramework) +run_cmake(VsDotnetTargetFrameworkVersion) diff --git a/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake b/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake new file mode 100644 index 0000000..8e0e0b4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake @@ -0,0 +1,10 @@ +enable_language(CSharp) +if(NOT CMAKE_CSharp_COMPILER) + return() +endif() + +set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6.1") +add_library(foo SHARED foo.cs) + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1") +add_library(bar SHARED foo.cs) diff --git a/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake index 152bf9c..631abac 100644 --- a/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake +++ b/Tests/RunCMake/VS10Project/VsCSharpDefines-check.cmake @@ -27,15 +27,15 @@ foreach(line IN LISTS lines) elseif(inDebug AND (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$") AND - (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$") AND - (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$")) + (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$")) AND + (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$")) ) set(debugOK TRUE) elseif(inRelease AND (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$") AND - (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$") AND - (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$")) + (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$")) AND + (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$")) ) set(releaseOK TRUE) endif() diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake new file mode 100644 index 0000000..e656639 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake @@ -0,0 +1,40 @@ +set(files foo.csproj bar.csproj) + +set(inLib1 FALSE) +set(targetFrameworkInLib1 FALSE) + +set(inLib2 FALSE) +set(targetFrameworksInLib2 FALSE) + +foreach(file ${files}) + set(csProjectFile ${RunCMake_TEST_BINARY_DIR}/${file}) + + if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() + endif() + + file(STRINGS "${csProjectFile}" lines) + + foreach(line IN LISTS lines) + if(NOT inLib1) + if(line MATCHES " *<TargetFramework>netcoreapp3.1</TargetFramework> *$") + set(targetFrameworkInLib1 TRUE) + set(inLib1 TRUE) + endif() + elseif(NOT inLib2) + if(line MATCHES " *<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks> *$") + set(targetFrameworksInLib2 TRUE) + set(inLib2 TRUE) + endif() + endif() + endforeach() +endforeach() + +if(NOT targetFrameworkInLib1) + set(RunCMake_TEST_FAILED "TargetFramework not set correctly.") +endif() + +if(NOT targetFrameworksInLib2) + set(RunCMake_TEST_FAILED "TargetFrameworks not set correctly.") +endif() diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake new file mode 100644 index 0000000..f553679 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake @@ -0,0 +1,11 @@ +enable_language(CSharp) +if(NOT CMAKE_CSharp_COMPILER) + return() +endif() + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1") +set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "net461") +add_library(foo SHARED foo.cs) + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1;net461") +add_library(bar SHARED foo.cs) diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake new file mode 100644 index 0000000..d2c3c3b --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake @@ -0,0 +1,40 @@ +set(files foo.csproj bar.csproj) + +set(inLib1 FALSE) +set(targetFrameworkInLib1 FALSE) + +set(inLib2 FALSE) +set(targetFrameworksInLib2 FALSE) + +foreach(file ${files}) + set(csProjectFile ${RunCMake_TEST_BINARY_DIR}/${file}) + + if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() + endif() + + file(STRINGS "${csProjectFile}" lines) + + foreach(line IN LISTS lines) + if(NOT inLib1) + if(line MATCHES " *<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> *$") + set(targetFrameworkInLib1 TRUE) + set(inLib1 TRUE) + endif() + elseif(NOT inLib2) + if(line MATCHES " *<TargetFramework>netcoreapp3.1</TargetFramework> *$") + set(targetFrameworksInLib2 TRUE) + set(inLib2 TRUE) + endif() + endif() + endforeach() +endforeach() + +if(NOT targetFrameworkInLib1) + set(RunCMake_TEST_FAILED "TargetFrameworkVersion not set correctly.") +endif() + +if(NOT targetFrameworksInLib2) + set(RunCMake_TEST_FAILED "TargetFramework not set correctly.") +endif() diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 6ecf3f2..f1dda54 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -8,6 +8,16 @@ run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) run_cmake(XcodeGenerateTopLevelProjectOnly) + +function(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary-build) + run_cmake(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(XcodeGenerateTopLevelProjectOnlyWithObjectLibrary-build ${CMAKE_COMMAND} --build . --target shared_lib) +endfunction() + +XcodeGenerateTopLevelProjectOnlyWithObjectLibrary() + run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) diff --git a/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary.cmake b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary.cmake new file mode 100644 index 0000000..67e4a00 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnlyWithObjectLibrary.cmake @@ -0,0 +1,3 @@ +set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE) +project(XcodeGenerateTopLevelProjectOnly NONE) +add_subdirectory(subproject_with_object_lib) diff --git a/Tests/RunCMake/XcodeProject/subproject_with_object_lib/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject_with_object_lib/CMakeLists.txt new file mode 100644 index 0000000..ab400f4 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_with_object_lib/CMakeLists.txt @@ -0,0 +1,7 @@ +project(subproject_with_object_lib) + +add_library(object_lib_dependency OBJECT dummy.cpp) + +add_library(shared_lib SHARED dummy.cpp) +target_sources(shared_lib PRIVATE $<TARGET_OBJECTS:object_lib_dependency>) +set_target_properties(shared_lib PROPERTIES MACOSX_RPATH ON) diff --git a/Tests/RunCMake/XcodeProject/subproject_with_object_lib/dummy.cpp b/Tests/RunCMake/XcodeProject/subproject_with_object_lib/dummy.cpp new file mode 100644 index 0000000..bb4218a --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject_with_object_lib/dummy.cpp @@ -0,0 +1,5 @@ +namespace { +void dummy() +{ +} +} diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 47dac34..7ed0773 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -5,3 +5,7 @@ run_cmake(CustomGuid) run_cmake(CustomTypePlatform) run_cmake(CustomGuidTypePlatform) run_cmake(CustomConfig) + +if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") + run_cmake(SkipGetTargetFrameworkProperties) +endif() diff --git a/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake new file mode 100644 index 0000000..375b231 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake @@ -0,0 +1,21 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/ALL_BUILD.vcxproj" all_build) + +macro(project_reference EXTERNAL_PROJECT) + string(REGEX MATCH + "<ProjectReference.Include=.${${EXTERNAL_PROJECT}}.>.*</SkipGetTargetFrameworkProperties>" + EndOfProjectReference + ${all_build} + ) +endmacro() + +set(external_project "external.project") +project_reference(external_project) +if(NOT ${EndOfProjectReference} MATCHES ".*</ProjectReference>") + set(RunCMake_TEST_FAILED "${test} is being set unexpectedly.") +endif() + +set(external_project "external.csproj") +project_reference(external_project) +if(${EndOfProjectReference} MATCHES ".*</ProjectReference>") + set(RunCMake_TEST_FAILED "${test} is not set.") +endif() diff --git a/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake new file mode 100644 index 0000000..f660bd0 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake @@ -0,0 +1,5 @@ +include_external_msproject(external1 external.project + GUID aaa-bbb-ccc-000) + +include_external_msproject(external2 external.csproj + GUID aaa-bbb-ccc-001) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 21c320b..70570b7 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -156,10 +156,12 @@ run_install_test(TARGETS-RPATH) run_install_test(InstallRequiredSystemLibraries) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos) - run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-unresolved) - run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-conflict) - run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-notfile) + if(NOT CMake_INSTALL_NAME_TOOL_BUG) + run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos) + run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-unresolved) + run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-conflict) + run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-notfile) + endif() run_cmake(file-GET_RUNTIME_DEPENDENCIES-project) run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1) run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2) diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt index 94f0f46..50fa81f 100644 --- a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt +++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt @@ -13,6 +13,11 @@ Call Stack \(most recent call first\): This warning is for project developers\. Use -Wno-dev to suppress it\. CMake Error at file-GET_RUNTIME_DEPENDENCIES-badargs2\.cmake:[0-9]+ \(file\): - file Keyword missing value: BUNDLE_EXECUTABLE + file Keywords missing values: + + RESOLVED_DEPENDENCIES_VAR + UNRESOLVED_DEPENDENCIES_VAR + CONFLICTING_DEPENDENCIES_PREFIX + BUNDLE_EXECUTABLE Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake index 138ab95..ac6af85 100644 --- a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake +++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake @@ -1,2 +1,15 @@ -file(GET_RUNTIME_DEPENDENCIES BUNDLE_EXECUTABLE) +file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR + UNRESOLVED_DEPENDENCIES_VAR + CONFLICTING_DEPENDENCIES_PREFIX + BUNDLE_EXECUTABLE + EXECUTABLES + LIBRARIES + MODULES + DIRECTORIES + PRE_INCLUDE_REGEXES + PRE_EXCLUDE_REGEXES + POST_INCLUDE_REGEXES + POST_EXCLUDE_REGEXES + ) message(FATAL_ERROR "This message should not be displayed") diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index 14e5cba..993db6e 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -34,6 +34,7 @@ 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 +PYTHON_EXECUTABLE:FILEPATH=C:/Python/3.8-64/python.exe ") set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000") set(CFLAGS "${ppflags}") diff --git a/Utilities/Release/win64_release.cmake b/Utilities/Release/win64_release.cmake index 149d378..3042889 100644 --- a/Utilities/Release/win64_release.cmake +++ b/Utilities/Release/win64_release.cmake @@ -34,6 +34,7 @@ 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 +PYTHON_EXECUTABLE:FILEPATH=C:/Python/3.8-64/python.exe ") set(ppflags "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000") set(CFLAGS "${ppflags}") diff --git a/Utilities/Scripts/regenerate-lexers.bash b/Utilities/Scripts/regenerate-lexers.bash index 1b61b70..186802a 100755 --- a/Utilities/Scripts/regenerate-lexers.bash +++ b/Utilities/Scripts/regenerate-lexers.bash @@ -14,7 +14,8 @@ for lexer in \ CTestResourceGroups \ DependsJava \ Expr \ - Fortran + Fortran \ + GccDepfile do cxx_file=cm${lexer}Lexer.cxx h_file=cm${lexer}Lexer.h diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 60c8316..26a9aa9 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -281,7 +281,6 @@ IF(BZIP2_FOUND) ENDIF(USE_BZIP2_DLL) ENDIF(BZIP2_FOUND) MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) # diff --git a/Utilities/cmlibarchive/libarchive/archive_pack_dev.c b/Utilities/cmlibarchive/libarchive/archive_pack_dev.c index 53bddd7..f8286d8 100644 --- a/Utilities/cmlibarchive/libarchive/archive_pack_dev.c +++ b/Utilities/cmlibarchive/libarchive/archive_pack_dev.c @@ -57,8 +57,12 @@ __RCSID("$NetBSD$"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif -#ifdef HAVE_SYS_SYSMACROS_H +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#define HAVE_MAJOR +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +#define HAVE_MAJOR #endif #ifdef HAVE_UNISTD_H #include <unistd.h> diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c index 554533e..85594cc 100644 --- a/Utilities/cmlibarchive/libarchive/archive_string.c +++ b/Utilities/cmlibarchive/libarchive/archive_string.c @@ -735,7 +735,8 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, else dp = &defchar_used; count = WideCharToMultiByte(to_cp, 0, ws, wslen, - as->s + as->length, (int)as->buffer_length-1, NULL, dp); + as->s + as->length, + (int)as->buffer_length - as->length - 1, NULL, dp); if (count == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { /* Expand the MBS buffer and retry. */ @@ -1512,8 +1513,10 @@ get_current_codepage(void) p = strrchr(locale, '.'); if (p == NULL) return (GetACP()); + if (strcmp(p+1, "utf8") == 0) + return CP_UTF8; cp = my_atoi(p+1); - if (cp <= 0) + if ((int)cp <= 0) return (GetACP()); return (cp); } diff --git a/Utilities/std/cm/memory b/Utilities/std/cm/memory index 8ebded2..dd0f822 100644 --- a/Utilities/std/cm/memory +++ b/Utilities/std/cm/memory @@ -8,6 +8,8 @@ #include <memory> // IWYU pragma: export #if !defined(CMake_HAVE_CXX_MAKE_UNIQUE) +# include <cstddef> +# include <type_traits> # include <utility> #endif @@ -19,12 +21,45 @@ using std::make_unique; #else +namespace internals { + +template <typename T> +struct make_unique_if +{ + using single = std::unique_ptr<T>; +}; + +template <typename T> +struct make_unique_if<T[]> +{ + using unbound_array = std::unique_ptr<T[]>; +}; + +template <typename T, std::size_t N> +struct make_unique_if<T[N]> +{ + using bound_array = void; +}; +} + template <typename T, typename... Args> -std::unique_ptr<T> make_unique(Args&&... args) +typename internals::make_unique_if<T>::single make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } +template <typename T> +typename internals::make_unique_if<T>::unbound_array make_unique(std::size_t n) +{ + using E = typename std::remove_extent<T>::type; + + return std::unique_ptr<T>(new E[n]()); +} + +template <typename T, typename... Args> +typename internals::make_unique_if<T>::bound_array make_unique(Args&&...) = + delete; + #endif } // namespace cm diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 609860c..44e61f4 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -10,43 +10,154 @@ #include <iterator> #include <memory> #include <utility> -#include <vector> #include <cm/type_traits> #include <cmext/iterator> +#if defined(__SUNPRO_CC) && defined(__sparc) +# include <list> +# include <vector> +#else +# include <cmext/type_traits> +#endif + namespace cm { -template <typename T> -void append(std::vector<std::unique_ptr<T>>& v, - std::vector<std::unique_ptr<T>>&& r) +#if defined(__SUNPRO_CC) && defined(__sparc) +// Oracle DeveloperStudio C++ compiler on Solaris/Sparc fails to compile +// templates with constraints. +// So, on this platform, use only simple templates. +# define APPEND_TWO(C1, C2) \ + template <typename T, typename U> \ + void append(C1<std::unique_ptr<T>>& v, C2<std::unique_ptr<U>>&& r) \ + { \ + std::transform( \ + r.begin(), r.end(), std::back_inserter(v), \ + [](std::unique_ptr<U>& item) { return std::move(item); }); \ + r.clear(); \ + } \ + \ + template <typename T, typename U> \ + void append(C1<T*>& v, C2<std::unique_ptr<U>> const& r) \ + { \ + std::transform( \ + r.begin(), r.end(), std::back_inserter(v), \ + [](const std::unique_ptr<U>& item) { return item.get(); }); \ + } + +# define APPEND_ONE(C) \ + template <typename T, typename InputIt, \ + cm::enable_if_t<cm::is_input_iterator<InputIt>::value, int> = \ + 0> \ + void append(C<T>& v, InputIt first, InputIt last) \ + { \ + v.insert(v.end(), first, last); \ + } \ + \ + template <typename T, typename Range, \ + cm::enable_if_t<cm::is_input_range<Range>::value, int> = 0> \ + void append(C<T>& v, Range const& r) \ + { \ + v.insert(v.end(), r.begin(), r.end()); \ + } + +# define APPEND(C) \ + APPEND_TWO(C, C) \ + APPEND_ONE(C) + +# define APPEND_MIX(C1, C2) \ + APPEND_TWO(C1, C2) \ + APPEND_TWO(C2, C1) + +// For now, manage only support for std::vector and std::list. +// Other sequential container support can be added if needed. +APPEND(std::vector) +APPEND(std::list) +APPEND_MIX(std::vector, std::list) + +# undef APPEND +# undef APPEND_MIX +# undef APPEND_TWO +# undef APPEND_ONE + +#else + +template < + typename Container1, typename Container2, + cm::enable_if_t< + cm::is_sequence_container<Container1>::value && + cm::is_unique_ptr<typename Container1::value_type>::value && + cm::is_unique_ptr<typename Container2::value_type>::value && + std::is_convertible<typename Container2::value_type::pointer, + typename Container1::value_type::pointer>::value, + int> = 0> +void append(Container1& v, Container2&& r) { - std::transform(r.begin(), r.end(), std::back_inserter(v), - [](std::unique_ptr<T>& item) { return std::move(item); }); + std::transform( + r.begin(), r.end(), std::back_inserter(v), + [](typename Container2::value_type& item) { return std::move(item); }); r.clear(); } -template <typename T> -void append(std::vector<T*>& v, std::vector<std::unique_ptr<T>> const& r) +template <typename Container1, typename Container2, + cm::enable_if_t< + cm::is_sequence_container<Container1>::value && + std::is_pointer<typename Container1::value_type>::value && + cm::is_unique_ptr<typename Container2::value_type>::value && + std::is_convertible<typename Container2::value_type::pointer, + typename Container1::value_type>::value, + int> = 0> +# if defined(__SUNPRO_CC) +void append(Container1& v, Container2 const& r, detail::overload_selector<0>) +# else +void append(Container1& v, Container2 const& r) +# endif { - std::transform(r.begin(), r.end(), std::back_inserter(v), - [](const std::unique_ptr<T>& item) { return item.get(); }); + std::transform( + r.begin(), r.end(), std::back_inserter(v), + [](const typename Container2::value_type& item) { return item.get(); }); } -template <typename T, typename InputIt, - cm::enable_if_t<cm::is_input_iterator<InputIt>::value, int> = 0> -void append(std::vector<T>& v, InputIt first, InputIt last) +template < + typename Container, typename InputIt, + cm::enable_if_t< + cm::is_sequence_container<Container>::value && + cm::is_input_iterator<InputIt>::value && + std::is_convertible<typename std::iterator_traits<InputIt>::value_type, + typename Container::value_type>::value, + int> = 0> +void append(Container& v, InputIt first, InputIt last) { v.insert(v.end(), first, last); } -template <typename T, typename Range, - cm::enable_if_t<cm::is_input_range<Range>::value, int> = 0> -void append(std::vector<T>& v, Range const& r) +template <typename Container, typename Range, + cm::enable_if_t< + cm::is_sequence_container<Container>::value && + cm::is_input_range<Range>::value && + !cm::is_unique_ptr<typename Container::value_type>::value && + !cm::is_unique_ptr<typename Range::value_type>::value && + std::is_convertible<typename Range::value_type, + typename Container::value_type>::value, + int> = 0> +# if defined(__SUNPRO_CC) +void append(Container& v, Range const& r, detail::overload_selector<1>) +# else +void append(Container& v, Range const& r) +# endif { v.insert(v.end(), r.begin(), r.end()); } +# if defined(__SUNPRO_CC) +template <typename T, typename U> +void append(T& v, U const& r) +{ + cm::append(v, r, detail::overload_selector<1>{}); +} +# endif +#endif + } // namespace cm #endif diff --git a/Utilities/std/cmext/type_traits b/Utilities/std/cmext/type_traits index da6550d..00984cb 100644 --- a/Utilities/std/cmext/type_traits +++ b/Utilities/std/cmext/type_traits @@ -10,6 +10,24 @@ namespace cm { +#if defined(__SUNPRO_CC) +// Oracle DeveloperStudio C++ compiler do not support overloaded templates with +// same signature but different constraints over template arguments +// (i.e. meta-programming). +// As a work-around, use a structure to avoid templates with same signature. +namespace detail { +template <int N> +struct overload_selector : overload_selector<N - 1> +{ +}; + +template <> +struct overload_selector<0> +{ +}; +} +#endif + // type traits for managed pointer types template <typename> struct is_unique_ptr : std::false_type @@ -1234,6 +1234,29 @@ fi echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}" #----------------------------------------------------------------------------- +# Test CXX features + +cmake_cxx_features="make_unique" + +for feature in ${cmake_cxx_features}; do + eval "cmake_have_cxx_${feature}=0" + echo "Checking whether '${cmake_cxx_compiler} ${cmake_cxx_flags}' supports '${feature}'." >> cmake_bootstrap.log 2>&1 + if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" \ + "${cmake_source_dir}/Source/Checks/cm_cxx_${feature}.cxx" >> cmake_bootstrap.log 2>&1; then + eval "cmake_have_cxx_${feature}=1" + fi +done + +cmake_have_cxx_features="" +for feature in ${cmake_cxx_features}; do + feature_variable="cmake_have_cxx_${feature}" + eval "feature_value=\${${feature_variable}}" + if [ "${feature_value}" -eq "1" ]; then + cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}" + fi +done + +#----------------------------------------------------------------------------- # Test Make cmake_make_processor= @@ -1534,6 +1557,7 @@ cmake_c_flags="${cmake_c_flags} \ -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" cmake_cxx_flags="${cmake_cxx_flags} \ -DCMAKE_BOOTSTRAP \ + ${cmake_have_cxx_features} \ -I`cmake_escape \"${cmake_bootstrap_dir}\"` \ -I`cmake_escape \"${cmake_source_dir}/Source\"` \ -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \ |