jucipp icon indicating copy to clipboard operation
jucipp copied to clipboard

Set CMake options

Open danielunderwood opened this issue 9 years ago • 3 comments

It would be nice to have some interface to set CMake options and defines on a per-project basis. I know now we have the cmake.command config variable that one could set options such as defines or a build system, but that seems to be on a global level.

What I was thinking is to have something like the cmake portion of the config file per project, possibly with added options generated by something like the output of cmake -LAH to get project options. I'm not sure of what the best way to do this would be though as I'm not exactly a fan of IDE config files being tied to a project.

If this is something that would be wanted and we can agree on a way to do it, I can try to get the changes in a PR in a couple weeks when I have some spare time.

danielunderwood avatar Dec 06 '16 23:12 danielunderwood

I might be misunderstanding here, but what I do if I want different CMake options that are not default is creating the build directory contents manually. For instance, let's say I want to test my project with the -Weverything flag turned on:

rm -r build # if it already exist
mkdir build && cd build
cmake -DCMAKE_CXX_FLAGS=-Weverything ..

Then when I open the project in juCi++, it will not touch these settings, but only run cmake again to create the needed compile_commands.json file.

There are other options as well that can automate this too, for instance:

rm -r build # if it already exist
CXXFLAGS=-Weverything juci .

eidheim avatar Dec 07 '16 09:12 eidheim

Actually, this is now my favorite:

CXXFLAGS=-Weverything juci .

Then choose Recreate Build in the Project menu:)

edit: using the environment variable CXXFLAGS has the advantage of working for Meson builds as well.

eidheim avatar Dec 07 '16 09:12 eidheim

I just realised that you can also add flags in build/compile_commands.json (after it is created) for individual files as well. But the source file in question has to be completely reparsed then. Either use Reload File in the File menu, or reopen the file manually.

edit: this is only with respect to libclang processing though, will not affect compilation.

eidheim avatar Dec 07 '16 10:12 eidheim