CMake in a vanilla CLion install?


#1

So with a vanilla CLion install, in the debug pane I get:

/nix/store/55cymi70dgw6yh9mqfp2n5f3hjy237qi-clion-2018.2.5/clion-2018.2.5/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G “CodeBlocks - Unix Makefiles” /home/jonathan/CLionProjects/endless-sky
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

is this expected? What is the right approach here - do people generally hand craft a derivation for the specific make + gcc/clang etc combination they want, to inject the right dependencies in? Would wee want to add that derivation to the top level nix pkgs so that everyone could share it? What happens if you want to use Bazel with CLion - is that another derivation? And so forth…

Thanks for all the help with my many questions on the board, this community is just excellent. Hopefully one day I’ll get good enough at this stuff to be able to answer rather than just ask all the time!


#2

Is there any code that you can share? It looks like the environment is missing gnumake but it’s hard to tell.

In general you want to pin the versions of everything for a single project. So add a shell.nix that holds gnumake, bazel, … maybe even clion if it’s part of the blessed dev environment. So pin a release of nixpkgs + potentially some overrides for your project-specific needs.


#3

If possible it is better to use the cmake from nixpkgs. This one should also find gnumake.
Here is an example default.nix that can be loaded with nix-shell:

In this project I was building with ninja instead of make.