[llvm-commits] [llvm] r143171 - in /llvm/trunk/tools/llvm-config: CMakeLists.txt Makefile llvm-config.in.in

Peter Collingbourne peter at pcc.me.uk
Thu Oct 27 18:02:16 PDT 2011


Author: pcc
Date: Thu Oct 27 20:02:16 2011
New Revision: 143171

URL: http://llvm.org/viewvc/llvm-project?rev=143171&view=rev
Log:
Have llvm-config --cppflags print correct flags when in CMake build directory

Previously, if invoked from a CMake build directory, 'llvm-config
--cppflags' and friends would only print a -I flag for the build
directory's header search path, because it would assume that it was
already installed, not recognising its parent directory as being the
build directory.  Teach llvm-config about CMake build directories
so that it prints a -I for both the source and build directory's
search paths.

Modified:
    llvm/trunk/tools/llvm-config/CMakeLists.txt
    llvm/trunk/tools/llvm-config/Makefile
    llvm/trunk/tools/llvm-config/llvm-config.in.in

Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=143171&r1=143170&r2=143171&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-config/CMakeLists.txt Thu Oct 27 20:02:16 2011
@@ -48,6 +48,7 @@
 set(LLVM_LDFLAGS "@LLVM_LDFLAGS@")
 set(LIBS "@LIBS@")
 set(LLVM_BUILDMODE "@LLVM_BUILDMODE@")
+set(LLVM_OBJ_SUFFIX "@LLVM_OBJ_SUFFIX@")
 
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.in.in
@@ -114,6 +115,7 @@
   COMMAND echo s!@LLVM_LDFLAGS@!${CMAKE_SHARED_LINKER_FLAGS}! >> temp.sed
   COMMAND echo s!@LIBS@!${LLVM_SYSTEM_LIBS}! >> temp.sed
   COMMAND echo s!@LLVM_BUILDMODE@!${CMAKE_BUILD_TYPE}! >> temp.sed
+  COMMAND echo s!@LLVM_OBJ_SUFFIX@!! >> temp.sed
   COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG}
   COMMAND ${CMAKE_COMMAND} -E remove -f temp.sed
   COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG}

Modified: llvm/trunk/tools/llvm-config/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/Makefile?rev=143171&r1=143170&r2=143171&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/Makefile (original)
+++ llvm/trunk/tools/llvm-config/Makefile Thu Oct 27 20:02:16 2011
@@ -68,6 +68,8 @@
 	>> temp.sed
 	$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
 	>> temp.sed
+	$(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
+	>> temp.sed
 	$(Verb) $(SED) -f temp.sed < $< > $@
 	$(Verb) $(RM) temp.sed
 	$(Verb) cat PerobjDepsFinal.txt >> $@
@@ -88,6 +90,8 @@
 	>> temp.sed
 	$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
 	>> temp.sed
+	$(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
+	>> temp.sed
 	$(Verb) $(SED) -f temp.sed < $< > $@
 	$(Verb) $(RM) temp.sed
 	$(Verb) cat PerobjDepsInclFinal.txt >> $@
@@ -106,6 +110,8 @@
 	  >> temp.sed
 	$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
 	  >> temp.sed
+	$(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
+	  >> temp.sed
 	$(Verb) $(SED) -f temp.sed < $< > $@
 	$(Verb) $(RM) temp.sed
 	$(Verb) cat $(FinalLibDeps) >> $@

Modified: llvm/trunk/tools/llvm-config/llvm-config.in.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.in.in?rev=143171&r1=143170&r2=143171&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.in.in (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.in.in Thu Oct 27 20:02:16 2011
@@ -45,6 +45,7 @@
 my $LDFLAGS             = q{@LLVM_LDFLAGS@};
 my $SYSTEM_LIBS         = q{@LIBS@};
 my $LLVM_BUILDMODE      = q{@LLVM_BUILDMODE@};
+my $LLVM_OBJ_SUFFIX     = q{@LLVM_OBJ_SUFFIX@};
 #---- end Makefile values ----
 
 # Figure out where llvm-config is being run from.  Primarily, we care if it has
@@ -60,7 +61,7 @@
 chomp($ABS_RUN_DIR);
 
 # Compute the absolute object directory build, e.g. "foo/llvm/Debug".
-my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT/$LLVM_BUILDMODE";
+my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT$LLVM_OBJ_SUFFIX";
 $ABS_OBJ_ROOT = abs_path("$ABS_OBJ_ROOT") if (-d $ABS_OBJ_ROOT);
 chomp($ABS_OBJ_ROOT);
 





More information about the llvm-commits mailing list