diff --git a/CMakeLists.txt b/CMakeLists.txt index db4ef90d32fe5d7fee8a23f65ff41c708608882e..1302c64b7b8f555650a519772af710afa21004ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,6 +465,14 @@ IF(KWSYS_USE_DynamicLoader) ENDIF() IF(KWSYS_USE_SystemTools) + if (NOT DEFINED KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP) + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1) + endif () + if (KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP) + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 1) + else () + set(KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP 0) + endif () KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_SETENV "Checking whether CXX compiler has setenv" DIRECT) KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_UNSETENV diff --git a/Configure.hxx.in b/Configure.hxx.in index d1e7464ff5e05ddac51c2a1b7631ed45f368ef32..92ffea3c98617666ccbb2956347635bd6c41cd78 100644 --- a/Configure.hxx.in +++ b/Configure.hxx.in @@ -11,6 +11,9 @@ /* Whether <ext/stdio_filebuf.h> is available. */ #define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@ +/* Whether the translation map is available or not. */ +#define @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP \ + @KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@ #if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute) # define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_attribute(x) @@ -56,6 +59,8 @@ @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H # define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH # define KWSYS_NULLPTR @KWSYS_NAMESPACE@_NULLPTR +# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \ + @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP #endif #endif diff --git a/SystemTools.cxx b/SystemTools.cxx index 1b1f7982d6b712b580a6a5dfc652dbfb9dc7b9a9..e756cdcfd39c9a8de2f413e3ba64869a16c939d6 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -453,11 +453,13 @@ class SystemToolsStatic { public: typedef std::map<std::string, std::string> StringMap; +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP /** * Path translation table from dir to refdir * Each time 'dir' will be found it will be replace by 'refdir' */ StringMap TranslationMap; +#endif #ifdef _WIN32 static std::string GetCasePathName(std::string const& pathIn); static std::string GetActualCaseForPathCached(std::string const& path); @@ -3317,6 +3319,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_relative) return SystemTools::CollapseFullPath(in_relative, KWSYS_NULLPTR); } +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP void SystemTools::AddTranslationPath(const std::string& a, const std::string& b) { @@ -3380,6 +3383,7 @@ void SystemTools::CheckTranslationPath(std::string& path) // Remove the trailing slash we added before. path.pop_back(); } +#endif static void SystemToolsAppendComponents( std::vector<std::string>& out_components, @@ -3450,6 +3454,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // Transform the path back to a string. std::string newPath = SystemTools::JoinPath(out_components); +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP // Update the translation table with this potentially new path. I am not // sure why this line is here, it seems really questionable, but yet I // would put good money that if I remove it something will break, basically @@ -3465,6 +3470,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, // SystemTools::AddTranslationPath(newPath, in_path); SystemTools::CheckTranslationPath(newPath); +#endif #ifdef _WIN32 newPath = SystemTools::Statics->GetActualCaseForPathCached(newPath); SystemTools::ConvertToUnixSlashes(newPath); @@ -4702,10 +4708,11 @@ void SystemTools::ClassInitialize() // Create statics singleton instance SystemTools::Statics = new SystemToolsStatic; +#if KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP // Add some special translation paths for unix. These are not added // for windows because drive letters need to be maintained. Also, // there are not sym-links and mount points on windows anyway. -#if !defined(_WIN32) || defined(__CYGWIN__) +# if !defined(_WIN32) || defined(__CYGWIN__) // The tmp path is frequently a logical path so always keep it: SystemTools::AddKeepPath("/tmp/"); @@ -4743,6 +4750,7 @@ void SystemTools::ClassInitialize() } } } +# endif #endif } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index cdc9483a54d726cf3edbab7788dccdef152e56f6..dd1266beea60c4ef4ad49bcca3c031077aff6f84 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -891,6 +891,7 @@ public: */ static int GetTerminalWidth(); +#if @KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP /** * Add an entry in the path translation table. */ @@ -907,6 +908,7 @@ public: * Update path by going through the Path Translation table; */ static void CheckTranslationPath(std::string& path); +#endif /** * Delay the execution for a specified amount of time specified