[PATCH] Make CMake files generated by the Autoconf build system relocatable.

Brad King brad.king at kitware.com
Mon Jun 29 12:22:51 PDT 2015


On 06/29/2015 03:02 PM, Dan Liew wrote:
> This patch makes the CMake files generated by the Autoconf build
> system less fragile by making them relocatable. I also noticed some of
> the targets were missing a dependency of the Makefile (e.g. the
> LLVMExports.cmake was not regenerated when I changed the Makefile) so
> I've added them.

Good.  It works for me.  However, see the following comments.

* Please remove the stray debugging code as shown in the hunk below.

* The number of get_filename_component calls technically needs
  to depend on the PROJ_cmake value.  The default is

   PROJ_cmake := $(DESTDIR)$(PROJ_prefix)/share/llvm/cmake

  but the number of levels after $(PROJ_prefix) determines the number
  of get_filename_component calls needed.

* I'm a little uncomfortable with the form of the IMPORTED_LOCATION
  property values: "${LLVM_LIBRARY_DIRS}/libNAME.a".  The plural
  name "_DIRS" is typically used when the value can be a list.
  I'd rather have a temporary _LLVM_LIB_DIR that is computed and
  used long enough for LLVMExports and then unset like
  _LLVM_CMAKE_DIR.  Its value can also be used to populate the
  public-facing LLVM_LIBRARY_DIRS list.

Side note: I noticed that include/llvm/Config/llvm-config.h still
hard-codes some paths and is not relocatable.  I don't recall if
any of those values is meant to be public-facing.

Thanks,
-Brad


diff --git a/cmake/modules/Makefile b/cmake/modules/Makefile
index bdf0799..4c3ba1d 100644
--- a/cmake/modules/Makefile
+++ b/cmake/modules/Makefile
@@ -70,7 +70,6 @@ get_filename_component(LLVM_INSTALL_PREFIX "$${LLVM_INSTALL_PREFIX}" PATH)

 $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in Makefile $(LLVMBuildCMakeFrag)
        $(Echo) 'Generating LLVM CMake package config file'
-       echo "$(LLVM_CONFIG_CODE)"
        $(Verb) ( \
         cat $< | sed \
          -e 's/@LLVM_CONFIG_CODE@/$(LLVM_CONFIG_CODE)/' \




More information about the llvm-commits mailing list