<div dir="ltr">Hi Michael.<br><div class="gmail_extra"><br><div class="gmail_quote">On 28 September 2017 at 18:18, Michael Powell <span dir="ltr"><<a href="mailto:mwpowellhtx@gmail.com" target="_blank">mwpowellhtx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Sep 28, 2017 at 12:06 PM, Michael Powell <<a href="mailto:mwpowellhtx@gmail.com">mwpowellhtx@gmail.com</a>> wrote:<br>
<span class="gmail-">> ---------- Forwarded message ----------<br>
> From: Michael Powell <<a href="mailto:mwpowellhtx@gmail.com">mwpowellhtx@gmail.com</a>><br>
> Date: Thu, Sep 28, 2017 at 12:06 PM<br>
> Subject: Execute CMake process not working: source directory confusion<br>
> To: <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
><br>
><br>
> Hello,<br>
><br>
> This is fairly long, but this is intentional. I message the "Invoking" message.<br>
<br>
</span>Ah, I figured it out!<br>
<br>
>From the help:<br>
<br>
cmake [options] <path-to-source><br>
<br>
So I simply tacked on a "\"${GIT_SUBMODULE_NNG_REPO_<wbr>DIR}\"" where<br>
<path-to-source> was expected.<br>
<br>
Curious CMake would "see" the ENTIRE argument string as<br>
"path-to-source" though. Not sure quite what's going on with that,<br>
though.<br></blockquote><div><br></div><div>That's because you're constructing CPPNNG_NNG_CMAKE_OPTIONS as a single string containing spaces. Spaces *in strings* do not delimit CMake arguments, even if spaces in CMake file syntax do. In other words:</div><div><br></div><div> foo(a b c)</div><div><br></div><div>calls 'foo' with 3 arguments: "a", "b", and "c".</div><div><br></div><div> set(args a b c)</div><div> foo(${args})</div><div><br></div><div>also calls 'foo' with these 3 arguments.</div><div><br></div><div>However,</div><div><br></div><div>  set(args "a b c")</div><div>  foo(${args})</div><div><br></div><div>calls 'foo' with only ONE argument: the string "a b c".</div><div><br></div><div>You need to drop one level of quoting inside your cppnng_nng_add_* macros.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The outcome wasn't quite what I expected. How do I specify "path to<br>
source", where the source CMakeLists.txt is, properly. And the path to<br>
the build, where I want the build environment to land?<br>
<br>
With this scenario, currently things are landing "in the source<br>
directory", which is incorrect, not what I am expecting.<br></blockquote><div><br></div><div>Once you solve the quoting issue, you should be able to pass what you want as the source directory. It's effectively the first non-option argument to 'cmake'.</div><div><br></div><div>The generated buildsystem lands in the working directory from which cmake was invoked. So what you want is this:</div><div><br></div><div>execute_process(</div><div>  ${CMAKE_COMMAND} ${CPPNNG_NNG_CMAKE_OPTIONS} ${GIT_SUBMODULE_NNG_REPO_DIR}</div><div>  WORKING_DIRECTORY wherever/you/want/the/buildystem/to/end/up<br></div><div>)</div><div><br></div><div>Petr<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Probably my confusion over, prefix directory? Or is "source" directory<br>
where things actually land?<br>
<br>
Thanks!<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
> Invoking CMake: C:/Dev/CMake/bin/cmake.exe -G "Visual Studio 14 2015<br>
> Win64" -D CMAKE_CONFIGURATION_TYPES:<wbr>STRING="Debug;Release;<wbr>MinSizeRel;RelWithDebInfo"<br>
> -D CMAKE_INSTALL_PREFIX:STRING="<wbr>G:/Source/Spikes/nanomsg/<wbr>cppnngswig-testing/build/nng"<br>
> -D NNG_ENABLE_COVERAGE:BOOL=OFF -D NNG_ENABLE_DOC:BOOL=OFF -D<br>
> NNG_ENABLE_NNGCAT:BOOL=OFF -D NNG_ENABLE_TESTS:BOOL=OFF -D<br>
> NNG_ENABLE_TOOLS:BOOL=OFF -D NNG_ENABLE_ZEROTIER:BOOL=OFF<br>
><br>
> Prior to running:<br>
><br>
> execute_process (<br>
>     COMMAND "${CMAKE_COMMAND}" ${CPPNNG_NNG_CMAKE_OPTIONS}<br>
>     WORKING_DIRECTORY "${GIT_SUBMODULE_NNG_REPO_DIR}<wbr>"<br>
>     RESULT_VARIABLE CPPNN_NNG_CONFIG_EC<br>
>     OUTPUT_VARIABLE CPPNN_NNG_CONFIG_MSG<br>
> )<br>
><br>
> Which is yielding:<br>
><br>
> CMake Error: The source directory<br>
> "G:/Source/Spikes/nanomsg/<wbr>cppnngswig-testing/repos/nng/ -G "Visual<br>
> Studio 14 2015 Win64" -D<br>
> CMAKE_CONFIGURATION_TYPES:<wbr>STRING="Debug;Release;<wbr>MinSizeRel;RelWithDebInfo"<br>
> -D CMAKE_INSTALL_PREFIX:STRING="<wbr>G:/Source/Spikes/nanomsg/<wbr>cppnngswig-testing/build/nng"<br>
> -D NNG_ENABLE_COVERAGE:BOOL=OFF -D NNG_ENABLE_DOC:BOOL=OFF -D<br>
> NNG_ENABLE_NNGCAT:BOOL=OFF -D NNG_ENABLE_TESTS:BOOL=OFF -D<br>
> NNG_ENABLE_TOOLS:BOOL=OFF -D NNG_ENABLE_ZEROTIER:BOOL=OFF" does not<br>
> exist.<br>
><br>
> The GIT_SUBMODULE_NNG_REPO_DIR is indeed set to<br>
> G:/Source/Spikes/nanomsg/<wbr>cppnngswig-testing/repos/nng/, so how can<br>
> that not be the source directory? But further, how is it seeing the<br>
> rest of the options as "source directory"?<br>
><br>
> I only got to this point by doing what seems like extreme string<br>
> gymnastics just to arrive at what I think is an appropriate command.<br>
><br>
> i.e.<br>
><br>
> macro (cppnng_nng_add_cmake_<wbr>generator GEN)<br>
>     set (CPPNNG_NNG_CMAKE_OPTIONS "${CPPNNG_NNG_CMAKE_OPTIONS} -G \"${GEN}\"")<br>
> endmacro ()<br>
><br>
> macro (cppnng_nng_add_cmake_var OPT TYPE VALUE)<br>
>     set (CPPNNG_NNG_CMAKE_OPTIONS "${CPPNNG_NNG_CMAKE_OPTIONS} -D<br>
> ${OPT}:${TYPE}=${VALUE}")<br>
> endmacro ()<br>
><br>
>     cppnng_nng_add_cmake_generator ("${CMAKE_GENERATOR}")<br>
><br>
>     # This is like string GYMNASTICS in order to allow semi-colons to<br>
> properly pass through.<br>
>     string(REPLACE ";" "\;" REPLACED_TYPES "${CMAKE_CONFIGURATION_TYPES}"<wbr>)<br>
>     cppnng_nng_add_cmake_var ("CMAKE_CONFIGURATION_TYPES" STRING<br>
> "\"${REPLACED_TYPES}\"")<br>
><br>
>     cppnng_nng_add_cmake_var ("CMAKE_INSTALL_PREFIX" STRING<br>
> "\"${cppnng_SOURCE_DIR}/build/<wbr>nng\"")<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_COVERAGE" BOOL OFF)<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_DOC" BOOL OFF)<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_NNGCAT" BOOL OFF)<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_TESTS" BOOL OFF)<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_TOOLS" BOOL OFF)<br>
>     # TODO: TBD: at the moment we do not care about ZeroTier, but this<br>
> could change moving forward.<br>
>     cppnng_nng_add_cmake_var ("NNG_ENABLE_ZEROTIER" BOOL OFF)<br>
><br>
>     # message (FATAL_ERROR "options: ${CPPNNG_NNG_CMAKE_OPTIONS}")<br>
><br>
>     # message (STATUS "${REPLACED_TYPES}")<br>
><br>
>     message (STATUS "Invoking CMake: " "${CMAKE_COMMAND}"<br>
> ${CPPNNG_NNG_CMAKE_OPTIONS})<br>
><br>
> Cheers,<br>
><br>
> Michael Powell<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div></div>