使cmake在Windows 7上的Cygwin下工作

时间:2018-09-10 13:35:18

标签: windows cmake cygwin

我在Windows 7机器上安装了最新的Cygwin:版本2.893(64位)。我确定我包含了cmake,即在执行首次安装后,通过再次运行Cygwin net release安装程序能够添加多个软件包。然后,我尝试使用cmake并确保我从bin目录中调用了它:

user008@L0147816 /bin
$ ./cmake
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
//share/cmake-3.6.2
Usage

cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

我不知道构建目录可能在哪里。我对Cygwin比较陌生。我希望有人找到了一种在Cygwin下安装cmake并正常工作的解决方案。

1 个答案:

答案 0 :(得分:0)

这看起来是cmake 101。

假设您只想从某个位置构建软件下载 例如gl2ps:

# choosing a test area
$ cd /tmp
# downloading source
$ wget http://geuz.org/gl2ps/src/gl2ps-1.4.0.tgz
# expanding source code
$ tar -xf gl2ps-1.4.0.tgz
$ ls gl2ps-1.4.0-source/
CMakeLists.txt  COPYING.LGPL  gl2ps.h    gl2ps.tex    gl2psTestSimple.c
COPYING.GL2PS   gl2ps.c       gl2ps.pdf  gl2psTest.c  README.txt
# preparing a build area
$ mkdir build
$ cd build
# invoking cmake and pointing to the source directory 
$ cmake ../gl2ps-1.4.0-source/
-- The C compiler identification is GNU 7.3.0
[cut ...]
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build

# running the build 
$ make
Scanning dependencies of target shared
[ 11%] Building C object CMakeFiles/shared.dir/gl2ps.o
...
[ 88%] Building C object CMakeFiles/gl2psTestSimple.dir/gl2psTestSimple.o
[100%] Linking C executable gl2psTestSimple.exe
[100%] Built target gl2psTestSimple

代替学习如何使用cmake进行构建,请转到 https://cmake.org/cmake-tutorial/