diff options
author | Craig Scott <craig.scott@crascit.com> | 2023-06-02 07:16:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-06-05 10:20:50 (GMT) |
commit | 99b2ccf80dc87ccf6832508cc3f8889a70c2785f (patch) | |
tree | 6ff990a8878c0e90ee9c5b88ce876f7893e5c882 /Source/cmFileAPI.h | |
parent | 9a63aa8d57394fbddf913ce35c2d32bbf523f0e6 (diff) | |
download | CMake-99b2ccf80dc87ccf6832508cc3f8889a70c2785f.zip CMake-99b2ccf80dc87ccf6832508cc3f8889a70c2785f.tar.gz CMake-99b2ccf80dc87ccf6832508cc3f8889a70c2785f.tar.bz2 |
cmake_file_api: New project command
Projects can use the new command to request file API replies for the current
run. No query files are generated, the query is tracked internally. Replies are
created in the file system at generation time in the usual way.
Fixes: #24951
Diffstat (limited to 'Source/cmFileAPI.h')
-rw-r--r-- | Source/cmFileAPI.h | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h index 6d7678f..1c13d7b 100644 --- a/Source/cmFileAPI.h +++ b/Source/cmFileAPI.h @@ -41,6 +41,20 @@ public: /** Report file-api capabilities for cmake -E capabilities. */ static Json::Value ReportCapabilities(); + // Keep in sync with ObjectKindName. + enum class ObjectKind + { + CodeModel, + ConfigureLog, + Cache, + CMakeFiles, + Toolchains, + InternalTest + }; + + bool AddProjectQuery(ObjectKind kind, unsigned majorVersion, + unsigned minorVersion); + private: cmake* CMakeInstance; @@ -53,17 +67,6 @@ private: static std::vector<std::string> LoadDir(std::string const& dir); void RemoveOldReplyFiles(); - // Keep in sync with ObjectKindName. - enum class ObjectKind - { - CodeModel, - ConfigureLog, - Cache, - CMakeFiles, - Toolchains, - InternalTest - }; - /** Identify one object kind and major version. */ struct Object { @@ -76,6 +79,14 @@ private: } return l.Version < r.Version; } + friend bool operator==(Object const& l, Object const& r) + { + return l.Kind == r.Kind && l.Version == r.Version; + } + friend bool operator!=(Object const& l, Object const& r) + { + return !(l == r); + } }; /** Represent content of a query directory. */ |