summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-09-30 16:25:02 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2002-09-30 16:25:02 -0400
commita63f7ba43c9200dd385b34c658c500eedc222e3f (patch)
tree045253ed81e3cae887d7940e67dd8336458bff02
parent04d8ba688cf670fc20ea92d472dfba67556a5e68 (diff)
downloadcmake-a63f7ba43c9200dd385b34c658c500eedc222e3f.tar.gz
BUG: fix load command stuff for cygwin and cleanup at exit
-rw-r--r--Source/MFCDialog/CMakeSetup.cpp2
-rw-r--r--Source/Makefile.in2
-rw-r--r--Source/cmDynamicLoader.cxx8
-rw-r--r--Source/cmakemain.cxx15
4 files changed, 22 insertions, 5 deletions
diff --git a/Source/MFCDialog/CMakeSetup.cpp b/Source/MFCDialog/CMakeSetup.cpp
index 808448c092..aadeb34832 100644
--- a/Source/MFCDialog/CMakeSetup.cpp
+++ b/Source/MFCDialog/CMakeSetup.cpp
@@ -7,6 +7,7 @@
#include "CMakeCommandLineInfo.h"
#include "../cmListFileCache.h"
#include "../cmCacheManager.h"
+#include "../cmDynamicLoader.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -77,6 +78,7 @@ BOOL CMakeSetup::InitInstance()
// clean up globals
cmListFileCache::GetInstance()->ClearCache();
+ cmDynamicLoader::FlushCache();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
diff --git a/Source/Makefile.in b/Source/Makefile.in
index d44e29f3a0..57763b5862 100644
--- a/Source/Makefile.in
+++ b/Source/Makefile.in
@@ -32,6 +32,7 @@ cmTarget.o \
cmCustomCommand.o \
cmCacheManager.o \
cmListFileCache.o \
+cmDynamicLoader.o \
cmSourceGroup.o
DEPENDS = cmConfigure.h
@@ -53,6 +54,7 @@ cmLocalUnixMakefileGenerator.o : $(DEPENDS)
cmCommands.o : $(DEPENDS) $(srcdir)/*Command*.cxx
cmTarget.o : $(DEPENDS)
cmCacheManager.o : $(DEPENDS)
+cmDynamicLoader.o : $(DEPENDS)
cmSourceGroup.o : $(DEPENDS)
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 7e21a7fca0..75c3850800 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -44,7 +44,6 @@ cmDynamicLoaderCache* cmDynamicLoaderCache::Instance = 0;
cmDynamicLoaderCache::~cmDynamicLoaderCache()
{
- this->FlushCache();
}
void cmDynamicLoaderCache::CacheFile(const char* path, const cmLibHandle& p)
@@ -71,13 +70,16 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path, cmLibHandle& p)
bool cmDynamicLoaderCache::FlushCache(const char* path)
{
std::map<std::string, cmLibHandle>::iterator it = m_CacheMap.find(path);
+ bool ret = false;
if ( it != m_CacheMap.end() )
{
cmDynamicLoader::CloseLibrary(it->second);
m_CacheMap.erase(it);
- return true;
+ ret = true;
}
- return false;
+ delete cmDynamicLoaderCache::Instance;
+ cmDynamicLoaderCache::Instance = 0;
+ return ret;
}
void cmDynamicLoaderCache::FlushCache()
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index c882101c11..7086e8f80a 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -17,9 +17,21 @@
#include "cmakewizard.h"
#include "cmake.h"
#include "cmCacheManager.h"
+#include "cmDynamicLoader.h"
+#include "cmListFileCache.h"
+
+int do_cmake(int ac, char** av);
int main(int ac, char** av)
{
+ int ret = do_cmake(ac, av);
+ cmDynamicLoader::FlushCache();
+ cmListFileCache::GetInstance()->ClearCache();
+ return ret;
+}
+
+int do_cmake(int ac, char** av)
+{
bool wiz = false;
bool command = false;
std::vector<std::string> args;
@@ -54,6 +66,5 @@ int main(int ac, char** av)
return 0;
}
cmake cm;
- int ret = cm.Run(args);
- return ret;
+ return cm.Run(args);
}