summaryrefslogtreecommitdiff
path: root/mkspecs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-05-30 14:43:08 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-06-09 00:09:33 +0000
commit3702b3f68b2dccbdb7203f8a4caeec8578556aba (patch)
treeff2c363bbc701e528f440b5c8e53643df6a19dc2 /mkspecs
parentda104aa308c7807e62c137a7972e70e9bf2dbfb2 (diff)
downloadqtbase-3702b3f68b2dccbdb7203f8a4caeec8578556aba.tar.gz
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>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/toolchain.prf21
1 files changed, 19 insertions, 2 deletions
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
index 46a9c5707a..d3487ef1ab 100644
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -40,19 +40,36 @@ isEmpty($${target_prefix}.INCDIRS) {
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
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_libraries = false
for (line, output) {
- line ~= s/^ *// # remove leading spaces
+ line ~= s/^[ \\t]*// # remove leading spaces
contains(line, "LIBRARY_PATH=.*") {
line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
paths = $$split(line, $$QMAKE_DIRLIST_SEP)
for (path, paths): \
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:
add_includes = true
} else: contains(line, "End of search.*") {
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 {
!contains(line, ".* \\(framework directory\\)"): \
QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)