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. Cmake in QtCreator: Headers and includes
Forum Updated to NodeBB v4.3 + New Features

Cmake in QtCreator: Headers and includes

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 20.7k 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.
  • M Offline
    M Offline
    Miguel S.
    wrote on last edited by
    #1

    Hi there,

    I'm using qtcreator with cmake to code a C++ library. As the library is supposed to be light and doesn't need to do any GUI, I'm not actually coding against Qt.

    I've just recently decided to convert to cmake -- before I was using hand-written makefiles :-S -- and I've found two issues with qtcreator (though it could well be me not using cmake appropriately)

    1. I've got many header files *.h and *.hxx which are included in several *.cpp files but do not show up in the project tree on qtcreator, is there any way of telling qtcreator that those files do belong to the project?

    2. I'm using boost threads, but for some reason qtcreator doesn't expand the macros well and doesn't include the implementation headers (in my case pthreads), which results on it giving me undefined type warnings when the compiler has no trouble finding said types. I thought I could hack this by just feeding qtcreator a definition (BOOST_THREAD_PLATFORM_PTHREAD) but I don't want to mess up the compilation. Anyway I can do this?

    I tested with QtCreator 2.0.1 in MacOS X 10.6.6 and QtCreator 2.0.0 in Ubuntu 10.10.

    Thanks in advance,
    Miguel S.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tony
      wrote on last edited by
      #2

      Hi,

      I've an answer only for point (1). Locate the point where you set the sources for your projects (i.e. cpp files), and add .h and .hxx too.

      Like this example:

      set( MY_SRCS
      include/version.h
      include/idcache.h
      src/json.cpp
      include/json.h
      src/diskinfo.cpp
      include/diskinfo.h
      src/exif.cpp
      include/exif.h
      include/networkmanager.h
      include/networkmanager_p.h
      )

      Reload everything in QtCreator and you'll see all your files.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Miguel S.
        wrote on last edited by
        #3

        Hi,

        Thanks a lot! That worked perfectly :) I had assumed adding the headers to the sources variable would confuse cmake (thought it might try to compile the headers) but both cmake and qtcreator do the right thing.

        Any clues about the second point? I'm really addicted to auto-completion :P

        Thanks again,
        Miguel S.

        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