c++/c:从制造到cmake(Windows和Linux)迁移:平台特定的实现
我目前正在将200万个C ++/C代码线的项目迁移到使用CMAKE的项目。大多数事情都非常直截了当,但是我似乎找不到实现以下内容的最佳实践:
内核库中的许多低级别(旧版)组件都使用编译器警卫以以下形式区分Linux和Windows实现:
#ifdef WINDOWS
// #include ...
#else
// #include ...
#endif
和/或:
void lowLevelFunction()
{
#ifdef WINDOWS
// Windows implementation
return;
#else
// Linux implementation
return;
#endif
}
在CMake或以某种方式委托上这样做有最好的做法吗?
谢谢
I'm currently migrating a project of 2 million C++/C code lines from Makefiles to using Cmake. Most things are pretty straight forward, but I can't seem to find the best practice to achieve the following:
Many low level (legacy) components in my kernel library use compiler guards to differentiate between the Linux and Windows implementations in the following form:
#ifdef WINDOWS
// #include ...
#else
// #include ...
#endif
and/or:
void lowLevelFunction()
{
#ifdef WINDOWS
// Windows implementation
return;
#else
// Linux implementation
return;
#endif
}
Is there a best practice to do this on Cmake or to somehow delegate?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论