c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -


introduction

i using integrated development environment (ide) qt creator v3.3.1 , build system cmake v3.2.1 develop in c++ programming language.

currently implementing own custom build "framework", can use same cmake modules in each of projects. framework supports generation of source files corba , protocol buffers interface design language (idl) files, example. @ moment implementing support qt framework v5.

the directory structure of projects follows (using convention on configuration):

├── cmake              # must contain source files of custom "cmake" │                      # framework (usually shared directory). ├── config             # may contain configuration files application. ├── doc                # may contain documentation files. │   └── example        # may contain .cc files example executables. ├── form               # may contain "qt framework" .ui files. ├── idl                # may contain corba .idl files. ├── include            # may contain .h files in arbitrary directory │                      # structure. ├── proto              # may contain "protocol buffers" .proto files. ├── src                # may contain .cc files in arbitrary directory │   │                  # structure. │   └── main.cc        # source definition file executable of │                      # application. ├── test               # may contain files automated tests. ├── changelog ├── cmakelists.txt ├── license ├── readme.md ├── run_application.sh └── run_build.sh 

i used *-nix command tree produce output above.

all directories, except cmake directory containing "framework" optional.

the "framework" builds object library plus static library (and optionally shared library) files in src directory (ignoring src/main.cc - source main executable application - if exist).

therefore following done via cmake in "framework":

add_library(${project_name}_objlib             object ${project_definition_source_files_list}) add_library(${project_name}_staticlib             static             $<target_objects:${project_name}_objlib>) target_link_libraries(${project_name}_staticlib                       ${project_link_libraries_list}) if(option_build_shared)   add_library(${project_name}_sharedlib               shared               $<target_objects:${project_name}_objlib>)   target_link_libraries(${project_name}_sharedlib                         ${project_link_libraries_list}) endif() 

as can see source definition files (src/*.cc) used input add_library function.

problems

the build approach described above works nice command line, in "projects" view of qt creator following visible:

  • cmake/*
  • ../*/usr/lib64/cmake/qt5*
  • form/*
  • src/*

i need solution following 2 problems:

  1. show files , directories not visible in "projects" view of qt creator. in case config, doc, idl, include, proto, test, changelog, license , readme.md
  2. hide directories "projects" view of qt creator. in case cmake , path cmake modules of qt5.

after reading following posts, seems no "clean" solution exists problems described:

approaches

i've tried following already;

  • adding files should visible in "projects" view of qt creator input add_library function of object library: does not work, since following applies object library:

    object libraries may contain sources compile, header files, , other files not affect linking of normal library (e.g. .txt).

  • adding files should visible in "projects" view of qt creator input add_library function of static library: does not work, since causes static library build "from scratch". reason input files 2 add_library function calls differ approach.
  • adding files should visible in "projects" view of qt creator input add_executable function: does not work, since have projects not build executable.
current solution uses "dummy" target:

# parses source files of project correctly displayed in # "projects" view of integrated development environment (ide) "qt creator". add_custom_target(qt_creator_parse_project                   sources ${project_source_files_list}) 

the variable project_source_files_list contains absolute path files should visible in "projects" view of qt creator.

this works, flaw build target qt_creator_parse_project visible, e.g. if running cmake --build . --target help:

the following of valid targets makefile: ... (the default if no target provided) ... clean ... depend ... edit_cache ... rebuild_cache ... <project_name> ... qt_creator_parse_project ... [...] 

questions

finally, here 2 questions:

  1. does better solution exists using "dummy" target populate "projects" view of qt creator without modifying behavior of build process? if not, possible hide "dummy" target user?
  2. is possible ignore directories , folders automatically added "projects" view of qt creator via cmake? if not, possible qt creator?

thanks reading long post. wrote down details make sure other people not run same problems.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -