diff options
author | Brad King <brad.king@kitware.com> | 2021-06-10 12:23:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-06-10 12:23:45 (GMT) |
commit | 5fd68d3ef75d590da383b5189ee7f952bd560a30 (patch) | |
tree | 7ece5b57c9c6177c18b4c4cca235312d39ccb3e0 /Templates | |
parent | cf85c6bf85398213d965a41f81b604142456bd23 (diff) | |
parent | 526e2ef71c5b797818bbf232e21d0152a3938197 (diff) | |
download | CMake-5fd68d3ef75d590da383b5189ee7f952bd560a30.zip CMake-5fd68d3ef75d590da383b5189ee7f952bd560a30.tar.gz CMake-5fd68d3ef75d590da383b5189ee7f952bd560a30.tar.bz2 |
Merge topic 'vs-custom-depfile'
526e2ef71c VS: Add support for add_custom_command DEPFILE
794ad78abb Help: Generalize release note filename for add_custom_command DEPFILE
7291f31254 cmTransformDepfile: Add support for MSBuild AdditionalInputs format
a6de8ec51b cmTransformDepfile: Make directory for transformed depfile automatically
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6206
Diffstat (limited to 'Templates')
-rw-r--r-- | Templates/MSBuild/CustomBuildDepFile.targets | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Templates/MSBuild/CustomBuildDepFile.targets b/Templates/MSBuild/CustomBuildDepFile.targets new file mode 100644 index 0000000..2387ab5 --- /dev/null +++ b/Templates/MSBuild/CustomBuildDepFile.targets @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <!-- Update AdditionalInputs with depfile-discovered inputs. --> + <Target Name="CMakeCustomBuildDepFileAdditionalInputs" BeforeTargets="CustomBuild" Condition="'@(CustomBuild)' != ''"> + <ItemGroup> + <!-- Save original AdditionalInputs generated by CMake. --> + <CustomBuild> + <CMakeAdditionalInputs>%(CustomBuild.AdditionalInputs)</CMakeAdditionalInputs> + </CustomBuild> + <!-- Read depfile-discovered inputs. --> + <CustomBuild Condition="Exists('%(CustomBuild.DepFileAdditionalInputsFile)')"> + <DepFileAdditionalInputs>$([System.IO.File]::ReadAllText('%(CustomBuild.DepFileAdditionalInputsFile)').TrimEnd())</DepFileAdditionalInputs> + </CustomBuild> + <!-- Add depfile-discovered inputs to AdditionalInputs. --> + <CustomBuild Condition="'%(CustomBuild.DepFileAdditionalInputs)' != ''"> + <AdditionalInputs Condition="'%(CustomBuild.AdditionalInputs)' == ''">%(CustomBuild.DepFileAdditionalInputs)</AdditionalInputs> + <AdditionalInputs Condition="'%(CustomBuild.AdditionalInputs)' != ''">%(CustomBuild.AdditionalInputs);%(CustomBuild.DepFileAdditionalInputs)</AdditionalInputs> + </CustomBuild> + </ItemGroup> + </Target> + + <!-- Update the tracking log with depfile-discovered inputs. --> + <Target Name="CMakeCustomBuildDepFileTrackingLog" AfterTargets="CustomBuild" Condition="'@(CustomBuild)' != ''"> + <!-- Compute the tracking log content for each CustomBuild item individually. --> + <ItemGroup> + <!-- Read depfile-discovered inputs. --> + <CustomBuild Condition="Exists('%(CustomBuild.DepFileAdditionalInputsFile)')"> + <DepFileAdditionalInputs>$([System.IO.File]::ReadAllText('%(CustomBuild.DepFileAdditionalInputsFile)').TrimEnd())</DepFileAdditionalInputs> + </CustomBuild> + <!-- Generate tracking log representation of all inputs. --> + <CustomBuild> + <ReadTLog>^%(CustomBuild.Identity)
</ReadTLog> + </CustomBuild> + <CustomBuild Condition="'%(CustomBuild.CMakeAdditionalInputs)' != ''"> + <ReadTLog>%(ReadTLog)$([System.String]::Copy('%(CustomBuild.CMakeAdditionalInputs)').Trim(';').Replace(';', '
'))
</ReadTLog> + </CustomBuild> + <CustomBuild Condition="'%(CustomBuild.DepFileAdditionalInputs)' != ''"> + <ReadTLog>%(ReadTLog)$([System.String]::Copy('%(CustomBuild.DepFileAdditionalInputs)').Trim(';').Replace(';', '
'))
</ReadTLog> + </CustomBuild> + </ItemGroup> + <!-- Compute the combined tracking log for all CustomBuild items together. --> + <PropertyGroup> + <CustomBuildReadTLog>@(CustomBuild->'%(ReadTLog)','')</CustomBuildReadTLog> + </PropertyGroup> + <!-- Replace the combined tracking log on disk. --> + <WriteLinesToFile File="$(TLogLocation)CustomBuild.read.1.tlog" Overwrite="true" Lines="$(CustomBuildReadTLog.ToUpper())" /> + </Target> +</Project> |