Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-8359

CMake compiler flags are not interpreted by parser

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 3.6.0-beta1
    • Qt Creator 2.6.0, Qt Creator 2.7.0, Qt Creator 2.8.0-beta
    • C/C++/Obj-C++ Support
    • None
    • Ubuntu 12.10

    Description

      With the following CMakeLists.txt
      -------------------------------
      cmake_minimum_required(VERSION 2.6)

      project(Test)

      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMYTEST")

      add_executable(Test main.cpp)
      -------------------------------

      and this code:

      -------------------------------
      #include <iostream>

      int main()

      { #ifdef MYTEST std::cout << "MYTEST" << std::endl; #else std::cout << "NOT MYTEST" << std::endl; #endif }

      -------------------------------

      The output is:

      MYTEST

      indicating that the flag/definition MYTEST was set correctly. However, the highlighter shows this line as gray:

      std::cout << "MYTEST" << std::endl;

      indicating it thinks that MYTEST is not defined. This is very confusing.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            erikv Erik Verbruggen
            daviddoria David Doria
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes