I'm trying to use this library in my source code. I can't show you my code base, so I made a simple hello world project that tries to utilize this library. Following the instructions to install the library using CMake works perfectly, fine, the problem is I'm trying to put it into my project directory and compile it from there using my own CmakeLists.txt.
Here is the library download: ftp://ftp.unidata.ucar.edu/pub/udunits/
I'm using udunits-2.2.26.tar.gz
This is my project structure:
proj/
|-- CMakeLists.txt
|-- ext
| `-- udunits-2.2.26/
`-- src
`-- main.cpp
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
project(proj)
add_subdirectory("ext/udunits-2.2.26")
add_executable(app src/main.cpp)
install(TARGETS app DESTINATION bin)
My main.cpp:
#include <iostream>
int main() {
std::cout << "Hello World" << std::endl;
return 0;
}
What I'm doing is I'm making a build/ directory within proj and calling CMake like so: ccmake ..
I run the configuration, then generate the files, and finally I call make.
Here is my output:
[ 8%] Built target app
Scanning dependencies of target udunits2_doc
[ 13%] Built target udunits2_doc
Scanning dependencies of target udunits2lib_doc
make[2]: *** No rule to make target `../COPYRIGHT', needed by `../ext/udunits-2.2.26/lib/udunits2lib.info'. Stop.
make[1]: *** [ext/udunits-2.2.26/lib/CMakeFiles/udunits2lib_doc.dir/all] Error 2
make: *** [all] Error 2
There's a COPYRIGHT file in the library that contains the license details for this library. Their CMake checks to see if it exists. I'm not sure why I'm having issues compiling it adding it into my own CMakeLists as a sub directory.
If I grep all the make files for COPYRIGHT and remove all dependencies to it, it compiles just fine. So it's something to do with the .texi files depending on it, and I'm not sure how to fix this.
I've spent all day googling and trying different things, I'd appreciate any help! Thanks!
转载于:https://stackoverflow.com/questions/53111095/no-rule-to-make-target-using-cmake-to-add-a-library-library-compiles-just-fine