diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-01-25 20:31:33 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-01-29 15:32:52 (GMT) |
commit | bcee24aecc1eaf6615eac9f24ae06acdf38845d3 (patch) | |
tree | 7a5ce493d66e1ff9a154bbd7503bd6e646624444 /Source/CPack | |
parent | 9620cb935a49e7b4955f5b1d0ffa2e93b4327591 (diff) | |
download | CMake-bcee24aecc1eaf6615eac9f24ae06acdf38845d3.zip CMake-bcee24aecc1eaf6615eac9f24ae06acdf38845d3.tar.gz CMake-bcee24aecc1eaf6615eac9f24ae06acdf38845d3.tar.bz2 |
Use `std::function` for callbacks
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 8 |
2 files changed, 5 insertions, 13 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4728f69..3309e1b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -43,12 +43,6 @@ cmCPackGenerator::~cmCPackGenerator() this->MakefileMap = nullptr; } -void cmCPackGeneratorProgress(const char* msg, float prog, void* ptr) -{ - cmCPackGenerator* self = static_cast<cmCPackGenerator*>(ptr); - self->DisplayVerboseOutput(msg, prog); -} - void cmCPackGenerator::DisplayVerboseOutput(const char* msg, float progress) { (void)progress; @@ -696,7 +690,9 @@ int cmCPackGenerator::InstallCMakeProject( cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.AddCMakePaths(); - cm.SetProgressCallback(cmCPackGeneratorProgress, this); + cm.SetProgressCallback([this](const char* msg, float prog) { + this->DisplayVerboseOutput(msg, prog); + }); cm.SetTrace(this->Trace); cm.SetTraceExpand(this->TraceExpand); cmGlobalGenerator gg(&cm); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d4c867b..0413422 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -90,12 +90,8 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 1; } -static void cpackProgressCallback(const char* message, float progress, - void* clientdata) +static void cpackProgressCallback(const char* message, float /*unused*/) { - (void)progress; - (void)clientdata; - std::cout << "-- " << message << std::endl; } @@ -212,7 +208,7 @@ int main(int argc, char const* const* argv) cmake cminst(cmake::RoleScript, cmState::CPack); cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); - cminst.SetProgressCallback(cpackProgressCallback, nullptr); + cminst.SetProgressCallback(cpackProgressCallback); cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator cmgg(&cminst); cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot()); |