[UBT] CMakefileGenerator does not generate includes and definitions

Generating CMakeLists.txt on Linux leads to empty include_dirs() and empty add_definitions() declarations. Which in turn leads to project files that are generated by CMake (like Eclipse CDT) don’t include them as well and the indexer can’t resolve 99% of the needed stuff.

I tracked it down to WriteCMakeLists in CMakefileGenerator.cs - the loop over the CurProject.IntelliSenseIncludeSearchPaths is not executed because the list is empty (but it works in the codelite generator - which is very strange, because they share the same code relevant for filling it)

Also the codelite generator takes CurProject.IntelliSenseSystemIncludeSearchPaths into account - cmake does not - is there any particular reason behind this? Or just missing from the include paths?

No error output while generating the data:


mgerhardy@srv055198:~/dev/UnrealEngine$ ./GenerateProjectFiles.sh 

Setting up Unreal Engine 4 project files...

+ xbuild Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj /verbosity:quiet /nologo /p:TargetFrameworkVersion=v4.0 /p:Configuration=Development
+ mono Binaries/DotNET/UnrealBuildTool.exe -makefile -kdevelopfile -qmakefile -cmakefile -codelitefile
Using clang version '3.6.0' (string), 3 (major), 6 (minor), 0 (patch)
Generating data for project indexing... 100%
Generating data for project indexing... 100%
Generating data for project indexing... 100%
Generating data for project indexing... 100%
Writing project files... 100%

My mono version:

Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

My Linux version:

mgerhardy@srv055198:~/dev/UnrealEngine$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 15.04
Release:	15.04
Codename:	vivid

Hey mgerhardy-

Could you explain what you were doing when you encountered this? Was this an error when building the engine? What steps did you take that caused the issue so I can try to reproduce this behavior on my end.

Cheers

I just cloned UnrealEngine from github and executed

./Setup.sh; ./GenerateProjectFiles.sh

unreal cmake - Pastebin.com ← stripped down to the relevant parts - otherwise it would have been too big.

I apologize but I’m not sure I fully understand the problem you’re having. I normally do not use CMake-based project. I can enter a ticket for investigation however it will be helpful if you can provide step by step instructions to reproduce what you’re experiencing for me to include with the ticket.

After doing the above mentioned steps to let UnrealBuildTool generate the CMakeLists.txt file I usually execute one of the cmake project file generators (see cmake-generators(7) — CMake 3.0.2 Documentation for a list) like this:

cmake -G"Eclipse CDT4 - Unix Makefiles"

or

cmake -G"Xcode"

in the UnrealEngine directory.
That will generate the project files - but with the missing flags (for defines and includes) - which is due to the fact that these flags are already missing in the CMakeLists.txt and cmake is of course not able to generate proper project files without these flags (and in particular include and defines are needed to let the indexer work).

Hey mgerhardy-

Thank you for the additional information. I have included it in the bug report (UE-21965) for further investigation.

Cheers

9b1c48bbc0b0cf98ac51fa0eff0951af1546d149 This commit is the cause of my problem. It disabled the intellisense data generation. If I revert this commit, it works again. What exactly is the reason for having this disabled? I suppose CLion and stuff (support was added later on) can’t work without this data, too (but i will try)

This is a nice link, too - some stuff might be outdated already, but it might help others: Setting up Unreal Engine 4 CMake environment for CLion – Let's try Unreal

This pull request also fixes this bug: https://github.com/EpicGames/UnrealEngine/pull/1668