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:
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 source directory is where the source code for the project is located. This is also where the CMakeLists files will be found. The binary directory is sometimes referred to as the build directory and is where CMake will put the resulting object files, libraries, and executables.
To add a library in CMake, use the add_library() command and specify which source files should make up the library. Rather than placing all of the source files in one directory, we can organize our project with one or more subdirectories.
CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With