2013-10-28 48 views
0

即使CMake的已成功地配置,并且产生具有升压生成文件中,我不能产生用于使用make命令如下所示ARM处理器的可执行文件。升压成功生成,但不能产生一个makefile。我哪里做错了?

enter image description here

这里是我的配置设置:

1)我下载了树莓派编译Boost库1.49在此链接: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=8111&p=195468

2)文件的层次结构如下:

sample-boost 
    -> boost-stage (Contains the lib, and include directories of the boost taken from number 1) 
    -> build (Contains the generated files from CMake) 
    -> CMakeLists.txt 
    -> main.cpp 

注意:ARM交叉编译器完全正常工作,而我已经交叉编译了hello world,并在Cygwin中使用CMake(使用位于C:/cygwin/arm-pi.toolchain.cmake中的交叉工具链文件)成功在Raspberry Pi中运行它。

  • 的main.cpp

    #include <iostream> 
    #include <boost/thread.hpp> 
    
    int main(){ 
    
    cout << "Hello" << endl; 
    boost::this_thread::sleep(boost::posix_time::millisec(20)); 
    return 0; 
    } 
    
  • 的CMakeLists.txt

    cmake_minimum_required(VERSION 2.8) 
    Project(main) 
    SET(Boost_INCLUDE_DIR C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include) 
    SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include") 
    SET(BOOST_ROOT C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage) 
    
    FIND_PACKAGE(Boost) 
    
    message("BOOST LIBRARY" ${Boost_LIBRARY_DIRS}) 
    message("Boost LIBRARIES:" ${Boost_LIBRARIES}) 
    
    
    IF(Boost_FOUND) 
    message("Boost include directory is found") 
    message("Boost_INCLUDE_DIRS": ${Boost_INCLUDE_DIRS}) 
    include_directories(${Boost_INCLUDE_DIRS}) 
    add_executable(main main.cpp) 
    target_link_libraries(main ${Boost_LIBRARIES}) 
    ENDIF(Boost_FOUND) 
    
  • 升压级 - >包括(来自样品 - 升压\ boost_1_49_0 \升压)

  • enter image description here

    -> lib (came from boost_1_49_0(bin-only)\lib 
    

    enter image description here

    此外,调用ccmake。显示找不到boost_dir。但是,boost包被发现!

    enter image description here

    使用CMake的,但我正如你所看到的,它已经成功地生成的makefile不能为它建立一个可执行文件。我想我错过了一些建立提升的东西。也许我没有成功链接库?是不是

    message("Boost LIBRARIES:" ${Boost_LIBRARIES}) 
    

    显示库文件?

    此外:我做你问什么。这是我的新的CMakeLists.txt

    cmake_minimum_required(VERSION 2.8) 
    Project(main) 
    SET(Boost_INCLUDE_DIR C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include) 
    SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage/include") 
    SET(BOOST_ROOT C:/Users/Emmett/Documents/EMMETT/sample-boost/boost-stage) 
    SET(Boost_USE_STATIC_LIBS TRUE) 
    SET(Boost_DEBUG ON) 
    #FIND_PACKAGE(Boost) 
    FIND_PACKAGE(Boost COMPONENTS thread) 
    
    message("BOOST LIBRARY: " ${Boost_LIBRARY_DIRS}) 
    message("Boost LIBRARIES: " ${Boost_LIBRARIES}) 
    message("LIBS : " ${LIBS}) 
    
    IF(Boost_FOUND) 
        message("Boost include directory is found") 
        message("Boost_INCLUDE_DIRS: "${Boost_INCLUDE_DIRS}) 
        include_directories(${Boost_INCLUDE_DIRS}) 
        add_executable(main main.cpp) 
        target_link_libraries(main ${Boost_LIBRARIES}) 
    ENDIF(Boost_FOUND) 
    

    这里是输出控制台: enter image description here

    回答

    0

    对于使用与C进行升压线程模块必须执行

    find(Boost COMPONENTS thread) 
    

    Normaly,这种添加路径在Boost_LIBRARIES VAR升压线程库。

    +0

    我用find_package(Boost COMPONENTS线程)替换了find_package(Boost)。它说它无法再找到提升。 – Xegara

    +0

    您可以将'Boost_DEBUG'设置为ON以启用FindBoost的调试输出。 – klerk

    +0

    我做了你所要求的。我真的不知道问题是什么。它似乎能够扫描boost线程库,并且仍然报告没有找到Boost,并且没有找到boost库。此外,我不知道启用use_static_libs – Xegara