[FEAT] Add Genex $<PATH:...> for paths manipulations
Currently, there is no possibility to handle paths in the context of the generator expressions, as already noticed in #23409 (closed).
The idea is to offer similar capabilities to cmake_path()
command for genex: $<PATH:action,path>
.
Possible values for action
will be globally the same as cmake_path()
command:
- Decomposition:
GET_ROOT_NAME
, GET_ROOT_DIRECTORY,
GET_FILENAME`, etc... - Query:
HAS_ROOT_HANE
,HAS_ROOT_DIRECTORY
,HAS_FILENAME
, etc... - Modification:
REMOVE_FILENAME
,REPLACE_FILENAME
, etc... - Generation:
NORMAL_PATH
,RELATIVE_PATH
, etc... - Conversions:
NATIVE_PATH
,TO_CMAKE_PATH_LIST
, etc...
For some actions, an option can be specified as part of arguments of the genex: $<PATH:action,[option,]path
. For example: $<PATH:GET_EXTENSION,LAST_ONLY,/path/to/file>
.
For some other actions, multiple paths are expected: ``$<PATH:action,[option,]path1[,path2,...]. For example:
$PATH:IS_PREFIX,/path/to/file,/prefix/dir` or `$PATH:IS_PREFIX,NORMALIZE,/path/to/file,/prefix/dir`.
For cmake_path(COMPARE)
, maybe the genex $<PATH_EQUAL>
is more appropriate than $<PATH:COMPARE,EQUAL,...>
to be consistent with $<STREQUAL>
and $<VERSION_EQUAL>
.