[llvm-commits] PATCH: (cmake) Fix tool-less build

Óscar Fuentes ofv at wanadoo.es
Mon Dec 3 04:07:09 PST 2012


Hello Takumi,

NAKAMURA Takumi <geek4civic at gmail.com> writes:

> I think the issue is how to handle "check-all" without any tests.

Yes, I realize that there is a deeper issue here. I even wrote a lengthy
description of related issues, but then decided to remove it because
there are people far more familia with that area than me. So the patch
just unbreaks the build for the described specific case.

> With your patch,
>
> $ make check-all
> Running all regression tests
> Usage: lit.py [options] {file-or-path}
>
> lit.py: error: No inputs specified
> make[3]: *** [CMakeFiles/check-all] Error 2

It is expected that check-all fails when there was no tool included in
`make all', but are suggesting that on a ordinary build `check-all' fails
on the way you described? (I have no way of testing it here and now)

> Rather, I suggest like as below;
>
> --- a/llvm/cmake/modules/AddLLVM.cmake
> +++ b/llvm/cmake/modules/AddLLVM.cmake
> @@ -273,11 +273,16 @@ function(add_lit_target target comment)
>    foreach(param ${ARG_PARAMS})
>      list(APPEND LIT_COMMAND --param ${param})
>    endforeach()
> -  add_custom_target(${target}
> -    COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS}
> -    COMMENT "${comment}"
> -    )
> -  add_dependencies(${target} ${ARG_DEPENDS})
> +  if( ARG_DEPENDS )
> +    add_custom_target(${target}
> +      COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS}
> +      COMMENT "${comment}"
> +      )
> +    add_dependencies(${target} ${ARG_DEPENDS})
> +  else()
> +    add_custom_target(${target})

Wouldn't be good to do the add_custom_target as

add_custom_target(${target}
  COMMAND cmake -E echo "${target} does nothing, no tools built.")

so the user knows what the issue is in case he tries to invoke the
target after the build?

> +    message(STATUS "Test target ${target} does nothing.")
> +  endif()
>  endfunction()
>
>  # A function to add a set of lit test suites to be driven through
> 'check-*' targets.
>
> --
> (I think it would be worse if "check-all" were not generated)

As mentioned above, you are better qualified than me to decide the best
solution.

It occurred to me while writing the patch that if targets are generated
for the tools, but they are not built as part of `make all', wouldn't it
be right that if the user invokes `make check[-all]' the system proceeds
with building the tools and then testing? After all, `make check' is
useless without the tools and/or clang.



More information about the llvm-commits mailing list