Results 1 to 3 of 3

Thread: Doubt about the variable QMAKE_CXXFLAGS

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2018
    Posts
    31
    Thanks
    8
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Doubt about the variable QMAKE_CXXFLAGS

    Hi,
    What do the following instructions?
    win32:!win32-g++{ #?????
    QMAKE_CXXFLAGS += -openmp #?????
    QMAKE_LFLAGS += -openmp #?????
    }else{
    QMAKE_CXXFLAGS+= -fopenmp #?????
    QMAKE_LFLAGS += -fopenmp #?????
    }
    QMAKE_CXXFLAGS is defined as:
    Specifies the C++ compiler flags for building a project. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
    OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++, and Fortran.
    I do not understand why in some instructions it appears -openmp and in others -fopenmp.
    when is it necessary to use QMAKE_CXX and how do I know what value or variable (openmp) should I add?
    Thanks.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Doubt about the variable QMAKE_CXXFLAGS

    QMAKE_CXXFLAGS does not require any particular values, your C++ compiler does.
    Similarly, QMAKE_LFAGS contains options needed by your linker.
    This project file is attempting to cater for different environments in which it may be built and the different syntax/requirement of the compiler and linker. In this specific case it turns on compiler and linker support for OpenMP. The details of the switches accepted by your compiler/linker will be in their documentation. Whether you need them or not is driven by your project.
    Qt Code:
    1. # This structure is called a scope in the qmake manual. It functions a little like an if-then-else statement.
    2. # vvvvvvvvvvvvvvv
    3. win32:!win32-g++{ # On the Windows platform (win32) and not (!) using the GNU compiler (win32-g++)
    4. QMAKE_CXXFLAGS += -openmp # pass this option to the C++ compiler when compiling files
    5. QMAKE_LFLAGS += -openmp # and pass this option to the linker when linking the project
    6. } else { # On Windows with the GNU compiler and all other platforms (assuming GNU compiler)
    7. QMAKE_CXXFLAGS+= -fopenmp # and pass this option to the linker when linking the project
    8. QMAKE_LFLAGS += -fopenmp and pass this option to the linker when linking the project
    9. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jun 2018
    Posts
    31
    Thanks
    8
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: Doubt about the variable QMAKE_CXXFLAGS

    I understand. Thank you.

Similar Threads

  1. Replies: 3
    Last Post: 6th February 2019, 19:07
  2. Replies: 2
    Last Post: 20th October 2017, 00:25
  3. Variable variable names
    By KeineAhnung in forum Newbie
    Replies: 2
    Last Post: 22nd June 2014, 20:00
  4. Necessitas: dynamic_cast_will_always_fail / How to set QMAKE_CXXFLAGS
    By sedi in forum Installation and Deployment
    Replies: 1
    Last Post: 14th May 2012, 06:30
  5. Doubt ?
    By Cutey in forum Qt Tools
    Replies: 2
    Last Post: 3rd March 2007, 10:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.