即使CMake的已成功地配置,並且產生具有升壓生成文件中,我不能產生用於使用make命令如下所示ARM處理器的可執行文件。升壓成功生成,但不能產生一個makefile。我哪裏做錯了?
這裏是我的配置設置:
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 \升壓)
-> lib (came from boost_1_49_0(bin-only)\lib
此外,調用ccmake。顯示找不到boost_dir。但是,boost包被發現!
使用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)
這裏是輸出控制檯:
我用find_package(Boost COMPONENTS線程)替換了find_package(Boost)。它說它無法再找到提升。 – Xegara
您可以將'Boost_DEBUG'設置爲ON以啓用FindBoost的調試輸出。 – klerk
我做了你所要求的。我真的不知道問題是什麼。它似乎能夠掃描boost線程庫,並且仍然報告沒有找到Boost,並且沒有找到boost庫。此外,我不知道啓用use_static_libs – Xegara