summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-08-21 15:57:12 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-08-21 15:57:12 (GMT)
commit34c7c1b78d347f30ecb5124db7f365ffb385b5a1 (patch)
tree0df921f74f1540b0b7471cfd34ba4426628e3e3e /Source
parent38dfd36fdaad9c7e3767189b23d74c4953614139 (diff)
downloadCMake-34c7c1b78d347f30ecb5124db7f365ffb385b5a1.zip
CMake-34c7c1b78d347f30ecb5124db7f365ffb385b5a1.tar.gz
CMake-34c7c1b78d347f30ecb5124db7f365ffb385b5a1.tar.bz2
made CMakeLib shared on windows
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt22
-rw-r--r--Source/cmCacheManager.cxx15
-rw-r--r--Source/cmCacheManager.h52
-rw-r--r--Source/cmDirectory.h6
-rw-r--r--Source/cmListFileCache.h4
-rw-r--r--Source/cmStandardIncludes.h11
-rw-r--r--Source/cmSystemTools.h2
7 files changed, 88 insertions, 24 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 2720c9a..5f839cf 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -10,6 +10,8 @@ cmRegularExpression.cxx
cmSourceFile.cxx
cmSystemTools.cxx
cmDirectory.cxx
+cmDynamicLoader.cxx
+cmCPluginAPI.cxx
cmCommands.cxx
cmTarget.cxx
cmCustomCommand.cxx
@@ -24,6 +26,7 @@ cmMakefileGenerator.h
cmRegularExpression.h
cmSourceFile.h
cmSystemTools.h
+cmDynamicLoader.h
cmDirectory.h
cmCommands.h
cmTarget.h
@@ -72,15 +75,23 @@ SET(SRCS ${SRCS} cmUnixMakefileGenerator.cxx cmUnixMakefileGenerator.h)
# create a library used by the command line and the GUI
-ADD_LIBRARY(CMakeLib ${SRCS})
+IF (WIN32)
+ ADD_LIBRARY(CMakeLib SHARED ${SRCS})
+ELSE (WIN32)
+ ADD_LIBRARY(CMakeLib ${SRCS})
+ENDIF (WIN32)
+
# always link in the library
-LINK_LIBRARIES(CMakeLib)
# the library is found here
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Source)
ADD_EXECUTABLE(cmake cmakemain.cxx)
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
-ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx)
+ADD_EXECUTABLE(ctest ctest.cxx)
+
+TARGET_LINK_LIBRARIES(cmake CMakeLib)
+TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib)
+TARGET_LINK_LIBRARIES(ctest CMakeLib)
IF (UNIX)
INCLUDE (${CMake_SOURCE_DIR}/Modules/FindCurses.cmake OPTIONAL)
@@ -98,8 +109,11 @@ CONFIGURE_FILE(
${CMake_SOURCE_DIR}/Source/cmaketest.h.in
${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)
-ADD_EXECUTABLE(cmaketest cmaketest.cxx cmSystemTools.cxx)
+ADD_EXECUTABLE(cmaketest cmaketest.cxx)
+TARGET_LINK_LIBRARIES(cmaketest CMakeLib)
+#ADD_LIBRARY(TEST_PLUGIN SHARED cmSimpleCommandPlugin.c)
+#TARGET_LINK_LIBRARIES(TEST_PLUGIN CMakeLib)
IF(BUILD_TESTING)
ADD_TEST(DumpDocumentation ${CMake_BINARY_DIR}/Source/DumpDocumentation
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 3d848c7..81b5337 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -536,3 +536,18 @@ bool cmCacheManager::IsAdvanced(const char* key)
}
return false;
}
+
+bool cmCacheManager::CacheIterator::IsAtEnd()
+{
+ return position == m_Container.m_Cache.end();
+}
+
+void cmCacheManager::CacheIterator::Begin()
+{
+ position = m_Container.m_Cache.begin();
+}
+
+void cmCacheManager::CacheIterator::Next()
+{
+ ++position;
+}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 54a1d10..f855f2d 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -36,7 +36,30 @@ public:
std::string m_HelpString;
CacheEntryType m_Type;
};
-public:
+ class CacheIterator
+ {
+ public:
+ CM_EXPORT void Begin();
+ CM_EXPORT bool IsAtEnd();
+ CM_EXPORT void Next();
+ const char *GetName() {
+ return position->first.c_str(); }
+ CacheEntry const &GetEntry() {
+ return position->second; }
+ cmCacheManager const &m_Container;
+ std::map<cmStdString, CacheEntry>::const_iterator position;
+ CacheIterator(cmCacheManager const &foo) : m_Container(foo) {
+ this->Begin();
+ }
+ };
+ friend class cmCacheManager::CacheIterator;
+
+ ///! return an iterator to iterate through the cache map
+ cmCacheManager::CacheIterator NewIterator()
+ {
+ return CacheIterator(*this);
+ }
+
typedef std::map<cmStdString, CacheEntry> CacheEntryMap;
/**
* Types for the cache entries. These are useful as
@@ -47,35 +70,36 @@ public:
*/
static CacheEntryType StringToType(const char*);
///! Singleton pattern get instance of the cmCacheManager.
- static cmCacheManager* GetInstance();
+ CM_EXPORT static cmCacheManager* GetInstance();
///! Load a cache for given makefile. Loads from ouput home.
- bool LoadCache(cmMakefile*);
+ CM_EXPORT bool LoadCache(cmMakefile*);
///! Load a cache for given makefile. Loads from path/CMakeCache.txt.
- bool LoadCache(const char* path);
- bool LoadCache(const char* path, bool internal);
- bool LoadCache(const char* path, bool internal,
+ CM_EXPORT bool LoadCache(const char* path);
+ CM_EXPORT bool LoadCache(const char* path, bool internal);
+ CM_EXPORT bool LoadCache(const char* path, bool internal,
std::set<std::string>& excludes,
std::set<std::string>& includes);
///! Save cache for given makefile. Saves to ouput home CMakeCache.txt.
- bool SaveCache(cmMakefile*) ;
+ CM_EXPORT bool SaveCache(cmMakefile*) ;
///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt
- bool SaveCache(const char* path) ;
+ CM_EXPORT bool SaveCache(const char* path) ;
///! Print the cache to a stream
void PrintCache(std::ostream&) const;
- ///! Get the cache map ivar.
- const CacheEntryMap &GetCacheMap() const { return m_Cache; }
-
///! Get a cache entry object for a key
- CacheEntry *GetCacheEntry(const char *key);
+ CM_EXPORT CacheEntry *GetCacheEntry(const char *key);
- bool IsAdvanced(const char* key);
+ CM_EXPORT bool IsAdvanced(const char* key);
///! Remove an entry from the cache
- void RemoveCacheEntry(const char* key);
+ CM_EXPORT void RemoveCacheEntry(const char* key);
+
+ ///! Get the number of entries in the cache
+ CM_EXPORT int GetSize() {
+ return m_Cache.size(); }
///! Break up a line like VAR:type="value" into var, type and value
static bool ParseEntry(const char* entry,
diff --git a/Source/cmDirectory.h b/Source/cmDirectory.h
index de5420d..403edd1 100644
--- a/Source/cmDirectory.h
+++ b/Source/cmDirectory.h
@@ -37,17 +37,17 @@ public:
* in that directory. 0 is returned if the directory can not be
* opened, 1 if it is opened.
*/
- bool Load(const char* dir);
+ CM_EXPORT bool Load(const char* dir);
/**
* Return the number of files in the current directory.
*/
- size_t GetNumberOfFiles() { return m_Files.size();}
+ CM_EXPORT size_t GetNumberOfFiles() { return m_Files.size();}
/**
* Return the file at the given index, the indexing is 0 based
*/
- const char* GetFile(size_t );
+ CM_EXPORT const char* GetFile(size_t );
private:
std::vector<std::string> m_Files; // Array of Files
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index f2362db..bb5c2c4 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -45,8 +45,8 @@ struct cmListFile
class cmListFileCache
{
public:
- static cmListFileCache* GetInstance();
- static void ClearCache();
+ static CM_EXPORT cmListFileCache* GetInstance();
+ static CM_EXPORT void ClearCache();
/** Return the cached version of the given file.
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 224e196..942f53b 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -21,6 +21,17 @@
#ifndef cmStandardIncludes_h
#define cmStandardIncludes_h
+/* CM_EXPORT is used by the plugin API */
+#ifdef _WIN32
+#ifdef CMakeLib_EXPORTS
+ #define CM_EXPORT __declspec( dllexport )
+#else
+ #define CM_EXPORT __declspec( dllimport )
+#endif
+#else
+#define CM_EXPORT
+#endif
+
// include configure generated header to define
// CMAKE_NO_ANSI_STREAM_HEADERS and CMAKE_NO_STD_NAMESPACE
#if defined(CMAKE_HAS_AUTOCONF) || defined(CMAKE_BUILD_WITH_CMAKE)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 0ef9b6f..3740f17 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -27,7 +27,7 @@ class cmMakefile;
* cmSystemTools is a class that provides helper functions
* for the CMake build system.
*/
-class cmSystemTools
+class CM_EXPORT cmSystemTools
{
public:
/**