summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-07-23 13:51:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-07-23 13:51:14 (GMT)
commit0d52257afa07303a920912f3cc0163f037c6467a (patch)
tree35eb4266168660f34362e7311f1a53a5cb807072 /Source/CPack
parentb0a7a2dd9a0b6ba854f60ba20315769786a50b35 (diff)
parentab26d334bfa74871095239a53a6c7af92bdbacdf (diff)
downloadCMake-0d52257afa07303a920912f3cc0163f037c6467a.zip
CMake-0d52257afa07303a920912f3cc0163f037c6467a.tar.gz
CMake-0d52257afa07303a920912f3cc0163f037c6467a.tar.bz2
Merge topic 'cpack-external-partial-json'
ab26d334bf cmCPackExternalGenerator: ensure JSON is written before running the script Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9669
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 52eacaa..76cb876 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -15,6 +15,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmGeneratedFileStream.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
@@ -48,17 +49,19 @@ int cmCPackExternalGenerator::PackageFiles()
filename = this->packageFileNames[0];
}
- cmsys::ofstream fout(filename.c_str());
- std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter());
+ {
+ cmGeneratedFileStream fout(filename);
+ std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter());
- Json::Value root(Json::objectValue);
+ Json::Value root(Json::objectValue);
- if (!this->Generator->WriteToJSON(root)) {
- return 0;
- }
+ if (!this->Generator->WriteToJSON(root)) {
+ return 0;
+ }
- if (jout->write(root, &fout)) {
- return 0;
+ if (jout->write(root, &fout)) {
+ return 0;
+ }
}
cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT");