[CMake] newbie: find_package Boost ceases to work when mixed with CLang CMAKE_TOOLCHAIN_FILE (on Ubuntu 64bit Quantal 12.10)

ahoros ah at zunit.com
Fri Dec 28 19:08:16 EST 2012


I must be missing something very, very obvious about default paths - but I
think I tried every possible option...
I have following cmake commands:

    SET(CMAKE_INCLUDE_PATH
${CMAKE_INCLUDE_PATH};/usr/include/;/usr/local/include/;/usr/include/boost/)
    SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH};/usr/lib/;/usr/)
    set(BOOST_INCLUDEDIR /usr/include/)
    set(BOOST_LIBRARYDIR /usr/lib/)

    SET(Boost_DEBUG 1)
    SET(Boost_DETAILED_FAILURE_MSG TRUE)
    SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0" "1.48" "1.48.0" "1.49"
"1.49.0" "1.50" "1.50.0" "1.51" "" "1.51.0")
    SET(Boost_USE_STATIC_LIBS ON)
    SET(Boost_USE_MULTITHREAD ON)
    find_package(Boost REQUIRED COMPONENTS serialization filesystem
date_time system thread)


and it works on standard gcc toolchain:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:707 ]  
_boost_INCLUDE_SEARCH_DIRS =
/usr/include/boost;C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
(...)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:734 ] location of
version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:753 ] version.hpp reveals
boost 1.50.0
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:785 ] guessed
_boost_COMPILER = -gcc47
(...)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:883 ]
_boost_LIBRARY_SEARCH_DIRS =
/usr/lib;/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;C:/boost/lib;C:/boost;/boost/boost_1_50_0/lib;/boost/boost_1_50/lib;/boost/lib;/boost;/sw/local/lib
(....)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for
THREAD_LIBRARY_RELEASE:
boost_thread-gcc47-mt-1_50;boost_thread-gcc47-mt;boost_thread-mt-1_50;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for
THREAD_LIBRARY_DEBUG:
boost_thread-gcc47-mt-d-1_50;boost_thread-gcc47-mt-d;boost_thread-mt-d-1_50;boost_thread-mt-d;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1107 ] Boost_FOUND = TRUE
-- Boost version: 1.50.0



However,  I have prepared toolchain module file for clang:
INCLUDE(CMakeForceCompiler) #Disables checks
SET(CMAKE_SYSTEM_NAME Generic)

CMAKE_FORCE_C_COMPILER( /usr/bin/clang CLang )
CMAKE_FORCE_CXX_COMPILER ( /usr/bin/clang++ CLang )

SET(CMAKE_C_LINK_EXECUTABLE "/usr/bin/llvm-ld <OBJECTS> -o  <TARGET>
<CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_LINK_EXECUTABLE "/usr/bin/llvm-ld <OBJECTS> -o  <TARGET>
<CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")

SET(CMAKE_FIND_ROOT_PATH /usr/bin)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


which I evoke like this:
cmake -DCMAKE_TOOLCHAIN_FILE=../inter/CMakeClangToolchain.cmake ../soruce


and that what spoils find_package Boost (!!!)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:707 ]  
_boost_INCLUDE_SEARCH_DIRS =
/usr/include/boost;C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
(...)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:883 ]
_boost_LIBRARY_SEARCH_DIRS =
/usr/lib;Boost_INCLUDE_DIR-NOTFOUND/lib;Boost_INCLUDE_DIR-NOTFOUND/../lib;Boost_INCLUDE_DIR-NOTFOUND/stage/lib;C:/boost/lib;C:/boost;/boost/boost___/lib;/boost/boost__/lib;/boost/lib;/boost;/sw/local/lib
(...)
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for
THREAD_LIBRARY_RELEASE:
boost_thread-mt-;boost_thread-mt;boost_thread-mt-;boost_thread-mt;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for
THREAD_LIBRARY_DEBUG:
boost_thread-mt-d-;boost_thread-mt-d;boost_thread-mt-d-;boost_thread-mt-d;boost_thread-mt;boost_thread
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1194 (message):
  Unable to find the requested Boost libraries.



Boost ver 1.50 is installed from Quantal packages in standard locations:
/usr/include/boost
and
/usr/lib


Is there any better way to use clang with cmake on Ubuntu ?






--
View this message in context: http://cmake.3232098.n2.nabble.com/newbie-find-package-Boost-ceases-to-work-when-mixed-with-CLang-CMAKE-TOOLCHAIN-FILE-on-Ubuntu-64bit--tp7582729.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list