Il 07/06/2017 14:23, Noel O'Boyle ha scritto:
Does it work if you define -DOPENBABEL2_INCLUDE_DIR and
-DOPENBABEL2_LIBRARIES directly?

I note that very few of the Find modules that come with CMake actually
use this variable. It's usually handled indirectly by pkgconfig via
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=TRUE. I haven't tested whether this
fixes it for you, but I don't think it's a bug at our end, or a
feature we will implement.

Thanks for your help. I finally succeeded using -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=TRUE, with just a small addition: I need to export `~/opt` to both `LIBRARY_PATH` and `LD_LIBRARY_PATH`.

Setting -DOPENBABEL2_INCLUDE_DIR and -DOPENBABEL2_LIBRARIES on the other hand doesn't work. What should I set those to?

cmake -DOPENBABEL2_INCLUDE_DIR=/home/davide/opt/include/openbabel-2.0/ -DOPENBABEL2_LIBRARIES=/home/davide/opt/lib/ ..
-- Found OpenBabel 2.2 or later: /home/davide/opt/lib
-- openbabel include dir: /usr/include/openbabel-2.0
-- openbabel 2 libraries /home/davide/opt/lib
-- Configuring done
WARNING: Target "ob24api" requests linking to directory "/home/davide/opt/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/davide/progetti/ob24api/build



The compilation fails with the following error



davide@davide-MS-7850:~/progetti/ob24api/build$ LC_ALL=C make
[ 50%] Linking CXX executable ob24api
CMakeFiles/ob24api.dir/main.cpp.o: In function `main':
main.cpp:(.text+0x26): undefined reference to `OpenBabel::OBAtom::OBAtom()'
main.cpp:(.text+0x35): undefined reference to `OpenBabel::OBMol::OBMol()'
main.cpp:(.text+0x4e): undefined reference to `OpenBabel::OBConversion::OBConversion(std::istream*, std::ostream*)' main.cpp:(.text+0x62): undefined reference to `OpenBabel::OBConversion::SetOutFormat(char const*)' main.cpp:(.text+0x76): undefined reference to `OpenBabel::OBAtom::SetType(char const*)' main.cpp:(.text+0x91): undefined reference to `OpenBabel::OBAtom::SetVector(double, double, double)' main.cpp:(.text+0xaa): undefined reference to `OpenBabel::OBMol::AddAtom(OpenBabel::OBAtom&)' main.cpp:(.text+0xbe): undefined reference to `OpenBabel::OBConversion::~OBConversion()'
main.cpp:(.text+0xcd): undefined reference to `OpenBabel::OBMol::~OBMol()'
main.cpp:(.text+0xdc): undefined reference to `OpenBabel::OBAtom::~OBAtom()'
main.cpp:(.text+0x101): undefined reference to `OpenBabel::OBConversion::~OBConversion()'
main.cpp:(.text+0x115): undefined reference to `OpenBabel::OBMol::~OBMol()'
main.cpp:(.text+0x129): undefined reference to `OpenBabel::OBAtom::~OBAtom()'
collect2: error: ld returned 1 exit status
CMakeFiles/ob24api.dir/build.make:94: recipe for target 'ob24api' failed
make[2]: *** [ob24api] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ob24api.dir/all' failed
make[1]: *** [CMakeFiles/ob24api.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to