cmake-CMakeLists.txt不在根文件夹中(但包含在源代码中) [英] cmake - CMakeLists.txt is not in root folder (but is included in source)

查看:1488
本文介绍了cmake-CMakeLists.txt不在根文件夹中(但包含在源代码中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译一个libpng库。问题是我需要该库的特定版本-1.2.37-因为我正在使用该库的项目是与此版本一起编写的。
我已经在此处(GnuWin32项目)找到了该版本的源代码。



但是文件夹结构看起来像这样:

  libpng-1.2.37- src / 
contrib /
项目/
脚本/
CMakeLists.txt
png.h
pngread.c
pngwrite.c
...

请参阅CMakeLists.txt比源文件深一层。 / p>

我尝试过:


  1. 源目录 libpng-1.2。 37-src / ->导致错误:源目录似乎不包含CMakeLists.txt

  2. 源目录 libpng-1.2.37-src / scripts ->导致多个错误:文件libpng-1.2.37-src / scripts / scripts / libpng.pc.in不存在。

  3. 从<复制CMakeLists.txt em> / scripts 更改为 /libpng-1.2.37-src ,并将源目录设置为 /libpng-1.2.37-src -> r导致错误:源 /libpng-1.2.37-src/CMakeLists.txt与用于生成缓存的源 /libpng-1.2.37-src/scripts/CMakeLists.txt不匹配。

我应该怎么做才能使其正常工作?我不知道为什么不能使用CMakeLists.txt文件。

解决方案

INSTALL 文件明确表示:

 如果要使用 cmake(请参见www.cmake.org),将脚本目录中的CMakeLists.txt 
复制到此目录,然后输入

cmake。 [-DPNG_MMX = YES] -DCMAKE_INSTALL_PREFIX = /路径
make
make install

另外,在此之前,它说经典的安装方式是:

 在Unix / Linux和类似系统上系统,只需键入

./configure [--prefix = / path]
进行检查
进行安装

听起来好像您对3)做得正确,但是您忘记了再次清理构建目录的经验。


I'm trying to compile a libpng library. The thing is that I need a specific version of this library - 1.2.37 - because the project I'm using it in is written with this version. I've found the source code of this version here (GnuWin32 project).

But the folder structure looks something like this:

libpng-1.2.37-src/
   contrib/
   projects/
   scripts/
      CMakeLists.txt
   png.h
   pngread.c
   pngwrite.c
   ...

See, the CMakeLists.txt is one level deeper than the source files.

I've tried:

  1. source directory libpng-1.2.37-src/ -> resulted in error: The source directory does not appear to contain CMakeLists.txt
  2. source directory libpng-1.2.37-src/scripts -> resulted in multiple errors: File libpng-1.2.37-src/scripts/scripts/libpng.pc.in does not exist.
  3. copy CMakeLists.txt from /scripts to /libpng-1.2.37-src and set source directory to /libpng-1.2.37-src -> resulted in error: The source "/libpng-1.2.37-src/CMakeLists.txt" does not match the source "/libpng-1.2.37-src/scripts/CMakeLists.txt" used to generate cache.

What should I do to make it work? I don't know why the CMakeLists.txt file would be included if it can't be used.

解决方案

The INSTALL file explicitely says:

If you want to use "cmake" (see www.cmake.org), copy CMakeLists.txt
from the "scripts" directory to this directory and type

   cmake . [-DPNG_MMX=YES] -DCMAKE_INSTALL_PREFIX=/path
   make
   make install

And as a side note, before this it says that the classic way to install it is:

On Unix/Linux and similar systems, you can simply type

    ./configure [--prefix=/path]
    make check
    make install

It sounds like you did right with 3), however you forgot to cleanup the build dir before trying again.

这篇关于cmake-CMakeLists.txt不在根文件夹中(但包含在源代码中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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