llvm.org GIT mirror llvm / ee826c8
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 Peter Collingbourne 8 years ago
3 changed file(s) with 10 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
4747 set(LLVM_LDFLAGS "@LLVM_LDFLAGS@")
4848 set(LIBS "@LIBS@")
4949 set(LLVM_BUILDMODE "@LLVM_BUILDMODE@")
50 set(LLVM_OBJ_SUFFIX "@LLVM_OBJ_SUFFIX@")
5051
5152 configure_file(
5253 ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.in.in
113114 COMMAND echo s!@LLVM_LDFLAGS@!${CMAKE_SHARED_LINKER_FLAGS}! >> temp.sed
114115 COMMAND echo s!@LIBS@!${LLVM_SYSTEM_LIBS}! >> temp.sed
115116 COMMAND echo s!@LLVM_BUILDMODE@!${CMAKE_BUILD_TYPE}! >> temp.sed
117 COMMAND echo s!@LLVM_OBJ_SUFFIX@!! >> temp.sed
116118 COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG}
117119 COMMAND ${CMAKE_COMMAND} -E remove -f temp.sed
118120 COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG}
6767 >> temp.sed
6868 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
6969 >> temp.sed
70 $(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
71 >> temp.sed
7072 $(Verb) $(SED) -f temp.sed < $< > $@
7173 $(Verb) $(RM) temp.sed
7274 $(Verb) cat PerobjDepsFinal.txt >> $@
8789 >> temp.sed
8890 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
8991 >> temp.sed
92 $(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
93 >> temp.sed
9094 $(Verb) $(SED) -f temp.sed < $< > $@
9195 $(Verb) $(RM) temp.sed
9296 $(Verb) cat PerobjDepsInclFinal.txt >> $@
104108 $(Verb) $(ECHO) 's/@LLVM_LDFLAGS@/$(subst /,\/,$(SUB_LDFLAGS))/' \
105109 >> temp.sed
106110 $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
111 >> temp.sed
112 $(Verb) $(ECHO) 's/@LLVM_OBJ_SUFFIX@/$(subst /,\/,/$(BuildMode))/' \
107113 >> temp.sed
108114 $(Verb) $(SED) -f temp.sed < $< > $@
109115 $(Verb) $(RM) temp.sed
4444 my $LDFLAGS = q{@LLVM_LDFLAGS@};
4545 my $SYSTEM_LIBS = q{@LIBS@};
4646 my $LLVM_BUILDMODE = q{@LLVM_BUILDMODE@};
47 my $LLVM_OBJ_SUFFIX = q{@LLVM_OBJ_SUFFIX@};
4748 #---- end Makefile values ----
4849
4950 # Figure out where llvm-config is being run from. Primarily, we care if it has
5960 chomp($ABS_RUN_DIR);
6061
6162 # Compute the absolute object directory build, e.g. "foo/llvm/Debug".
62 my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT/$LLVM_BUILDMODE";
63 my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT$LLVM_OBJ_SUFFIX";
6364 $ABS_OBJ_ROOT = abs_path("$ABS_OBJ_ROOT") if (-d $ABS_OBJ_ROOT);
6465 chomp($ABS_OBJ_ROOT);
6566