Pick up default library paths for clang
We need to actually run the linker, otherwise clang will just run the preprocessing step as we asked for. We build as a shared library to not have to provide a main() function. Change-Id: Ied34757bb5c43a862bf2d9778340c497b93d572f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
da104aa308
commit
3702b3f68b
@ -40,19 +40,36 @@ isEmpty($${target_prefix}.INCDIRS) {
|
|||||||
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
|
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
|
||||||
darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH
|
darwin: cxx_flags += -isysroot $$QMAKE_MAC_SDK_PATH
|
||||||
|
|
||||||
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
|
clang: \
|
||||||
|
# Need to link to pick up library paths
|
||||||
|
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
|
||||||
|
else: \
|
||||||
|
# gcc is fine with just preprocessing
|
||||||
|
cxx_flags += -E -v
|
||||||
|
|
||||||
|
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines)
|
||||||
add_includes = false
|
add_includes = false
|
||||||
|
add_libraries = false
|
||||||
for (line, output) {
|
for (line, output) {
|
||||||
line ~= s/^ *// # remove leading spaces
|
line ~= s/^[ \\t]*// # remove leading spaces
|
||||||
contains(line, "LIBRARY_PATH=.*") {
|
contains(line, "LIBRARY_PATH=.*") {
|
||||||
line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
|
line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
|
||||||
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
|
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
|
||||||
for (path, paths): \
|
for (path, paths): \
|
||||||
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path)
|
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path)
|
||||||
|
} else: contains(line, "Library search paths:") {
|
||||||
|
add_libraries = true
|
||||||
} else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
|
} else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
|
||||||
add_includes = true
|
add_includes = true
|
||||||
} else: contains(line, "End of search.*") {
|
} else: contains(line, "End of search.*") {
|
||||||
add_includes = false
|
add_includes = false
|
||||||
|
} else: $$add_libraries {
|
||||||
|
# We assume all library search paths are absolute
|
||||||
|
!contains(line, "^/.*") {
|
||||||
|
add_libraries = false
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
QMAKE_DEFAULT_LIBDIRS += $$clean_path($$line)
|
||||||
} else: $$add_includes {
|
} else: $$add_includes {
|
||||||
!contains(line, ".* \\(framework directory\\)"): \
|
!contains(line, ".* \\(framework directory\\)"): \
|
||||||
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
|
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
|
||||||
|
Loading…
Reference in New Issue
Block a user