Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] Building boost "with an uninstalled build" and linking to boost libs
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2010-03-24 17:04:38


I have been playing with "ExternalProject_Add" and I don't think you
are going to be able to do what you are trying to do. I was using the
following:

project (Combined)
cmake_minimum_required(VERSION 2.8)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)

SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin )

# --------- Setup the Executable output Directory -------------
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin )

set (EP_BASE "Boost")
ExternalProject_Add(
     Boost
                TMP_DIR Boost/tmp
                STAMP_DIR Boost/stamp
                DOWNLOAD_DIR Boost/Download
     DOWNLOAD_COMMAND ""
     SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../MXABoost
                CMAKE_ARGS -DBOOST_INCLUDE_INSTALL_DIR=include/boost-1_36 -
DBUILD_SOVERSIONED=OFF -DBOOST_LIB_INSTALL_DIR=lib -DENABLE_DEBUG=ON -
DENABLE_MULTI_THREADED=ON -DENABLE_RELEASE=ON -DENABLE_SHARED=OFF -
DENABLE_SINGLE_THREADED=OFF -DENABLE_STATIC=ON -DINSTALL_VERSIONED=OFF
-DWITH_MPI=OFF -DWITH_PYTHON=OFF -DCMAKE_INSTALL_PREFIX=$
{PROJECT_BINARY_DIR}/Boost/Install
     BINARY_DIR Boost/Build
                BUILD_COMMAND make -j16
     INSTALL_DIR Boost/Install
)

set ($ENV{BOOST_ROOT} "${PROJECT_BINARY_DIR}/Boost/Install")
set (BOOST_ROOT "${PROJECT_BINARY_DIR}/Boost/Install")
# ---------- Find Boost Headers/Libraries -----------------------
SET (Boost_FIND_REQUIRED TRUE)
SET (Boost_FIND_QUIETLY TRUE)
set (Boost_USE_MULTITHREADED TRUE)
set (Boost_USE_STATIC_LIBS TRUE)
SET (Boost_ADDITIONAL_VERSIONS "1.36" "1.36.0" "1.41" "1.41.0" "1.39"
"1.39.0")

# --------------------------------------------------------------------
# MXA_BOOST_HEADERS_ONLY determines if any boost libraries are going to
# be found with the boost headers. For MXADataModel itself NO boost
# libraries are required but if you choose to build the ImportGenerator
# program then you will need the boost program_options library.
if ( NOT MXA_BOOST_HEADERS_ONLY)
  set (MXA_BOOST_COMPONENTS program_options )
endif()

include(${PROJECT_BINARY_DIR}/Boost/Install/share/cmake/boost/
BoostConfig.cmake)
#FIND_PACKAGE(Boost COMPONENTS ${MXA_BOOST_COMPONENTS} )
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})

The problem is that all the files that Find_package() would normally
use are NOT available the first time CMake is run. They would ONLY be
available after boost is compiled and installed. So this seems to be a
chicken-and-egg thing. Not sure what to do except ask on the CMake
Users Mailing list.

sorry
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson_at_[hidden]
BlueQuartz Software Dayton, Ohio

On Mar 24, 2010, at 3:56 PM, Brian Davis wrote:

>
>
> On Wed, Mar 24, 2010 at 2:44 PM, Michael Jackson <mike.jackson_at_[hidden]
> > wrote:
> The Boost-CMake (IMHO) sort of "abused" the cmake system somewhat in
> order to make it more "bjam" like.
>
> In practice if the first pass of FindBoost.cmake does not find
> anything then I usually have to manually go into the CMakeCache.txt
> file and remove all the boost variables and re-run CMake. You can
> also probably do this using the CMake-Gui program.
>
>
> I posted a desirement in the CMake Mantis bug tracker only to find
> out that all one has to do in CMake GUI is File->"Delete Cache" then
> config, config, generate, wait for CMake VS Macros to notice
> something is awry and update the pojects... I still wish there were
> a button. If I could get a heart rate monitor to sense my level of
> frustration and automatically rerun a script to delete the cache I
> think this would be the optimal solution.
>
>
> Basically for each library, look in boost/libs/filesystem/
> CMakeLists.txt. That file should get you started in the right
> location to start trying to figure out what is going wrong.
>
>
> Thanks for the words of advice I will keep hacking until I find out
> what I am doing wrong.
>
> Brian
> _______________________________________________
> Boost-cmake mailing list
> Boost-cmake_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-cmake


Boost-cmake list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk