<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Mikael:</div><div dir="ltr"><br></div><div dir="ltr">Thanks for reporting this.  </div><div dir="ltr"><br></div><div dir="ltr">Looks like the call to `include(CMakeNinjaFindMake OPTIONAL)` is the problem since it's using find_program and overwrites it if it isn't a full path.  Since the generator already set it, there's no reason for an additional find_program call, so I'll remove it.<br><div><br></div><div>Fixed in r361501.</div><div><br></div><div>Btw, why were you setting CMAKE_MAKE_PROGRAM to a value without a path?  Is this so you can test alternative versions of ninja without rerunning cmake?</div><div><br></div><div>thanks again...</div><div>don</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 23, 2019 at 2:30 AM Mikael Holmén <<a href="mailto:mikael.holmen@ericsson.com" target="_blank">mikael.holmen@ericsson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Don,<br>
<br>
I noticed that if I run cmake and configure with <br>
-DCMAKE_MAKE_PROGRAM=ninja, so I'm not including the full path to ninja, <br>
then I get errors with this commit when it tries to do "ninja --version".<br>
<br>
It then tries to do<br>
<br>
<br>
'/local/repo/bbiswjenk/fem023-eiffel003/workspace/llvm/llvm-dev-kielx2/build-ccache/ninja' <br>
'--version'<br>
<br>
If I instead configure with -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja it works <br>
as it should.<br>
<br>
/usr/bin/ is included in the PATH, but still it tries to run ninja from <br>
the local build directory when I've cofigured with just "ninja".<br>
<br>
Is this expected?<br>
<br>
Regards,<br>
Mikael<br>
<br>
On 5/21/19 7:56 PM, Don Hinton via llvm-commits wrote:<br>
> Author: dhinton<br>
> Date: Tue May 21 10:56:45 2019<br>
> New Revision: 361280<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=361280&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=361280&view=rev</a><br>
> Log:<br>
> [cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.<br>
> <br>
> Summary:<br>
> clang and newer versions of ninja use high-resolutions timestamps, but<br>
> older versions of libtool on Darwin don't, so the archive will often<br>
> get an older timestamp than the last object that was added or updated.<br>
> To fix this, we add a custom command to touch the archive after it's<br>
> been built so that ninja won't rebuild it unnecessarily the next time<br>
> it's run.<br>
> <br>
> Reviewed By: beanz<br>
> <br>
> Tags: #llvm<br>
> <br>
> Differential Revision: <a href="https://reviews.llvm.org/D62172" rel="noreferrer" target="_blank">https://reviews.llvm.org/D62172</a><br>
> <br>
> Modified:<br>
>      llvm/trunk/cmake/config-ix.cmake<br>
>      llvm/trunk/cmake/modules/AddLLVM.cmake<br>
> <br>
> Modified: llvm/trunk/cmake/config-ix.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=361280&r1=361279&r2=361280&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=361280&r1=361279&r2=361280&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/cmake/config-ix.cmake (original)<br>
> +++ llvm/trunk/cmake/config-ix.cmake Tue May 21 10:56:45 2019<br>
> @@ -554,6 +554,22 @@ find_program(GOLD_EXECUTABLE NAMES ${LLV<br>
>   set(LLVM_BINUTILS_INCDIR "" CACHE PATH<br>
>       "PATH to binutils/include containing plugin-api.h for gold plugin.")<br>
>   <br>
> +if(CMAKE_GENERATOR STREQUAL "Ninja")<br>
> +  include(CMakeNInjaFindMake)<br>
> +  if(CMAKE_MAKE_PROGRAM)<br>
> +    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version<br>
> +      OUTPUT_VARIABLE NINJA_VERSION<br>
> +      OUTPUT_STRIP_TRAILING_WHITESPACE)<br>
> +    set(NINJA_VERSION ${NINJA_VERSION} CACHE STRING "Ninja version number" FORCE)<br>
> +  endif()<br>
> +endif()<br>
> +<br>
> +if(CMAKE_GENERATOR STREQUAL "Ninja" AND<br>
> +    NINJA_VERSION VERSION_GREATER_EQUAL "1.9.0" AND<br>
> +    CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER "15.6.0")<br>
> +  set(LLVM_TOUCH_STATIC_LIBRARIES ON)<br>
> +endif()<br>
> +<br>
>   if(CMAKE_HOST_APPLE AND APPLE)<br>
>     if(NOT CMAKE_XCRUN)<br>
>       find_program(CMAKE_XCRUN NAMES xcrun)<br>
> <br>
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=361280&r1=361279&r2=361280&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=361280&r1=361279&r2=361280&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)<br>
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue May 21 10:56:45 2019<br>
> @@ -596,6 +596,18 @@ function(llvm_add_library name)<br>
>       llvm_externalize_debuginfo(${name})<br>
>       llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})<br>
>     endif()<br>
> +  # clang and newer versions of ninja use high-resolutions timestamps,<br>
> +  # but older versions of libtool on Darwin don't, so the archive will<br>
> +  # often get an older timestamp than the last object that was added<br>
> +  # or updated.  To fix this, we add a custom command to touch archive<br>
> +  # after it's been built so that ninja won't rebuild it unnecessarily<br>
> +  # the next time it's run.<br>
> +  if(ARG_STATIC AND LLVM_TOUCH_STATIC_LIBRARIES)<br>
> +    add_custom_command(TARGET ${name}<br>
> +      POST_BUILD<br>
> +      COMMAND touch ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}<br>
> +      )<br>
> +  endif()<br>
>   endfunction()<br>
>   <br>
>   function(add_llvm_install_targets target)<br>
> <br>
> <br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
> <br>
</blockquote></div>