install(RUNTIME_DEPENDENCY_SET) argument parsing broken when entity type is present
The following minimal project demonstrates the problem:
cmake_minimum_required(VERSION 3.21)
project(install_deps)
add_executable(app main.cpp)
install(TARGETS app RUNTIME_DEPENDENCY_SET depSet)
install(RUNTIME_DEPENDENCY_SET depSet
RUNTIME # Comment this line out and the error goes away
DESTINATION bin
PRE_EXCLUDE_REGEXES [[does_not_matter]]
)
Error that gets generated from the above:
CMake Error at CMakeLists.txt:7 (install):
install RUNTIME_DEPENDENCY_SET given unknown argument
"PRE_EXCLUDE_REGEXES".
The problem appears to be related to when RUNTIME
, LIBRARY
or ARCHIVE
is present in the set of options. It looks like the argument parsing associated with those three things don't recognise that any of the runtime dependency keywords like PRE_EXCLUDE_REGEXES
, POST_INCLUDE_REGEXES
and so on should end the set of arguments associated with RUNTIME
, LIBRARY
or ARCHIVE
. If you comment out the entity type like I noted in the example, the error goes away. But that isn't something you can or should always do. If the project needs to specify more than one entity type, there's no way to add any of the runtime dependency keywords (which must follow after all the entity type keywords to have any effect).
This bug appears to have been present from when the install(RUNTIME_DEPENDENCY_SET)
functionality was first added in CMake 3.21.