CMake source_group doesn't work on Qtcreator












0















In my project I have a top level CMakeLists.txt where I define general project properties:



cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif (CCACHE_PROGRAM)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(databaseclient LANGUAGES CXX VERSION 0.1.0.0 DESCRIPTION "Asynchronous database client")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif(NOT CMAKE_BUILD_TYPE)

add_subdirectory(src)


And in my project's source folder I define an OBJECT library that will later be linked to static and dynamic libraries:



set(
SOURCE_FILES
${PROJECT_SOURCE_DIR}/include/databaseclient/parameters.hpp
)
add_library(
${PROJECT_NAME}
OBJECT
${SOURCE_FILES}
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON
)
target_compile_features(
${PROJECT_NAME}
PUBLIC
cxx_std_11 cxx_noexcept
cxx_auto_type
cxx_constexpr
cxx_deleted_functions
cxx_inline_namespaces
cxx_lambdas
cxx_noexcept
cxx_nullptr
cxx_override
cxx_range_for
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
ASIO_STANDALONE=1
ASIO_NO_EXCEPTIONS=1
ASIO_NO_DEPRECATED=1
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${byte-lite_SOURCE_DIR}/include/nonstd
${asio_SOURCE_DIR}/asio/include/
${PROJECT_SOURCE_DIR}/include/
)


QtCreator creates a folder structure where a node has the full path to my source files, which is obviously suboptimal. I tried to add a source_group to the list under the src folder but QtCreator seems to just ignore it.



How can I get source_group to work?










share|improve this question























  • Thanks, turn that into an answer so I can accept it.

    – ruipacheco
    Dec 28 '18 at 20:14
















0















In my project I have a top level CMakeLists.txt where I define general project properties:



cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif (CCACHE_PROGRAM)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(databaseclient LANGUAGES CXX VERSION 0.1.0.0 DESCRIPTION "Asynchronous database client")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif(NOT CMAKE_BUILD_TYPE)

add_subdirectory(src)


And in my project's source folder I define an OBJECT library that will later be linked to static and dynamic libraries:



set(
SOURCE_FILES
${PROJECT_SOURCE_DIR}/include/databaseclient/parameters.hpp
)
add_library(
${PROJECT_NAME}
OBJECT
${SOURCE_FILES}
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON
)
target_compile_features(
${PROJECT_NAME}
PUBLIC
cxx_std_11 cxx_noexcept
cxx_auto_type
cxx_constexpr
cxx_deleted_functions
cxx_inline_namespaces
cxx_lambdas
cxx_noexcept
cxx_nullptr
cxx_override
cxx_range_for
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
ASIO_STANDALONE=1
ASIO_NO_EXCEPTIONS=1
ASIO_NO_DEPRECATED=1
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${byte-lite_SOURCE_DIR}/include/nonstd
${asio_SOURCE_DIR}/asio/include/
${PROJECT_SOURCE_DIR}/include/
)


QtCreator creates a folder structure where a node has the full path to my source files, which is obviously suboptimal. I tried to add a source_group to the list under the src folder but QtCreator seems to just ignore it.



How can I get source_group to work?










share|improve this question























  • Thanks, turn that into an answer so I can accept it.

    – ruipacheco
    Dec 28 '18 at 20:14














0












0








0








In my project I have a top level CMakeLists.txt where I define general project properties:



cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif (CCACHE_PROGRAM)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(databaseclient LANGUAGES CXX VERSION 0.1.0.0 DESCRIPTION "Asynchronous database client")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif(NOT CMAKE_BUILD_TYPE)

add_subdirectory(src)


And in my project's source folder I define an OBJECT library that will later be linked to static and dynamic libraries:



set(
SOURCE_FILES
${PROJECT_SOURCE_DIR}/include/databaseclient/parameters.hpp
)
add_library(
${PROJECT_NAME}
OBJECT
${SOURCE_FILES}
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON
)
target_compile_features(
${PROJECT_NAME}
PUBLIC
cxx_std_11 cxx_noexcept
cxx_auto_type
cxx_constexpr
cxx_deleted_functions
cxx_inline_namespaces
cxx_lambdas
cxx_noexcept
cxx_nullptr
cxx_override
cxx_range_for
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
ASIO_STANDALONE=1
ASIO_NO_EXCEPTIONS=1
ASIO_NO_DEPRECATED=1
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${byte-lite_SOURCE_DIR}/include/nonstd
${asio_SOURCE_DIR}/asio/include/
${PROJECT_SOURCE_DIR}/include/
)


QtCreator creates a folder structure where a node has the full path to my source files, which is obviously suboptimal. I tried to add a source_group to the list under the src folder but QtCreator seems to just ignore it.



How can I get source_group to work?










share|improve this question














In my project I have a top level CMakeLists.txt where I define general project properties:



cmake_minimum_required(VERSION 3.11 FATAL_ERROR)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif (CCACHE_PROGRAM)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(databaseclient LANGUAGES CXX VERSION 0.1.0.0 DESCRIPTION "Asynchronous database client")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG)
endif(NOT CMAKE_BUILD_TYPE)

add_subdirectory(src)


And in my project's source folder I define an OBJECT library that will later be linked to static and dynamic libraries:



set(
SOURCE_FILES
${PROJECT_SOURCE_DIR}/include/databaseclient/parameters.hpp
)
add_library(
${PROJECT_NAME}
OBJECT
${SOURCE_FILES}
)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE ON
)
target_compile_features(
${PROJECT_NAME}
PUBLIC
cxx_std_11 cxx_noexcept
cxx_auto_type
cxx_constexpr
cxx_deleted_functions
cxx_inline_namespaces
cxx_lambdas
cxx_noexcept
cxx_nullptr
cxx_override
cxx_range_for
)
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
ASIO_STANDALONE=1
ASIO_NO_EXCEPTIONS=1
ASIO_NO_DEPRECATED=1
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${byte-lite_SOURCE_DIR}/include/nonstd
${asio_SOURCE_DIR}/asio/include/
${PROJECT_SOURCE_DIR}/include/
)


QtCreator creates a folder structure where a node has the full path to my source files, which is obviously suboptimal. I tried to add a source_group to the list under the src folder but QtCreator seems to just ignore it.



How can I get source_group to work?







c++ c++11 cmake qt-creator






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 28 '18 at 19:33









ruipachecoruipacheco

4,216104687




4,216104687













  • Thanks, turn that into an answer so I can accept it.

    – ruipacheco
    Dec 28 '18 at 20:14



















  • Thanks, turn that into an answer so I can accept it.

    – ruipacheco
    Dec 28 '18 at 20:14

















Thanks, turn that into an answer so I can accept it.

– ruipacheco
Dec 28 '18 at 20:14





Thanks, turn that into an answer so I can accept it.

– ruipacheco
Dec 28 '18 at 20:14












1 Answer
1






active

oldest

votes


















1














source_group is used for the projects that are created by cmake that use a generator like Visual Studio, otherwise it is just ignored. I saw that QtCreator has a drop down list for the generator. Which one are you using? I didn't see any documentation about how QtCreator would interpret a project to list files into it's own GUI. That's beyond what cmake controls.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963481%2fcmake-source-group-doesnt-work-on-qtcreator%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    source_group is used for the projects that are created by cmake that use a generator like Visual Studio, otherwise it is just ignored. I saw that QtCreator has a drop down list for the generator. Which one are you using? I didn't see any documentation about how QtCreator would interpret a project to list files into it's own GUI. That's beyond what cmake controls.






    share|improve this answer






























      1














      source_group is used for the projects that are created by cmake that use a generator like Visual Studio, otherwise it is just ignored. I saw that QtCreator has a drop down list for the generator. Which one are you using? I didn't see any documentation about how QtCreator would interpret a project to list files into it's own GUI. That's beyond what cmake controls.






      share|improve this answer




























        1












        1








        1







        source_group is used for the projects that are created by cmake that use a generator like Visual Studio, otherwise it is just ignored. I saw that QtCreator has a drop down list for the generator. Which one are you using? I didn't see any documentation about how QtCreator would interpret a project to list files into it's own GUI. That's beyond what cmake controls.






        share|improve this answer















        source_group is used for the projects that are created by cmake that use a generator like Visual Studio, otherwise it is just ignored. I saw that QtCreator has a drop down list for the generator. Which one are you using? I didn't see any documentation about how QtCreator would interpret a project to list files into it's own GUI. That's beyond what cmake controls.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 28 '18 at 21:14

























        answered Dec 28 '18 at 21:08









        FredFred

        1,28698




        1,28698






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53963481%2fcmake-source-group-doesnt-work-on-qtcreator%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas

            Can't read property showImagePicker of undefined in react native iOS