【问题标题】:Detect if files are overridden in the installation directory检测安装目录中的文件是否被覆盖
【发布时间】:2014-07-28 08:45:13
【问题描述】:

我正在从源代码配置一个 CMake 项目并使用 make 构建和安装它,即,

$ ls
./build/  ./source/
$ cd build/
$ cmake ../source/
[...]
$ make
[...]
$ make install
[...]

我现在注意到该项目配置错误,因为它包含许多同名的文件,这些文件在安装目录中被覆盖,例如,/usr/local/include/mystring.h 被make install 多次写入。

是否有系统的方法来检测同一项目中的文件是否被覆盖?

【问题讨论】:

    标签: installation makefile cmake automake


    【解决方案1】:

    好吧,您可以将 install() 调用包装到您自己的函数中,该函数会将所有已安装的文件存储在缓存列表变量中,并在实际调用 install() 之前检查现有项目。

    您也可以检查 ${PROJECT_BINARY_DIR}/install_manifest.txt 文件 - 在您的情况下它可能包含重复项。

    【讨论】:

    • 使用 sort install_manifest.txt | uniq --count --repeated 检查安装清单中是否存在重复的行。
    猜你喜欢
    • 1970-01-01
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    • 2021-12-15
    • 2015-02-10
    • 1970-01-01
    • 2016-10-01
    • 1970-01-01
    相关资源
    最近更新 更多