gtest targets from CMakeLists.txt

Hi,

I downloaded and tried out CLion 1.5EAP this morning and I'm really happy to see that there is support for gtest in the IDE. The project I'm working on have ~ 170 CMakeLists.txt files and a lot of standalone test programs that use this framework. I added a new one this morning and for some reason it automatically created a gtest target for it so that when I ran it it looked nice in the IDE... but for all of the other test programs I did not get a "gtest target" in the target list..

So is there some sort of magic I can do in the CMakeLists.txt files to have it recognize all of the other programs that use gtest and create such a target for them?

Cheers,

Trond

3 comments
Comment actions Permalink

CLion tries (when it can) to detect them and use a Google Test configuration template. The detection rule is pretty simple: if the target is linked with gtest, then a Google Test configuration will be created for it automatically.
However, since this functionality was introduced only now, we've decided not to change the user's configurations that are already there. (We have Google Test support in CLion since 1.2 version)


In case you'd like to recreate all the configurations you can close the project, drop .idea folder from the project, open the project in CLion once again.

0
Comment actions Permalink

That seemed to do the trick (well, I just replaced workspace.xml with the following file to make sure that it pass on a variable to CMake so I can skip all modules our system that CLion don't support ;-) This is CPP-3310 )

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CMakeSettings" AUTO_RELOAD="false" GENERATION_OPTIONS="-D JETBRAINS_CLION_IDE=1" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
    <ADDITIONAL_GENERATION_ENVIRONMENT>
      <envs />
    </ADDITIONAL_GENERATION_ENVIRONMENT>
  </component>
</project>


Thanks for the help

Cheers,

Trond
0
Comment actions Permalink

Great. And glad you liked the feature in general.

0

Please sign in to leave a comment.