简体   繁体   English

检测文件是否在安装目录中被覆盖

[英]Detect if files are overridden in the installation directory

I'm configuring a CMake project from source and build and install it with make , ie, 我正在从源代码配置CMake项目,并使用make构建和安装它,即,

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

I noticed now that the project is badly configured in that it contains numerous files with the same name that get overridden in the installation directory, eg, /usr/local/include/mystring.h gets written to more than once by make install . 我现在注意到,该项目配置不当,因为它包含多个具有相同名称的文件,这些文件在安装目录中被覆盖,例如, /usr/local/include/mystring.hmake install多次写入。

Is there a systematic way to detect if files are overridden within the same project? 是否有系统的方法来检测文件是否在同一项目中被覆盖?

Well, you can wrap install() calls into your own function, which would store all installed files in cache list variable and check for existing item before actually call install() . 好了,您可以将install()调用包装到自己的函数中,该函数会将所有已安装的文件存储在缓存列表变量中,并在实际调用install()之前检查现有项。

You may also check ${PROJECT_BINARY_DIR}/install_manifest.txt file - maybe it would contain duplicates in your case. 您还可以检查${PROJECT_BINARY_DIR}/install_manifest.txt文件-可能包含重复的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM