BUG: add explicit clean up of the cachemanager at exit of programs, so dll destruction is not a problem.
This commit is contained in:
parent
40cf734152
commit
3f36d23421
|
@ -53,7 +53,8 @@ INCLUDE_DIRECTORIES(${CMake_SOURCE_DIR}/Source)
|
||||||
ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
|
ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
SET(SRCS ${SRCS}
|
IF(NOT UNIX)
|
||||||
|
SET(SRCS ${SRCS}
|
||||||
cmDSWWriter.cxx
|
cmDSWWriter.cxx
|
||||||
cmDSPWriter.cxx
|
cmDSPWriter.cxx
|
||||||
cmMSProjectGenerator.cxx
|
cmMSProjectGenerator.cxx
|
||||||
|
@ -67,7 +68,6 @@ IF (WIN32)
|
||||||
cmNMakeMakefileGenerator.h
|
cmNMakeMakefileGenerator.h
|
||||||
cmMSDotNETGenerator.h
|
cmMSDotNETGenerator.h
|
||||||
)
|
)
|
||||||
IF(NOT UNIX)
|
|
||||||
IF( NOT BORLAND )
|
IF( NOT BORLAND )
|
||||||
LINK_LIBRARIES( rpcrt4.lib )
|
LINK_LIBRARIES( rpcrt4.lib )
|
||||||
SUBDIRS(MFCDialog)
|
SUBDIRS(MFCDialog)
|
||||||
|
|
|
@ -24,9 +24,5 @@ INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH})
|
||||||
ADD_EXECUTABLE(ccmake ${CURSES_SRCS} )
|
ADD_EXECUTABLE(ccmake ${CURSES_SRCS} )
|
||||||
TARGET_LINK_LIBRARIES(ccmake CMakeLib)
|
TARGET_LINK_LIBRARIES(ccmake CMakeLib)
|
||||||
TARGET_LINK_LIBRARIES(ccmake cmForm)
|
TARGET_LINK_LIBRARIES(ccmake cmForm)
|
||||||
TARGET_LINK_LIBRARIES(ccmake ${CURSES_LIBRARY})
|
|
||||||
IF(CURSES_EXTRA_LIBRARY)
|
|
||||||
TARGET_LINK_LIBRARIES(ccmake ${CURSES_EXTRA_LIBRARY})
|
|
||||||
ENDIF(CURSES_EXTRA_LIBRARY)
|
|
||||||
|
|
||||||
INSTALL_TARGETS(/bin ccmake)
|
INSTALL_TARGETS(/bin ccmake)
|
|
@ -45,4 +45,8 @@ SET( FORM_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_FORM_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${CMAKE_FORM_SOURCE_DIR})
|
||||||
ADD_LIBRARY(cmForm ${FORM_SRCS} )
|
ADD_LIBRARY(cmForm ${FORM_SRCS} )
|
||||||
|
TARGET_LINK_LIBRARIES(cmForm ${CURSES_LIBRARY})
|
||||||
|
IF(CURSES_EXTRA_LIBRARY)
|
||||||
|
TARGET_LINK_LIBRARIES(cmForm ${CURSES_EXTRA_LIBRARY})
|
||||||
|
ENDIF(CURSES_EXTRA_LIBRARY)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "CMakeCommandLineInfo.h"
|
#include "CMakeCommandLineInfo.h"
|
||||||
#include "../cmListFileCache.h"
|
#include "../cmListFileCache.h"
|
||||||
#include "../cmMakefileGenerator.h"
|
#include "../cmMakefileGenerator.h"
|
||||||
|
#include "../cmCacheManager.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
@ -78,6 +79,7 @@ BOOL CMakeSetup::InitInstance()
|
||||||
// clean up globals
|
// clean up globals
|
||||||
cmListFileCache::GetInstance()->ClearCache();
|
cmListFileCache::GetInstance()->ClearCache();
|
||||||
cmMakefileGenerator::UnRegisterGenerators();
|
cmMakefileGenerator::UnRegisterGenerators();
|
||||||
|
cmCacheManager::DeleteInstance();
|
||||||
// Since the dialog has been closed, return FALSE so that we exit the
|
// Since the dialog has been closed, return FALSE so that we exit the
|
||||||
// application, rather than start the application's message pump.
|
// application, rather than start the application's message pump.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -50,17 +50,13 @@ cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s)
|
||||||
return STRING;
|
return STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCacheManager::DeleteInstance()
|
||||||
struct CleanUpCacheManager
|
|
||||||
{
|
{
|
||||||
~CleanUpCacheManager()
|
delete cmCacheManager::GetInstance();
|
||||||
{
|
cmCacheManager::s_Instance = 0;
|
||||||
delete cmCacheManager::GetInstance();
|
}
|
||||||
}
|
|
||||||
void Use() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
CleanUpCacheManager cleanup;
|
|
||||||
|
|
||||||
cmCacheManager* cmCacheManager::s_Instance = 0;
|
cmCacheManager* cmCacheManager::s_Instance = 0;
|
||||||
|
|
||||||
|
@ -68,7 +64,6 @@ cmCacheManager* cmCacheManager::GetInstance()
|
||||||
{
|
{
|
||||||
if(!cmCacheManager::s_Instance)
|
if(!cmCacheManager::s_Instance)
|
||||||
{
|
{
|
||||||
cleanup.Use();
|
|
||||||
cmCacheManager::s_Instance = new cmCacheManager;
|
cmCacheManager::s_Instance = new cmCacheManager;
|
||||||
}
|
}
|
||||||
return cmCacheManager::s_Instance;
|
return cmCacheManager::s_Instance;
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
static CacheEntryType StringToType(const char*);
|
static CacheEntryType StringToType(const char*);
|
||||||
///! Singleton pattern get instance of the cmCacheManager.
|
///! Singleton pattern get instance of the cmCacheManager.
|
||||||
CM_EXPORT static cmCacheManager* GetInstance();
|
CM_EXPORT static cmCacheManager* GetInstance();
|
||||||
|
CM_EXPORT static void DeleteInstance();
|
||||||
|
|
||||||
///! Load a cache for given makefile. Loads from ouput home.
|
///! Load a cache for given makefile. Loads from ouput home.
|
||||||
CM_EXPORT bool LoadCache(cmMakefile*);
|
CM_EXPORT bool LoadCache(cmMakefile*);
|
||||||
|
|
|
@ -41,6 +41,11 @@ cmake::cmake()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmake::~cmake()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmake::Usage(const char* program)
|
void cmake::Usage(const char* program)
|
||||||
{
|
{
|
||||||
cmStringStream errorStream;
|
cmStringStream errorStream;
|
||||||
|
|
|
@ -61,7 +61,7 @@ class CM_EXPORT cmake
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
cmake();
|
cmake();
|
||||||
|
~cmake();
|
||||||
private:
|
private:
|
||||||
bool m_Verbose;
|
bool m_Verbose;
|
||||||
bool m_Local;
|
bool m_Local;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "cmakewizard.h"
|
#include "cmakewizard.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmMakefileGenerator.h"
|
#include "cmMakefileGenerator.h"
|
||||||
|
#include "cmCacheManager.h"
|
||||||
|
|
||||||
int main(int ac, char** av)
|
int main(int ac, char** av)
|
||||||
{
|
{
|
||||||
|
@ -52,10 +53,12 @@ int main(int ac, char** av)
|
||||||
cmakewizard wizard;
|
cmakewizard wizard;
|
||||||
wizard.RunWizard(args);
|
wizard.RunWizard(args);
|
||||||
cmMakefileGenerator::UnRegisterGenerators();
|
cmMakefileGenerator::UnRegisterGenerators();
|
||||||
|
cmCacheManager::DeleteInstance();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cmake cm;
|
cmake cm;
|
||||||
int ret = cm.Generate(args);
|
int ret = cm.Generate(args);
|
||||||
cmMakefileGenerator::UnRegisterGenerators();
|
cmMakefileGenerator::UnRegisterGenerators();
|
||||||
|
cmCacheManager::DeleteInstance();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmMakefileGenerator.h"
|
#include "cmMakefileGenerator.h"
|
||||||
|
#include "cmCacheManager.h"
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,6 +32,8 @@ struct CleanUp
|
||||||
~CleanUp()
|
~CleanUp()
|
||||||
{
|
{
|
||||||
cmMakefileGenerator::UnRegisterGenerators();
|
cmMakefileGenerator::UnRegisterGenerators();
|
||||||
|
cmCacheManager::DeleteInstance();
|
||||||
|
|
||||||
}
|
}
|
||||||
void UseIt()
|
void UseIt()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue