[Qt-creator] Setup of CMake based projects

Michael Jackson mike.jackson at bluequartz.net
Fri Oct 4 21:28:31 CEST 2019


   > These things you can put into a my_config.cmake script which you can
    > "feed" to the cmake configuration run with the -C option: in that case,
    > the provided settings will first be written into the cache, and only
    > then cmake will start reading CMakeLists.txt - with the initial
    > cache variables already in place.
    
    People around me seem to have shell scripts that call "cmake -DFOO=bar
    [...]" to do the initial configuration.
    
    > If it would be a good idea to have a page in the "kits" setup that
    > includes such project specific settings!? For me it would not be the
    > logical place - except that it would of course allow to carry the
    > settings not only between build types, but even to other variants
    > of the same project.
    
    I guess it all depends:-)
    
    Some settings are definitely project specific and those make little
    sense in the Kit. But if you have lots of Paraview projects, then it
    might make sense to have all the settings related to setting that up
    in a kit.
    
    > But still, from the type of settings it is rather not tools, but
    > project related - but then it is not any more portable: if you change
    > some environment variable for a project in the "Release" build, you
    > also need to do it once more for the "Debug" build - it is not carried
    > over and cannot be ported to another project.
    
    Good point. We probably need something here.
    
 
What we do for multiple projects is setup a "Kit per Project" since each project (For us at least) will generally have different initial CMake values that need to be set. Whether it is different versions of Qt5 or just different options to our project (Python wrapping on or off). We end up with a bunch of Kits but each one does a specific job. We also essentially use a "my_config.cmake" file to feed into our CMakeLists.txt file. We just call it something else and if the user does not set it with a -D then we detect that and state all the variables that need to be set.

Just my 2 cents.

Mike Jackson





More information about the Qt-creator mailing list