Boost生成成功但无法生成makefile。我哪里做错了?

时间:2013-10-28 05:08:48

标签: boost cygwin cmake cross-compiling

尽管CMake已成功配置并使用Boost生成makefile,但我无法使用make命令为ARM处理器生成可执行文件,如下所示。

enter image description here

以下是我的配置设置:

1。)我在此链接中下载了在Raspberry Pi中编译的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并使用CMake in Cygwin在Raspberry Pi中成功运行它(使用位于C:/cygwin/arm-pi.toolchain中的交叉工具链文件.cmake)。

  1. 的main.cpp

    #include <iostream>
    #include <boost/thread.hpp>
    
    int main(){
    
    cout << "Hello" << endl;
    boost::this_thread::sleep(boost::posix_time::millisec(20));
    return 0;
    }
    
  2. 的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)
    
  3. 升压级   - &GT; include(来自sample-boost \ boost_1_49_0 \ boost)

  4. enter image description here

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

    enter image description here

    另外,调用ccmake。显示找不到boost_dir。但是,发现了升级包!

    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

1 个答案:

答案 0 :(得分:0)

要将增强螺纹模块与CMake配合使用,必须执行

find(Boost COMPONENTS thread)

Normaly,这会在Boost_LIBRARIES var。

中添加boost线程lib的路径
相关问题