mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 15:18:26 -05:00
f2bdc2176f
We would like to record additional information in the find-package stack, but we don't have the information at the point a stack entry is created. The most sane way to handle this appears to be making the stack mutable, at least under specific circumstances. To facilitate this, we need a mutable stack type. Refactor cmConstStack into cmStack, with the ability to either allow or forbid mutation of its data. Re-add cmConstStack as a type alias. This doesn't yet allow mutating cmFindPackageStack, but it's a necessary step toward being able to do so.
35 lines
796 B
C++
35 lines
796 B
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "cmStack.h"
|
|
|
|
/**
|
|
* Represents one call to find_package.
|
|
*/
|
|
class cmFindPackageCall
|
|
{
|
|
public:
|
|
std::string Name;
|
|
unsigned int Index;
|
|
};
|
|
|
|
/**
|
|
* Represents a stack of find_package calls with efficient value semantics.
|
|
*/
|
|
class cmFindPackageStack
|
|
: public cmConstStack<cmFindPackageCall, cmFindPackageStack>
|
|
{
|
|
using cmStack::cmStack;
|
|
friend cmFindPackageStack::Base;
|
|
};
|
|
#ifndef cmFindPackageStack_cxx
|
|
extern template class cmStack<cmFindPackageCall const, cmFindPackageStack,
|
|
cmStackType::Const>;
|
|
#endif
|