[CMake] Building Boost as an ExternalProject
Michael Powell
mwpowellhtx at gmail.com
Mon Oct 2 15:37:43 EDT 2017
On Mon, Oct 2, 2017 at 3:06 PM, Michael Powell <mwpowellhtx at gmail.com> wrote:
> On Mon, Oct 2, 2017 at 2:34 PM, Michael Powell <mwpowellhtx at gmail.com> wrote:
>> Hello,
>>
>> This question has been raised from time to time I think. I am trying
>> to build Boost as an ExternalProject, but I am ending up with an
>> error: 'cmd.exe' returned with exit code 1. Along these lines.
This is the line from the Microsoft.CppCommon.targets that was failing.
<CustomBuild
Sources ="@(CustomBuild)"
BuildSuffix ="$(_BuildSuffix)"
TrackerLogDirectory ="%(CustomBuild.TrackerLogDirectory)"
MinimalRebuildFromTracking ="%(CustomBuild.MinimalRebuildFromTracking)"
TLogReadFiles ="@(CustomBuildTLogReadFiles)"
TLogWriteFiles ="@(CustomBuildTLogWriteFiles)"
TrackFileAccess ="$(TrackFileAccess)"
ToolArchitecture ="$(CustomBuildToolArchitecture)"
TrackerFrameworkPath ="$(CustomBuildTrackerFrameworkPath)"
TrackerSdkPath ="$(CustomBuildTrackerSdkPath)"
AcceptableNonZeroExitCodes ="%(CustomBuild.AcceptableNonZeroExitCodes)"
>
And the output message is this:
2> CMake Error at
G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src/boost-stamp/boost-configure-Debug.cmake:16
(message):
2> Command failed: The system cannot find the file specified
2>
2> 'bootstrap.bat'
'--prefix=G:/Source/Spikes/nanomsg/cppnngswig-working/boostbuild'
2>
2> See also
2>
2> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src/boost-stamp/boost-configure-*.log
However, I've set the Working Directory to the bootstrap.bat location,
so I do not know how that could be missed.
> From the Boost VC project file:
>
> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">setlocal
> C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/repos/boost
> if %errorlevel% neq 0 goto :cmEnd
> C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src/boost-build
> if %errorlevel% neq 0 goto :cmEnd
> C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix
> if %errorlevel% neq 0 goto :cmEnd
> C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/tmp
> if %errorlevel% neq 0 goto :cmEnd
> ** C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src/boost-stamp/$(Configuration)
> ** if %errorlevel% neq 0 goto :cmEnd
> C:\Dev\CMake\bin\cmake.exe -E make_directory
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src
> if %errorlevel% neq 0 goto :cmEnd
> C:\Dev\CMake\bin\cmake.exe -E touch
> G:/Source/Spikes/nanomsg/cppnngswig-working/build/boost-prefix/src/boost-stamp/$(Configuration)/boost-mkdir
> if %errorlevel% neq 0 goto :cmEnd
> :cmEnd
> ** endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
> :cmErrorLevel
> exit /b %1
> :cmDone
> if %errorlevel% neq 0 goto :VCEnd</Command>
>
> ** which line number was the error
>
> Honestly, that does not make much sense since the directories do in fact exist.
>
> The boost-configure-err.log shows this result:
>
> The system cannot find the path specified.
> '.\build.bat' is not recognized as an internal or external command,
> operable program or batch file.
>
> Which leads me to believe that possibly I need to tell the target to
> operate in a more appropriate working directory?
>
>> Perhaps I have involved one too many variables, but I doubt it. Ignore
>> the cross-plat stuff, this is building on Windows for the purposes of
>> this conversation.
>>
>> I tried to configure ExternalProject_Add with as much verbosity as
>> possible, but unfortunately the process is not especially talkative as
>> it turns out. But for the EC 1.
>>
>> set (BOOST_VERSION 1.65.1)
>>
>> message (STATUS "Adding Boost ${BOOST_VERSION} as an external project.")
>>
>> set (BOOST_BOOTSTRAP_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/boostbuild)
>> set (BOOST_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/boostbuild)
>> set (BOOST_BUILD_PREFIX ${BOOST_BOOTSTRAP_PREFIX}/boost)
>> set (BOOST_GIT_REPO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/repos/boost)
>>
>> if (WIN32)
>> set (BOOST_BOOTSTRAP_CMD ${BOOST_GIT_REPO_DIR}/bootstrap.bat)
>> # It was bjam at one point; it is now b2
>> set (BOOST_BUILD_CMD ${BOOST_GIT_REPO_DIR}/b2.exe)
>> elseif (UNIX)
>> set (BOOST_BOOTSTRAP_CMD ./${BOOST_GIT_REPO_DIR}/bootstrap.sh)
>> set (BOOST_BUILD_CMD ./${BOOST_GIT_REPO_DIR}/b2)
>> endif ()
>>
>> # TODO: TBD: For now, assuming only 64-bit address models.
>> set (BOOST_ADDR_MODEL 64)
>>
>> # TODO: TBD: align with the toolchain that we want to build through
>> the CMake here... For now assuming:
>> if (MSVC_VERSION EQUAL 1900)
>> set (BOOST_TOOLSET msvc-14.0)
>> endif ()
>>
>> ExternalProject_Add (boost
>> # PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/repos/boost
>> GIT_REPOSITORY git at github.com:boostorg/boost.git
>> GIT_TAG boost-${BOOST_VERSION}
>> GIT_PROGRESS ON
>> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:STRING=${BOOST_INSTALL_PREFIX}
>> SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/repos/boost
>> CONFIGURE_COMMAND ${BOOST_BOOTSTRAP_CMD} --prefix=${BOOST_BOOTSTRAP_PREFIX}
>> # I do not necessarily care about any other Boost build options;
>> but that could change the further I get into unit testing, at least so
>> long as I will be adopting the test library for usage.
>> BUILD_COMMAND ${BOOST_BUILD_CMD} --with-test
>> toolset=${BOOST_TOOLSET} variant=debug link=static stage
>> --prefix=${BOOST_BUILD_PREFIX}
>> LOG_DOWNLOAD ON
>> LOG_UPDATE ON
>> LOG_CONFIGURE ON
>> LOG_BUILD ON
>> LOG_INSTALL ON
>> )
>>
>> Cheers,
>>
>> Michael Powell
More information about the CMake
mailing list