summaryrefslogtreecommitdiff
path: root/Source/cmSearchPath.h
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2014-10-15 16:36:42 -0400
committerChuck Atkins <chuck.atkins@kitware.com>2014-11-11 13:39:51 -0500
commit2a9ac4bd83f7247539616545ef0772fea1f4a1fc (patch)
treea8b99f4caa8522d130b93727a9a345865f2ac35f /Source/cmSearchPath.h
parent32922840e7ea8a0536fec393352ede5b75087543 (diff)
downloadcmake-2a9ac4bd83f7247539616545ef0772fea1f4a1fc.tar.gz
Encapsulate search path manipulation functions into a seperate class.
The functions for adding the various different types of paths have been factored out into a new class, cmSearchPath. It is to be used as a helper container class for the various find_* commands.
Diffstat (limited to 'Source/cmSearchPath.h')
-rw-r--r--Source/cmSearchPath.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
new file mode 100644
index 0000000000..88ef0ff25f
--- /dev/null
+++ b/Source/cmSearchPath.h
@@ -0,0 +1,60 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmSearchPath_h
+#define cmSearchPath_h
+
+#include "cmStandardIncludes.h"
+
+class cmFindCommon;
+
+/** \class cmSearchPath
+ * \brief Base class for FIND_XXX implementations.
+ *
+ * cmSearchPath is a container that encapsulates search path construction and
+ * management
+ */
+class cmSearchPath
+{
+public:
+ cmSearchPath(cmFindCommon* findCmd, const std::string& groupLabel);
+ ~cmSearchPath();
+
+ const std::string& GetLabel() const { return this->Label; }
+ const std::vector<std::string>& GetPaths() const { return this->Paths; }
+
+ void ExtractWithout(const std::set<std::string>& ignore,
+ std::vector<std::string>& outPaths,
+ bool clear = false) const;
+
+ void AddPath(const std::string& path);
+ void AddUserPath(const std::string& path);
+ void AddCMakePath(const std::string& variable);
+ void AddEnvPath(const std::string& variable);
+ void AddCMakePrefixPath(const std::string& variable);
+ void AddEnvPrefixPath(const std::string& variable);
+ void AddSuffixes(const std::vector<std::string>& suffixes);
+
+protected:
+ void AddPrefixPaths(const std::vector<std::string>& paths,
+ const char *base = 0);
+ void AddPathInternal(const std::string& path, const char *base = 0);
+
+ // Members collected from the calling find command
+ const std::string& FindName;
+ cmMakefile* const& Makefile;
+ std::set<std::string>& Emitted;
+
+ std::string Label;
+ std::vector<std::string> Paths;
+};
+
+#endif