summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-17 13:25:08 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-07-17 13:25:08 (GMT)
commit95a8331edb4ba7b53abd796066165b29f70ff258 (patch)
tree05e7fdd622a040259c37877366c7c697538ccc2b /Source/cmakemain.cxx
parent57f25c53e3bbbbda97a7e58fac27c1c56bc1f03a (diff)
downloadCMake-95a8331edb4ba7b53abd796066165b29f70ff258.zip
CMake-95a8331edb4ba7b53abd796066165b29f70ff258.tar.gz
CMake-95a8331edb4ba7b53abd796066165b29f70ff258.tar.bz2
ENH: produce a lot more output when running with --debug-output
-try to fix build error on HPUX Alex
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx83
1 files changed, 70 insertions, 13 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 79ae833..70caeb8 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -19,6 +19,9 @@
#include "cmListFileCache.h"
#include "cmakewizard.h"
#include "cmSourceFile.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmDynamicLoader.h"
@@ -172,7 +175,70 @@ static const cmDocumentationEntry cmDocumentationNOTE[] =
#endif
int do_cmake(int ac, char** av);
-void updateProgress(const char *msg, float prog, void *cd);
+
+static cmMakefile* cmakemainGetMakefile(void *clientdata)
+{
+ cmake* cm = (cmake *)clientdata;
+ if(cm && cm->GetDebugOutput())
+ {
+ cmGlobalGenerator* gg=cm->GetGlobalGenerator();
+ if (gg)
+ {
+ cmLocalGenerator* lg=gg->GetCurrentLocalGenerator();
+ if (lg)
+ {
+ cmMakefile* mf = lg->GetMakefile();
+ return mf;
+ }
+ }
+ }
+ return 0;
+}
+
+static std::string cmakemainGetStack(void *clientdata)
+{
+ std::string msg;
+ cmMakefile* mf=cmakemainGetMakefile(clientdata);
+ if (mf)
+ {
+ msg = mf->GetListFileStack();
+ if (!msg.empty())
+ {
+ msg = "\nCalled from: " + msg;
+ }
+ }
+
+ return msg;
+}
+
+static void cmakemainErrorCallback(const char* m, const char* title, bool& nomore, void *clientdata)
+{
+ std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
+}
+
+static void cmakemainProgressCallback(const char *m, float prog, void* clientdata)
+{
+ cmMakefile* mf = cmakemainGetMakefile(clientdata);
+ std::string dir;
+ if ((mf) && (strstr(m, "Configuring")==m))
+ {
+ dir = " ";
+ dir += mf->GetCurrentDirectory();
+ }
+ else if ((mf) && (strstr(m, "Generating")==m))
+ {
+ dir = " ";
+ dir += mf->GetCurrentOutputDirectory();
+ }
+
+ if ((prog < 0) || (!dir.empty()))
+ {
+ std::cout << "-- " << m << dir << cmakemainGetStack(clientdata) << std::endl;
+ }
+
+ std::cout.flush();
+}
+
int main(int ac, char** av)
{
@@ -355,8 +421,10 @@ int do_cmake(int ac, char** av)
return ret;
}
cmake cm;
- cm.SetProgressCallback(updateProgress, 0);
+ cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
+ cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
cm.SetScriptMode(script_mode);
+
int res = cm.Run(args, view_only);
if ( list_cached || list_all_cached )
{
@@ -390,14 +458,3 @@ int do_cmake(int ac, char** av)
return res;
}
-void updateProgress(const char *msg, float prog, void*)
-{
- if ( prog < 0 )
- {
- std::cout << "-- " << msg << std::endl;
- }
- //else
- //{
- //std::cout << "-- " << msg << " " << prog << std::endl;
- //}
-}