cmake options / build type
Hello,
We are currently evaluating CLion 2017.1.3 to see if it could be a viable alternative as our main IDE on a Linux workstation running CentOS 7. We currently support both VisualStudio projects and Makefiles for Linux. I generated cmake files for our projects. I can open our main CMakeLists.txt.
Our main CMakeLists has about 150 librairies and 450 executables.
We have both debug and release profiles. We also have product configurations let's call then A/B/C/D. For example application1 can be built for A/B/C and at different places in the code/libs there will be #ifdef (A).
Under VisualStudio, we had a DEBUG and RELEASE configuration for each product (DEBUG_A/DEBUG_B/...RELEASE_D).
Un Linux, in the Makefiles we had :
-a variable for DEBUG/RELEASE
-a variable for the product configuration (A/B/C/D)
-a variable for the compiler
Now I tried to do all this using cmake. Based on what I had read, it seemed like a better approach to a different build tree for each combination. So I add a cache property for the product:
SET(PRODUCT A CACHE STRING "Product configuration")
set_property(CACHE PRODUCT PROPERTY STRINGS A B C D)
We are constantly changing the current product configuration. Unfortunately I do not see any way to set these from the CLion IDE. I figure I could create custom build types like we had for visual studio, but even if I did I don't even see an easy way to switch.
Is there an option somewhere to have a combobox to select the build_type? The closest thing I found right now is to click Edit Configuration, then for each lib/executable there is a Configuration drop list but it contains only debug...
Could someone enlighten me as to what we need to do to use CLion. I don't see how we could use CLion without this.
Regards
Marc-André Hébert
请先登录再写评论。
After reading some other CLion articles. I have added the following to my main CMakeLists.txt:
I still didn't have access to the different configurations until I when in File > Settings > Build,Execution,Deployment > CMake. There I pressed the + button multiple times and each time it would add the next available configuration.
With this config, I can see that there is a cmake-build-X per added configuration which seems good. Also in the status bar at the bottom I can now click on Context to select a different context from a list. The only problem is that after selecting a context it is hard to tell which is active. It only displays an abbreviation of the context like this " Context: lib/exec [DA]". Now my products aren't really named A/B/C/D and some start with the same letter so I can't tell with a quick glance which one is currently active.
Is there any way to have the complete description or specify a different short name for the context?
Hi.
I think the best option for you would be this: https://youtrack.jetbrains.com/issue/CPP-8417. Please follow or upvote the ticket, when it'll be implemented, you can not only change the highlighting (like with the "Context" combo box) but also build/run different build types easily.