Qt World Summit: Submit your Presentation

CMAKE variable for several directories

  • Hi,

    We work with cmake toolchain files, and one entry looks like this
    set(SPECIAL_INCLUDE_DIRS /home/dir1 /homedir2 /home/dir3)

    later in the CmakeLists.txt we do

    As I did not manage to use my toolchain file in creator I tried to add a variable named SPECIAL_INCLUDE_DIRS to my cmake settings in qt creator under build settings. When I simply enter the directories with a space in between I end up with the following line in compilation:

    -I"/home/dir1 /homedir2 /home/dir3"
    so it has quotes around it instead of having several -I entries for every dir.

    Is there a way around it? I cannot change the cmake file where include_directories(${SPECIAL_INCLUDE_DIRS}) is, as other developers don't use qt creator and I would like to avoid making them adopt their toolchain files.

  • Lifetime Qt Champion

    @maxwell31 said in CMAKE variable for several directories:

    Is there a way around it?

    If you want a list, you have to use ';' as separator - see the cmake documentation

  • Thanks! it worked

Log in to reply