From: Kefu Chai Date: Sat, 29 Apr 2017 18:01:33 +0000 (+0800) Subject: cmake: enable crosscompile of boost X-Git-Tag: v12.0.3~147^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=61e2ff48409dd6a32a9eeb9b69ece852b44c66d6;p=ceph.git cmake: enable crosscompile of boost Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f19fc2c054f6..34d2c93a495c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,6 +548,24 @@ else() endif() list(APPEND b2 variant=release link=static threading=multi cxxflags=${BOOST_CFLAGS}) + if(NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL CMAKE_SYSTEM_PROCESSOR) + # we are crosscompiling + if(CMAKE_CXX_COMPILER_ID STREQUAL GNU) + set(b2_cc gcc) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang) + set(b2_cc clang) + else() + message(SEND_ERROR "unknown compiler: ${CMAKE_CXX_COMPILER_ID}") + endif() + # edit the config.jam so, b2 will be able to use the specified toolset + execute_process( + COMMAND + sed -i + "s|using ${b2_cc} ;|using ${b2_cc} : ${CMAKE_SYSTEM_PROCESSOR} : ${CMAKE_CXX_COMPILER} ;|" + ${PROJECT_SOURCE_DIR}/src/boost/project-config.jam) + # use ${CMAKE_SYSTEM_PROCESSOR} as the version identifier of compiler + list(APPEND b2 toolset=${b2_cc}-${CMAKE_SYSTEM_PROCESSOR}) + endif() # 2. install headers execute_process(COMMAND ${b2}