Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
改进 CMake 中 clock_gettime 的兼容性检查
方案一:最小化改动
在
CMakeLists.txt
中增加以下内容方案二:模块化改进
新增宏定义:
在
cmake/utils.cmake
中新增宏project_check_library_function
,用于检查特定库中的函数是否存在。该宏的定义如下:更新
CMakeLists.txt
:在
CMakeLists.txt
中使用新定义的宏来检查clock_gettime
函数是否存在于rt
库中:更新
hconfig.h.in
:修改
hconfig.h.in
文件,以支持新的检查结果:方案二更加遵循原cmake脚本的风格, 而当前提交的代码采用的是改动更小的方案一。