Nice catch. What made you decide to do this rather than change AddLLVM.cmake?

Jordan

On Feb 20, 2014, at 7:07 , Brad King <[email protected]> wrote:

> Hi Folks,
> 
> Here is a patch to fix a subtle problem with the combination of
> CLANG_BUILD_EXAMPLES==OFF, EXCLUDE_FROM_ALL, and the LLVMExports
> produced by AddLLVM.cmake API installation rules.  See commit
> message in the patch for details.
> 
> Thanks,
> -Brad
>From 8557db98576fdd6ce8b99d065c95ac59ebc51295 Mon Sep 17 00:00:00 2001
Message-Id: <8557db98576fdd6ce8b99d065c95ac59ebc51295.1392908597.git.brad.k...@kitware.com>
From: Brad King <[email protected]>
Date: Thu, 20 Feb 2014 09:55:30 -0500
Subject: [PATCH] [CMake] Fix installation without CLANG_BUILD_EXAMPLES

When CLANG_BUILD_EXAMPLES is not on we set the EXCLUDE_FROM_ALL
directory property for the examples/ directory to tell CMake not to
build them by default.  The AddLLVM.cmake APIs are not aware of this and
try to install targets that are not built.  This does not cause an
install-time error because CMake excludes the directory from the default
installation.  However, now that installation attaches targets to the
LLVMExports export set CMake-based applications that find_package(LLVM)
fail because the example plugin binary is not available.

Tell the AddLLVM.cmake APIs to exclude the examples from installation by
setting the EXCLUDE_FROM_ALL variable they check.
---
 examples/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 6213bc7..5d4b5fc 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,6 @@
 if(NOT CLANG_BUILD_EXAMPLES)
   set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
+  set(EXCLUDE_FROM_ALL ON)
 endif()
 
 if(CLANG_ENABLE_STATIC_ANALYZER)
-- 
1.8.5.2

> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to