AnArrayOfFunctions
AnArrayOfFunctions

Reputation: 3754

Qmake - how to configure include path order?

I have Qt-Creator on OpenSUSE. In it a have a C++ project with compiler 'clang'. There I have this '.pro' configuration:

INCLUDEPATH += "/✪Data_Disk⚜✼/Build/include/c++/v1/"

LIBS += "-stdlib=libc++"

LIBS += "/✪Data_Disk⚜✼/Build/lib/libc++abi.a"

QMAKE_CXXFLAGS += -std=c++14 -stdlib=libc++

TARGET = testCpp

SOURCES += main.cpp

And when I compile I got this output:

clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/unsupported/linux-clang -I../testCpp -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/✪Data_Disk⚜✼/Build/include/c++/v1 -I. -I../testCpp -I. -o main.o ../testCpp/main.cpp

I want it to be either:

clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/✪Data_Disk⚜✼/Build/include/c++/v1 -I/usr/share/qt4/mkspecs/unsupported/linux-clang -I../testCpp -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I../testCpp -I. -o main.o ../testCpp/main.cpp

Or:

clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/✪Data_Disk⚜✼/Build/include/c++/v1 -o main.o ../testCpp/main.cpp

In other words - I want to either include this path (

-I/✪Data_Disk⚜✼/Build/include/c++/v1

) before the system defined ones or to completely remove them and leave only it. Any ideas?

Upvotes: 3

Views: 1815

Answers (1)

svlasov
svlasov

Reputation: 10455

If you look into qmake source, for example Win32MakefileGenerator::writeStandardParts() or UnixMakefileGenerator::writeMakeParts() you will see that the flags are included in the following order:

  1. QMAKE_CC
  2. QMAKE_CXX
  3. QMAKE_CFLAGS
  4. QMAKE_CXXFLAGS
  5. INCLUDEPATH
  6. ...

INCLUDEPATH always goes after the first four. You can use QMAKE_CXXFLAGS and add -I path there:

QMAKE_CXXFLAGS += -I/✪Data_Disk⚜✼/Build/include/c++/v1

Upvotes: 6

Related Questions