install: Add TYPE LIBEXEC for FILES and DIRECTORY

Signed-off-by: Chen Linxuan <me@black-desk.cn>
This commit is contained in:
Chen Linxuan
2024-09-13 16:50:04 +08:00
committed by Brad King
parent d6e03018cb
commit 39603a7e5c
7 changed files with 32 additions and 1 deletions

View File

@@ -568,6 +568,7 @@ Signatures
``LOCALE`` ``${CMAKE_INSTALL_LOCALEDIR}`` ``<DATAROOT dir>/locale``
``MAN`` ``${CMAKE_INSTALL_MANDIR}`` ``<DATAROOT dir>/man``
``DOC`` ``${CMAKE_INSTALL_DOCDIR}`` ``<DATAROOT dir>/doc``
``LIBEXEC`` ``${CMAKE_INSTALL_LIBEXECDIR}`` ``libexec``
======================= ================================== =========================
Projects wishing to follow the common practice of installing headers into a
@@ -606,6 +607,9 @@ Signatures
use "generator expressions" with the syntax ``$<...>``. See the
:manual:`cmake-generator-expressions(7)` manual for available expressions.
.. versionadded:: 3.31
The ``TYPE`` argument now supports type ``LIBEXEC``.
.. signature::
install(DIRECTORY <dir>... [...])
@@ -720,6 +724,7 @@ Signatures
``LOCALE`` ``${CMAKE_INSTALL_LOCALEDIR}`` ``<DATAROOT dir>/locale``
``MAN`` ``${CMAKE_INSTALL_MANDIR}`` ``<DATAROOT dir>/man``
``DOC`` ``${CMAKE_INSTALL_DOCDIR}`` ``<DATAROOT dir>/doc``
``LIBEXEC`` ``${CMAKE_INSTALL_LIBEXECDIR}`` ``libexec``
======================= ================================== =========================
Note that some of the types' built-in defaults use the ``DATAROOT`` directory as
@@ -743,6 +748,9 @@ Signatures
The list of ``dirs...`` given to ``DIRECTORY`` may use
"generator expressions" too.
.. versionadded:: 3.31
The ``TYPE`` argument now supports type ``LIBEXEC``.
.. signature::
install(SCRIPT <file> [...])
install(CODE <code> [...])

View File

@@ -0,0 +1,5 @@
install-type-libexec
--------------------
* The :command:`install(FILES)` and :command:`install(DIRECTORY)` commands'
``TYPE`` argument gained support for a ``LIBEXEC`` type.

View File

@@ -136,6 +136,8 @@ public:
const cmInstallCommandArguments* args) const;
std::string GetManDestination(const cmInstallCommandArguments* args) const;
std::string GetDocDestination(const cmInstallCommandArguments* args) const;
std::string GetProgramExecutablesDestination(
const cmInstallCommandArguments* args) const;
std::string GetDestinationForType(const cmInstallCommandArguments* args,
const std::string& type) const;
@@ -291,7 +293,7 @@ void AddInstallRuntimeDependenciesGenerator(
std::set<std::string> const allowedTypes{
"BIN", "SBIN", "LIB", "INCLUDE", "SYSCONF",
"SHAREDSTATE", "LOCALSTATE", "RUNSTATE", "DATA", "INFO",
"LOCALE", "MAN", "DOC",
"LOCALE", "MAN", "DOC", "LIBEXEC",
};
template <typename T>
@@ -2591,6 +2593,12 @@ std::string Helper::GetDocDestination(
this->GetDataRootDestination(nullptr) + "/doc");
}
std::string Helper::GetProgramExecutablesDestination(
const cmInstallCommandArguments* args) const
{
return this->GetDestination(args, "CMAKE_INSTALL_LIBEXECDIR", "libexec");
}
std::string Helper::GetDestinationForType(
const cmInstallCommandArguments* args, const std::string& type) const
{
@@ -2636,6 +2644,9 @@ std::string Helper::GetDestinationForType(
if (type == "DOC") {
return this->GetDocDestination(nullptr);
}
if (type == "LIBEXEC") {
return this->GetProgramExecutablesDestination(nullptr);
}
return "";
}

View File

@@ -14,6 +14,9 @@ set(_check_files
[[lib]]
[[lib/dir]]
[[lib/dir/empty\.txt]]
[[libexec]]
[[libexec/dir]]
[[libexec/dir/empty\.txt]]
[[sbin]]
[[sbin/dir]]
[[sbin/dir/empty\.txt]]

View File

@@ -11,3 +11,4 @@ install(DIRECTORY dir TYPE INFO)
install(DIRECTORY dir TYPE LOCALE)
install(DIRECTORY dir TYPE MAN)
install(DIRECTORY dir TYPE DOC)
install(DIRECTORY dir TYPE LIBEXEC)

View File

@@ -9,6 +9,8 @@ set(_check_files
[[include/main\.c]]
[[lib]]
[[lib/main\.c]]
[[libexec]]
[[libexec/main\.c]]
[[sbin]]
[[sbin/main\.c]]
[[share]]

View File

@@ -11,3 +11,4 @@ install(FILES main.c TYPE INFO)
install(FILES main.c TYPE LOCALE)
install(FILES main.c TYPE MAN)
install(FILES main.c TYPE DOC)
install(FILES main.c TYPE LIBEXEC)