summaryrefslogtreecommitdiff
path: root/tools/llvm-config
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-10-28 01:02:16 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-10-28 01:02:16 +0000
commitee826c8d9cab9e735b9b38acc5aab620fbc50afe (patch)
treefa604134e158dd33d53afa4dfd9dd73f982621cf /tools/llvm-config
parentc73d73eb881ebe7493e934c00ca1c474ffd0ed2d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-config')
-rw-r--r--tools/llvm-config/CMakeLists.txt2
-rw-r--r--tools/llvm-config/Makefile6
-rw-r--r--tools/llvm-config/llvm-config.in.in3
3 files changed, 10 insertions, 1 deletions
diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
index 60168623f13..69d3925cb26 100644
--- a/tools/llvm-config/CMakeLists.txt
+++ b/tools/llvm-config/CMakeLists.txt
@@ -48,6 +48,7 @@ set(LLVM_CXXFLAGS "@LLVM_CXXFLAGS@")
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 @@ add_custom_command(OUTPUT ${LLVM_CONFIG}
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}
diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
index c7f7b3234d6..6fee7de5b0f 100644
--- a/tools/llvm-config/Makefile
+++ b/tools/llvm-config/Makefile
@@ -68,6 +68,8 @@ llvm-config-perobj: llvm-config.in $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/
>> 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 @@ llvm-config-perobjincl: llvm-config.in $(GenLibDeps) $(LibDir) $(wildcard $(LibD
>> 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 @@ $(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
>> 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) >> $@
diff --git a/tools/llvm-config/llvm-config.in.in b/tools/llvm-config/llvm-config.in.in
index 03efb031bbb..a456dc6e774 100644
--- a/tools/llvm-config/llvm-config.in.in
+++ b/tools/llvm-config/llvm-config.in.in
@@ -45,6 +45,7 @@ my $CXXFLAGS = q{@LLVM_CXXFLAGS@};
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 @@ my $ABS_RUN_DIR = abs_path("$RUN_DIR/..");
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);