QtCreator, cmake and source_group



  • I am using QtCreator with CMake and I want to group files in Projects view in QtCreator. source_group seems to be the way to go, but a line of "SOURCE_GROUP("Source Files" FILES ${SOURCES})" doesn't seem to have any effect on QtCreator. Should such configuration work out of the box?
    If it is not a supported scenario work: are changes needed on QtCreator side or CMake side (CodeBlocks generator?)?


  • Moderators

    Nope, SOURCE_GROUP is not supported by Qt Creator AFAIR.

    Improvements to the CMake code are welcome in case you want to implement it:-)



  • Really too bad.. I have some CPP files which I would like to see in the source tree even though they are not part of a add_executable or a add_library statement.

    Is there any way of adding them?
    Something that will generate an OTHER_FILES equivalent...

    Thanks


  • Moderators

    Tallia1: Please do not necro-post, open a new thread instead.

    Sorry, I don't know much about the details of the cmake integration, so unfortunately I can't help. Just wipping up a qmake project using "qmake -project" and then removing the qmake call in creator usually works well enough for me to not bother with other build systems too much:)



  • Tobias, sorry but I need to necro this post as I finally found a solution for it.
    Unfortunately source_group does not work for QtCreator. Instead you can do the following:

    @add_custom_target(dummy SOURCES ${HEADERS} ${SOURCES})@

    The "custom target":http://www.cmake.org/cmake/help/v3.0/command/add_custom_target.html has no command specified, so it will do nothing beyond adding the files to the source tree.

    I am going to submit a feature request for QtCreator nonetheless


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.