Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Debugger problem with CMake project
Forum Updated to NodeBB v4.3 + New Features

Debugger problem with CMake project

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 13.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    I'm unable to use the debugger with CMake projects, it ignores the breakpoints because the executable is build without debugging info. Imported project has only one configuration (there are no Debug and Release configurations)

    The way around this is to create a custom build step that runs before make. It should invoke cmake.exe passing "-DCMAKE_BUILD_TYPE=Debug ." as an argument.

    Why is this needed? Is there something I can add to my CMakeLists.txt to configure this properly and have both Debug and Release configurations?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      miroslav
      wrote on last edited by
      #2

      When you open the project in Creator (by opening the CMakeLists.txt), it asks you to run cmake. At that step, enter "-DCMAKE_BUILD_TYPE=Debug" in the options field. That should do it.

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        Thanks, but this solves only first half of the problem. Is there a way to get both configurations and be able to switch between them like in Visual Studio?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          You are free to set up several build directories, each with a different configuration (e.g. one debug one release). Switching between configurations is then a matter of changing the build directory. As far as I know there is no way to automatically set up several build directories at once with cmake.

          If you are using Qt Creator: The IDE could in theory do that for you, but currently does not. Patches to improve cmake support are welcome.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved