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

Óscar Fuentes ofv at wanadoo.es
Sat Dec 22 14:16:50 PST 2012


Ping.

Óscar Fuentes <ofv at wanadoo.es> writes:

> With a LLVM checkout, without other projects in LLVM's source tree
> (Clang...), configure with
>
>           
> mkdir foo
> cd foo
> cmake -DLLVM_BUILD_TOOLS=OFF ../llvm
>
> or, if Clang is under tools/ subdirectory:
>
> cmake -DLLVM_BUILD_TOOLS=OFF -DLLVM_EXTERNAL_CLANG_BUILD=OFF ../llvm
>
> (BTW, shouldn't it be LLVM_BUILD_EXTERNAL_CLANG, for consistency with
> LLVM_BUILD_(TOOLS|EXAMPLES|etc) ?)
>
> This fails with
>
> CMake Error at cmake/modules/AddLLVM.cmake:280 (add_dependencies):
>   add_dependencies called with incorrect number of arguments
> Call Stack (most recent call first):
>   CMakeLists.txt:441 (add_lit_target)
>
>
> Apparently, ARG_DEPENDS is empty if there are no tools nor clang in the
> build. The patch below fixes the problem. A possible problem happens
> when the user builds with the above mentioned options, then builds the
> tools or clang with its own `make' command (because the options just
> remove those targets from the default build.)
>
>
> diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
> index 43ee9a0..7e1f704 100755
> --- a/cmake/modules/AddLLVM.cmake
> +++ b/cmake/modules/AddLLVM.cmake
> @@ -277,7 +277,9 @@ function(add_lit_target target comment)
>      COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS}
>      COMMENT "${comment}"
>      )
> -  add_dependencies(${target} ${ARG_DEPENDS})
> +  if( ARG_DEPENDS )
> +    add_dependencies(${target} ${ARG_DEPENDS})
> +  endif()
>  endfunction()
>  
>  # A function to add a set of lit test suites to be driven through 'check-*' targets.




More information about the llvm-commits mailing list