Moved from GitHub to not clog up the pull request. See CMake improvements and fixes for Linux, Windows and Mac for the original discussion.
Last post by me:
Alright, let’s take a step back and have a look at this.
Dropping everything, this is a step-by-step guide on how to get this working properly with CLion, Linux and Mac. Go over each step and make sure you’ve done them all.
- Patch UBT with this pull request
- Delete your current CMakeLists.txt.
- Set the compiler to Clang by going into Settings -> Build -> Toolchains -> CMake and setting two variables:
CLion compiler configuration
- When you’ve changed compilers, open CLion and invalidate the caches by going to File -> Invalidate Caches / Restart.
- Build UBT. Go to the root folder of the engine, and run the following command:
./GenerateProjectFiles.sh -project="<path>/<to>/<your>/<project>/<project>.uproject" -game -engine
Make sure this is an absolute path, and that it doesn’t go through any symlinks - CLion seems to have trouble with those. Omit “-engine” if you don’t plan on building any engine targets, or if you’re generating for a game project.
- Open the generated CMakeLists.txt in CLion.
- CLion will now begin to load the project. This initial loading may take a very long time, depending on the size and scope of the project. Before it’s done, nothing will work. You can see the progress of this in the bottom bar. Grab a drink and sit back.
Your paths will vary depending on your system, but those are valid for most Linux systems.
- In order to speed up loading times, you can comment out all engine-related build targets if you’ve no plans on building them (you can also omit the -engine switch from the previous command). You can also comment out any of your game targets that you don’t plan on building.
- After the loading has fully finished, you should be good to go. If not, we can start troubleshooting.