cmakelists.txt不在根文件夹中(但包含在源中)
CMakeLists.txt is not in root folder (but is included in source)
我正在尝试编译一个libpng库。问题是我需要此库的特定版本-1.2.37-,因为我正在使用的项目是用此版本编写的。我在这里找到了此版本的源代码(gnuwin32项目)。
但是文件夹结构看起来像这样:
libpng-1.2.37-src/
contrib/
projects/
scripts/
CMakeLists.txt
png.h
pngread.c
pngwrite.c
...
参见,cmakelists.txt比源文件更深一个级别。
我尝试过:
- 源目录 libpng-1.2.37-src/ ->导致错误:源目录似乎不包含cmakelists.txt
- 源目录 libpng-1.2.37-src/scripts ->导致多个错误:文件libpng-1.2.37-src/scripts/scripts/scripts/libpng.pc.in不存在。
- 复制cmakelists.txt从/scripts 到/libpng-1.2.37-src ,并将源目录设置为/libpng-1.2.37-src ->导致错误:源:源"/libpng-1.2.37-src/cmakelists.txt"不匹配源"/libpng-1.2.37-src/scripts/scripts/cmakelists.cmakelists.txt"。
我该怎么做才能使它起作用?我不知道为什么不能使用cmakelists.txt文件。
INSTALL
文件明确说:
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
和附带说明,在此之前,它说安装它的经典方法是:
On Unix/Linux and similar systems, you can simply type
./configure [--prefix=/path]
make check
make install
听起来您对3),但是您忘了在尝试再次尝试之前清理构建。
如果它是您在项目中使用的库,则可以通过称为'Superbuild'的技术自动构建它(使用externalProject_add)。通过在此处指定source_subdir,用cmakelists.txt进行子目录。
ExternalProject_Add(libpng
GIT_REPOSITORY url-to-your-repository.git
GIT_TAG v1.2.37
SOURCE_SUBDIR "scripts"
相关文章:
- CMake 错误"源似乎不包含 CMakeLists.txt",路径/库连接问题
- 如何在 CMakeLists.txt Qt Creator 中包含头文件?
- CMakeList 中应包含哪些模块.txt以进行近似最近邻搜索?
- 在CMakeLists中包含目录的更好方法.txt
- 将 OpenSSL 包含在 CMakeList.txt 文件中
- 在 C++ 中包含库数据库.txt文件时出错
- 如何在 CMakeList 中包含 h/hpp 头文件.txt而不是 cpp 或其他 hpp 文件
- 字符串和输入文件,从包含字符串的 txt 文件中分配多个变量值
- cmake - 何时在 CMakeLists.txt 文件中包含include_directories
- C++ 读取包含多种变量的 txt 文件
- 如何使用"CMakeLists.txt"中的add_library将整个文件(.cpp,.h等)包含在目录中
- CMAKE 错误项目文件无效;不包含 cmakelists.txt
- cmakelists.txt不在根文件夹中(但包含在源中)
- CMakeLists.txt有两个子项目和自己的CMakeLists.txt只需要创建一个.so库,该库包含所有子项目
- C++程序将包含的.txt文件视为代码
- CMake-在顶级CMakeLists.txt中定义包含路径和库
- c++传递一个.txt文件,其中包含函数名和参数
- 似乎不包含CMakeLists.txt
- 在cmakelists.txt文件中包含外部库
- openv ubuntu 12.04 Cmake错误:源目录不包含CmakeLists.txt