0

我有一个 CMakeLists.txt,我在其中按特定顺序复制文件,但执行顺序似乎是随机的:

#First Installation
   install(DIRECTORY ${SIT_AW_FIRST_WORKSPACE_DIR}/ DESTINATION ${WS_DESTINATION_DIR})

#Second Installation that should overwrite a subset of files
   install(DIRECTORY ${SIT_AW_SECOND_WORKSPACE_DIR}/ DESTINATION ${WS_DESTINATION_DIR})


Output :


-- Installing: /opt/FOO/share/baz/xml/Login.xml

-- Up-to-date: /opt/FOO/share/baz/xml/Login.xml

第二个文件不会覆盖第一个文件,因为它们具有相同的时间戳和相同的名称,但它们的大小不同。有没有办法强制复制?

4

1 回答 1

0

我认为通过使用 PATTERN 和 EXCLUDE 选项而不是尝试用另一个文件覆盖一个文件,您可能会获得更好的成功。你可以尝试这样的事情:

#First Installation
install(DIRECTORY ${SIT_AW_FIRST_WORKSPACE_DIR}/ DESTINATION ${WS_DESTINATION_DIR}
        PATTERN "Login.xml" EXCLUDE)

#Second Installation that should overwrite a subset of files
install(DIRECTORY ${SIT_AW_SECOND_WORKSPACE_DIR}/ DESTINATION ${WS_DESTINATION_DIR})

您可以在此处阅读 CMake 文档以及此处的详细信息: https ://cmake.org/cmake/help/v3.18/command/install.html#installing-directories

于 2021-06-15T16:05:29.163 回答