CPack/External: Fix status messages of staging scripts

Set progress callback on cmake instance used by CPack.  The progress
callback is used to output STATUS messages which are otherwise missing
when issued from e.g. CPack External staging scripts.

Fixes: #18567
This commit is contained in:
Nils Gladitz 2018-12-01 09:15:17 +01:00 committed by Brad King
parent 6294296906
commit 4a3ae1710e
3 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,15 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
static void cpackProgressCallback(const char* message, float progress,
void* clientdata)
{
(void)progress;
(void)clientdata;
std::cout << "-- " << message << std::endl;
}
// this is CPack.
int main(int argc, char const* const* argv)
{
@ -201,6 +210,7 @@ int main(int argc, char const* const* argv)
cmake cminst(cmake::RoleScript);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
cminst.SetProgressCallback(cpackProgressCallback, nullptr);
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator cmgg(&cminst);
cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot());

View File

@ -22,3 +22,5 @@ expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt)
expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt)
expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt)
expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt)
message(STATUS "This status message is expected to be visible")

View File

@ -0,0 +1 @@
-- This status message is expected to be visible