如何从linux makefile制作cmakefile.txt [英] How to make cmakefile.txt from linux makefile

查看:426
本文介绍了如何从linux makefile制作cmakefile.txt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们! 
我想在windows系统上编译一个开源的c ++项目。
但是这个项目是配置linux cpp,h文件和配置文件,如'configure','Makefile','Makefile.am','Makefile.in'等等。
谢谢。





我的尝试:



要在Windows上编译,我尝试使用cmake,但失败了。 
我使用vs2013。
我没有cmakefile.txt文件。

解决方案

没有现成的转换。但在尝试编译之前,您应该检查是否可以为Windows构建源代码。这应该在文档中的某处说明。



如果它是一个相当简单的项目,只需创建一个新的控制台或DLL项目(取决于源的类型) ,将现有的源文件和头文件添加到该文件中,并且(对于控制台项目)将代码从Linux源 main 函数移动到VS生成的主源文件。因为Linux使用UTF-8,所以需要创建ANSI构建而不是Unicode构建。要将项目转换为Unicode,必须为所有字符串文字加前缀,并且所有接受< code> char *字符串的函数调用必须由Unicode或TCHAR版本替换。



或者(对于更复杂的项目)安装所需Linux工具的Windows版本并将其用于构建(例如使用Cygwin [ ^ ])。

Hi, friends!
I want to compile a open source c++ project on windows system.
But this project is configured linux cpp, h files and configure files such as 'configure', 'Makefile', 'Makefile.am', 'Makefile.in' and so on.
Thanks.



What I have tried:

To compile on windows, I tried to use cmake, but failed.
I use vs2013.
I have not cmakefile.txt file.

解决方案

There is no ready-to-use conversion. But before trying to compile you should check if the source can be build for Windows. That should be stated somewhere in the documentation.

If it is a rather simple project, just create a new console or DLL project (depends on the type of the source), add the existing source and header files to that, and (for console projects) move the code from the Linux source main function to the VS generated main source file. Because Linux uses UTF-8, you need to create an ANSI build instead of a Unicode build. To convert the project to Unicode, all string literals have to be prefixed and all function calls accepting <code>char* strings has to be replaced by the Unicode or TCHAR version.

Alternatively (and for more complex projects) install the Windows versions of the required Linux tools and use that for building (e.g. using Cygwin[^] ).


这篇关于如何从linux makefile制作cmakefile.txt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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