Hi, thanks for the replies. I am still facing the same issue. For those interested, here is how to reproduce the issue:
- mkdir test; cd test - mkdir build; mkdir src; mkdir external - wget -O external/boost_1_57_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download - put the cmake script contained in this email into the src directory as CMakeLists.txt - cd build - cmake ../src After this fails, if i delete CMakeCache.txt and rerun the script, it works. In fact it seems to be related to the line: Boost_INCLUDE_DIR:PATH=/usr/include which is in CMakeCache.txt. The cmake script is that needs to go in the src directory is as follows: cmake_minimum_required (VERSION 2.8) function(install_boost) set(APT_BOOST_SRC "../external/boost_1_57_0") MESSAGE(STATUS "APT_BOOST_SRC: " ${APT_BOOST_SRC}) set(APT_BOOST_COMPONENTS "log" "thread" "filesystem" "system") set(BOOTSTRAP_CMD "./bootstrap.sh") set(BOOTSTRAP_ARGS "--prefix=${APT_BOOST_BIN}") message("Executing command: ${BOOTSTRAP_CMD} ${BOOTSTRAP_ARGS}") execute_process(COMMAND "${BOOTSTRAP_CMD}" ${BOOTSTRAP_ARGS} WORKING_DIRECTORY ${APT_BOOST_SRC} RESULT_VARIABLE BS_RESULT OUTPUT_VARIABLE BS_OUTPUT ERROR_VARIABLE BS_ERROR) if(NOT BS_RESULT EQUAL 0) message(FATAL_ERROR "Failed running ${BOOTSTRAP_CMD} ${BOOTSTRAP_ARGS} in ${APT_BOOST_SRC}:\n${BS_OUTPUT}\n${BS_ERROR}\n") endif() # # run b2 # set(B2_ARGS "link=static" "threading=multi" "runtime-link=static" "variant=release") foreach(COMP IN LISTS APT_BOOST_COMPONENTS) set(B2_ARGS "--with-${COMP}" ${B2_ARGS}) endforeach(COMP IN LISTS APT_BOOST_COMPONENTS) if(WIN32) if(MSVC11) set(B2_ARGS "--toolset=msvc-11.0" ${B2_ARGS}) elseif(MSVC12) set(B2_ARGS "--toolset=msvc-12.0" ${B2_ARGS}) endif(MSVC11) file(TO_NATIVE_PATH ${APT_BOOST_BIN} APT_BOOST_BIN_WIN) set(B2_ARGS "--prefix=${APT_BOOST_BIN_WIN}" ${B2_ARGS} "architecture=x86" "address-model=64") endif(WIN32) set(B2_ARGS ${B2_ARGS} install) set(B2_CMD "./b2") message("Executing command: ${B2_CMD} ${B2_ARGS}") execute_process(COMMAND ${B2_CMD} ${B2_ARGS} WORKING_DIRECTORY ${APT_BOOST_SRC} RESULT_VARIABLE B2_RESULT OUTPUT_VARIABLE B2_OUTPUT ERROR_VARIABLE B2_ERROR) if(NOT B2_RESULT EQUAL 0) message(FATAL_ERROR "Failed running ${B2_CMD} in ${APT_BOOST_SRC}:\n${B2_OUTPUT}\n${B2_ERROR}\n") endif() endfunction() set(Boost_DEBUG "ON") set(APT_BOOST_BIN "${CMAKE_CURRENT_SOURCE_DIR}/boost_requirements") SET(BOOST_ROOT "${APT_BOOST_BIN}") MESSAGE (STATUS "1) BOOST_ROOT: ${BOOST_ROOT}") FIND_PACKAGE( Boost 1.57 REQUIRED COMPONENTS log thread filesystem system) if(NOT Boost_FOUND) MESSAGE (STATUS "Extracting boost ...") execute_process( COMMAND ${CMAKE_COMMAND} -E tar xjzf ../external/boost_1_57_0.tar.bz2 WORKING_DIRECTORY "../external") MESSAGE (STATUS "Installing boost") install_boost() else(NOT Boost_FOUND) MESSAGE (STATUS "Boost install already exists") endif(NOT Boost_FOUND) MESSAGE (STATUS "2) BOOST_ROOT: ${BOOST_ROOT}") FIND_PACKAGE( Boost 1.57 REQUIRED COMPONENTS log thread filesystem system ) Boost_root as given when setting Boost_Debug=ON appears to be correct. Many thanks, Matt On Fri, Apr 24, 2015 at 4:09 PM, David Cole <[email protected]> wrote: > How do you do step 3) -- build boost? > > Unless the build is done and installed and ready to find before the > end of step 3, there is still nothing (yet) there for the find_package > in step 4 to find... > > > David C. > > > On Fri, Apr 24, 2015 at 9:36 AM, matzeNOTAVAILABLE . <[email protected]> > wrote: > > Hi, > > i am struggling somewhat with find_package. I looked at the documentation > > and googled quite a bit, but i am still stuck. I alos tried > stackoverflow to > > no avail. > > > > What i am trying to accomplish is the following: > > 1) See if my custom boost installation exists (using find_package) > (version > > 1.57) > > 2) If it does not -> build it > > 3) Use find_package again to find the newly built boost libs. > > > > This works up until but not including step 3. > > > > Something that it might be complicating matters (i am not sure) is that i > > have a system boost installation (1.54). > > > > 1) (... set boost_root ...) > > 2) FIND_PACKAGE(Boost 1.57 COMPONENTS log thread filesystem system) > > 3) (... build boost if it Boost_FOUND is 0) > > 4) FIND_PACKAGE(Boost 1.57 REQUIRED COMPONENTS log thread filesystem > system) > > > > The second call to find_package does not find the boost installation and > > thus does not set include dirs etc... properly. > > > > I wonder why not? > > > > Any hints are greatly appreciated, > > Matt > > > > > > -- > > > > Powered by www.kitware.com > > > > Please keep messages on-topic and check the CMake FAQ at: > > http://www.cmake.org/Wiki/CMake_FAQ > > > > Kitware offers various services to support the CMake community. For more > > information on each offering, please visit: > > > > CMake Support: http://cmake.org/cmake/help/support.html > > CMake Consulting: http://cmake.org/cmake/help/consulting.html > > CMake Training Courses: http://cmake.org/cmake/help/training.html > > > > Visit other Kitware open-source projects at > > http://www.kitware.com/opensource/opensource.html > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
