mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 21:20:37 +00:00
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
This commit is contained in:
parent
c73d73eb88
commit
ee826c8d9c
@ -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}
|
||||
|
@ -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) >> $@
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user