Cygwin + CMake 测试

时间:2022-02-16 15:14:30

https://www.cygwin.com/

apt-get for cygwin?
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Now that apt-cyg is installed. Here are few examples of installing some packages:
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates

Open Cygwin at a specific folder:
chere -i -t mintty


https://zh.wikibooks.org/wiki/CMake_%E5%85%A5%E9%96%80/%E7%B0%A1%E5%96%AE%E7%9A%84%E7%AF%84%E4%BE%8B

main.c:
#include <stdio.h>
int main()
{
printf("hello world. \n");
}

CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
project(ex1)
add_executable(ex1 main.c)

1. 转到目标生成目录:
cd ex1_build_cygwin
2. 生成Makefile:
$ cmake -G "Unix Makefiles" path_of_src
3. make
4. 执行
./ex1.exe

$ cmake -G "MSYS Makefiles"
cmake -G "Visual Studio 9 2008"