Quantcast

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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

ahoros
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 ?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Miller, Frank

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

I do it like this

    cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang /path/to/source

But you can also hard code the path to the compiler in your CMakeLists.txt.

http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools

Frank


This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...