首页 > 解决方案 > CMake:本地化格式的时间戳

问题描述

同事们,能否告诉我是否可以在 CMake 中以本地化格式和本地化语言接收 TIMESTAMP?

我还没有找到字符串(TIMESTAMP)的此类选项。

标签: cmaketimestamplocale

解决方案


是否可以在 CMake 中以本地化格式和本地化语言接收 TIMESTAMP?

不,cmakestring(TIMESTAMP <format_string不允许使用%c strftime说明符。因为在 C99%c中是必需的,所以我相信在 cmake 源中支持它所需的唯一更改是添加cmTimestamp.cxx 。我认为您也可以调用并将结果传递给.strftime case 'c':locale d_t_fmtstring(TIMESTAMP "${the_result}"

只需使用外部程序。在 linux 上,您只需调用dateexecute_process捕获它的输出。


推荐阅读