c++ - Cmake cannot find boost libraries; but includedir and librarydir are set -


i new c/c++, cmake, , boost; i've read every post in of other people having same problem , couldn't figure out.

edit: explained in comment, read another similar post, , i'm doing proposed in accepted solution (i.e. using components libraryname , set(boost_use_static_libs off). actually, putting boost_use_static_libs off removed "lib" prefix libraries name in argn parameter. , seem need prefix..

i built boost android bjam and, hoping have done correctly, used command:

./b2 install include=/home/myuser/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include include=/home/myuser/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include include=/home/myuser/android-ndk-r12b/platforms/android-19/arch-arm/usr/include toolset=gcc-arm target-os=android --prefix=/home/myuser/boost_build --with-system --with-random --with-date_time -sno_bzip2=1 link=static runtime-link=shared threading=multi 

and end folder structure:

/home/myuser/boost_build/     - include/         -boost/             - # lot of folders , .hpp files     - lib/         - libboost_date_time.a         - libboost_random.a         - libboost_system.a 

then launch cmake in order compile project command:

cmake -dboost_root=/home/myuser/boost_build -dboost_includedir=/home/myuser/boost_build/include -dboost_librarydir=/home/myuser/boost_build/lib -dboost_ver:string=1.61.0 ./ 

and revelant part of cmakelist.txt:

option(build_shared_libs "build shared library" off) #option(boost_use_static_libs "use boost static version" on) set(boost_use_static_libs on) #tried both of versions above, don't know difference  set(boost_ver "1.61.0") set(boost_version 106100)  set(boost_use_multithreaded on)  set(boost_use_static_runtime off)  set(boost_find_quietly 0 ) set(boost_debug 1)  find_package(boost ${boost_ver} required components system date_time random)  

finally, end error:

-- [ /usr/share/cmake-3.5/modules/findboost.cmake:1558 ] boost_found = 1 # e.d.: notice boost_found = 1. reading through findboost code, understand means found include directory header files. cmake error @ /usr/share/cmake-3.5/modules/findboost.cmake:1719 (message):   # e.d.: don't mind line numbers in findboost.cmake files... added lot of messages around, debug    unable find requested boost libraries.    boost version: 1.61.0    boost include path: /home/myuser/boost_build/include    not find following static boost libraries:            boost_system           boost_date_time           boost_random    no boost libraries found.  may need set boost_librarydir   directory containing boost libraries or boost_root location of   boost. call stack (most recent call first):   cmakelists.txt:48 (find_package) 

if try print find_library parameters, in findboost.cmake:

message(status "looking library: var: ${var} , dollarvar: ${${var}}, argn: ${argn}") find_library(${var} ${argn}) message(status "dollarvar: ${${var}}" ) 

i get:

-- looking library: var: boost_system_library_release , dollarvar: , argn: names;libboost_system-ghs-mt-1_61;libboost_system-ghs-mt;libboost_system-mt-1_61;libboost_system-mt;libboost_system;hints;/home/myuser/boost_build/lib;/home/myuser/boost_build/lib;/home/myuser/boost_build/stage/lib;/home/myuser/boost_build/include/lib;/home/myuser/boost_build/include/../lib;/home/myuser/boost_build/include/../lib/;/home/myuser/boost_build/include/stage/lib;paths;c:/boost/lib;c:/boost;/sw/local/lib;names_per_dir;doc;boost system library (release) -- dollarvar: boost_system_library_release-notfound 

edit2: tried copypaste boost_build directory , project directory linux windows, installed cmake too, , great annoyance... cmake under windows worked. unfortunately cmake under windows generates visual studio project files, instead of makefile. i'm wondering why cmake version 3.5.1 under ubuntu 16.04 doesn't work, , cmake version 3.6.2 under windows 7 does.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -