CMake哈希在文件名 [英] CMake Hash in File Name

查看:62
本文介绍了CMake哈希在文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的cpp文件名中包含哈希/磅/尖音(#)时,出现类似于

When I have hashes/pounds/sharps (#) in my cpp filenames, I get errors similar to

Makefile:22669: warning: overriding recipe for target '.PHONY'
Makefile:22660: warning: ignoring old recipe for target '.PHONY'
Makefile:22678: warning: overriding recipe for target '.PHONY'
Makefile:22669: warning: ignoring old recipe for target '.PHONY'
Makefile:32887: *** missing separator.  Stop.

即使生成的Makefile似乎只有178行.除了不使用文件名中的#字符外,还有什么方法可以防止这种情况?
seimicolons(; )似乎也导致了此问题

even though the generated Makefile seems to be only 178 lines long. Is there any way to prevent this other than not using the # character in my file names?
seimicolons (;) seem to cause this problem as well

推荐答案

我在CMake生成的文件名中包含未转义的#的文件时遇到了类似的问题,结果是:

I was running into a similar issue with CMake generated files containing unescaped # in filenames, resulting in:

====================[ Build | MyAppDebug | Debug ]==========================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/<user>/MyApp/cmake-build-debug --target MyAppDebug -- -j 8
CMakeFiles/MyAppDebug.dir/build.make:4112: *** missing separator.  Stop.
make[2]: *** [CMakeFiles/MyAppDebug.dir/all] Error 2
make[1]: *** [CMakeFiles/MyAppDebug.dir/rule] Error 2
make: *** [MyAppDebug] Error 2

对我来说,此问题已在CMake 1.18.0版中修复.(在macOSX上)因此我将其添加到了CMake文件中:

For me, this was fixed in CMake version 1.18.0. (on macOSX) So I added this to my CMake file:

cmake_minimum_required(VERSION 3.18)

这篇关于CMake哈希在文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆