The question maybe a little blurry. Therefore, I will try to describe it in more detail and break down into smaller questions.

For example, I want to write a program that requires several libraries. What is the best way to add these libraries to the project?

Some libraries are not in the repository and they have to be downloaded from the site somewhere (?) To unpack, somehow (?) To add the inclusions and the source code of these libraries.

When can I create .so/.dll files, and when can I immediately collect one executable file from all .cpp files?

I also want to make the program cross-platform, and if I put the library from the repository on Linux , then how to be on other platforms.

Or is there no right, universal way for these questions and how will it work?

So far, the best solution for myself is seeing only cmake .

It would be cool to find a tool that could load the necessary libraries by itself :) as in npm or gradle .

Closed due to the fact that the question is too common for participants Vlad from Moscow , pavel , aleksandr barakin , user194374, ߊߚߤߘ 5 Feb '17 at 9:21 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    QtCreator + qmake.

    You can compile libraries directly under different compilers or different versions of the same compiler, for example msvc2010, msvc2013, msvc2015. Next, a pri file is created for the library, which specifies the path to the readers, and depending on the compiler used and the version of the compiler, the necessary lib / so files are included.

    As a result, when in the project we want to connect the library, we just need to specify the path to the pri file.

    Example pri file:

     INCLUDEPATH += $$PWD/include DEPENDPATH += $$PWD/include !isEmpty(OUT_DIR) { LIBS += -L$${OUT_DIR} } else { LIBS += -L$$PWD/bin/$${QT_VERSION} } LIBNAME = DatabaseHelper2 LIBS += -l$${LIBNAME}$${STATIC_POSTFIX}$${MYCOMPILER_POSTFIX}$${DEBUG_POSTFIX} 

    Connection example in the project:

     include(D:/git_projects/DatabaseHelper2/DatabaseHelper2.pri) 

    And create some common.pri, where we calculate variables:

     compileName=$$basename(QMAKESPEC) equals(compileName, win32-msvc2013) { MYCOMPILER_POSTFIX = _vc12 } equals(compileName, win32-msvc2010) { MYCOMPILER_POSTFIX = _vc10 } equals(compileName, win32-msvc2015) { MYCOMPILER_POSTFIX = _vc14 } DEBUG_POSTFIX = CONFIG(debug, debug|release) { DEBUG_POSTFIX = _d } STATIC_POSTFIX = contains(DEFINES, STATIC) { STATIC_POSTFIX = _static } 

    And connect it the very first:

     include(D:/git_projects/common.pri) include(D:/git_projects/DatabaseHelper2/DatabaseHelper2.pri)