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. Files with the same prefix as target cpp file automatically get added to project?
Forum Updated to NodeBB v4.3 + New Features

Files with the same prefix as target cpp file automatically get added to project?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
cmakeproject
1 Posts 1 Posters 732 Views
  • 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.
  • D Offline
    D Offline
    daviddoria
    wrote on last edited by
    #1

    I was trying to test some different ways to add headers to a project (add_custom_target, source_group, etc.). To start to test this, I created a folder with my CMakeLists.txt:

    Project(TestProject)
    add_executable(Test Test.cpp)
    

    and two other files, Test.cpp and Test.h. When I opened the CMakeLists.txt file with QtCreator and generated the project, I was suprised to find Test.h was added to the project (shows up in the list of files under TestProject in the Projects panel on the left side of the QtCreator window). I created another header file, MyClass.h, and re-ran CMake and this file was not added to the project (as I originally expected). There was no reference to Test.h in Test.cpp and it does appear in the project, and even when I add a reference (#include "MyClass.h") to MyClass.h, it does not appear in the project.

    Is it the desired behavior for files with the same prefix to be added to the project? Or is there some other explanation of why Test.h would be added to the project without being mentioned in the CMakeLists.txt?

    Thanks,

    David

    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