summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-02-09 16:37:02 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-02-09 16:37:02 +0000
commit4c56efbd441d17b61f3e29ee2372e6e460d5a185 (patch)
treed35057dfc166610dce578462ec63955d0141bfe3 /Makefile.rules
parent2fbf9e2fda89c8d478abac7fd13bda524bfc9673 (diff)
downloadllvm-4c56efbd441d17b61f3e29ee2372e6e460d5a185.tar.gz
llvm-4c56efbd441d17b61f3e29ee2372e6e460d5a185.tar.bz2
llvm-4c56efbd441d17b61f3e29ee2372e6e460d5a185.tar.xz
Provide CMake package modules in install tree
Teach the Makefile build system to generate and install CMake modules LLVMConfig.cmake and LLVMConfigVersion.cmake so that applications that build with CMake can use 'find_package(LLVM)' even when LLVM is not built with CMake. These modules tell such applications about available LLVM libraries and their dependencies. Run llvm-config to generate the list of libraries and use the results of llvm-build to generate the library dependencies. Use sed to perform substitutions in the LLVMConfig.cmake.in and LLVMConfigVersion.cmake.in sources that our CMake build system uses. Teach the Makefile build system to generate the LLVMExports.cmake file with content similar to that produced by the CMake install(EXPORT) command. Extend llvm-build with an option to generate the library dependencies fragment for this file. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules18
1 files changed, 13 insertions, 5 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 6c7ec02d15..d668b23afb 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -78,6 +78,12 @@ LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
# The files we are going to generate using llvm-build.
LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
+LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake
+LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake
+LLVMBuildMakeFrags := \
+ $(LLVMBuildMakeFrag) \
+ $(LLVMBuildCMakeFrag) \
+ $(LLVMBuildCMakeExportsFrag)
LLVMConfigLibraryDependenciesInc := \
$(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
@@ -94,18 +100,20 @@ endif
#
# We include a dependency on this Makefile to ensure that changes to the
# generation command get picked up.
-$(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \
- $(PROJ_OBJ_ROOT)/Makefile.config
+$(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \
+ $(PROJ_OBJ_ROOT)/Makefile.config
$(Echo) Constructing LLVMBuild project information.
$(Verb)$(PYTHON) $(LLVMBuildTool) \
--native-target "$(TARGET_NATIVE_ARCH)" \
--enable-targets "$(TARGETS_TO_BUILD)" \
--enable-optional-components "$(OPTIONAL_COMPONENTS)" \
--write-library-table $(LLVMConfigLibraryDependenciesInc) \
- --write-make-fragment $(LLVMBuildMakeFrag)
+ --write-make-fragment $(LLVMBuildMakeFrag) \
+ --write-cmake-fragment $(LLVMBuildCMakeFrag) \
+ --write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag)
# For completeness, let Make know how the extra files are generated.
-$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag)
+$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags)
# Include the generated Makefile fragment.
#
@@ -120,7 +128,7 @@ LLVMBUILD_INCLUDE_DEPENDENCIES := 1
# Clean the generated makefile fragment at the top-level.
clean-local::
- -$(Verb) $(RM) -f $(LLVMBuildMakeFrag)
+ -$(Verb) $(RM) -f $(LLVMBuildMakeFrags)
endif
-include $(LLVMBuildMakeFrag)