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

NAKAMURA Takumi geek4civic at gmail.com
Mon Dec 3 00:31:09 PST 2012


Oscar,

I think the issue is how to handle "check-all" without any tests.
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

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})
+    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)


...Takumi


2012/12/1 Óscar Fuentes <ofv at wanadoo.es>:
> 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.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list