Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake doesn't recognize CMAKE_ECLIPSE_VERSION setting

I'm trying to generate an eclipse .project and .cproject from an existing cmake file. Running cmake from the project root I tried adding to the root CMakeLists.txt set(CMAKE_ECLIPSE_VERSION=4.2) which apparently might do nothing as it is a local variable, not the global env variable, if i understand correctly.

Trying to add the flag to the commandline like this:

cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_VERSION=4.2 .

Produces the following warning. So how does one let cmake know the eclipse version?

-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.

I checked the .project file and it seems to be using cdt 4. Pretty old.

kesten

like image 615
darKoram Avatar asked Feb 24 '13 03:02

darKoram


1 Answers

I had the same problem and after looking at CMake's code I noticed that the actual variable used to get the Eclipse's version is named _ECLIPSE_VERSION (starting with underscore) and not CMAKE_ECLIPSE_VERSION. Here's what the code looks like:

cmake -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.2 .

That worked for me!

EDIT: Older versions of CMake don't recognise Eclipse 4.2 (which uses CDT 8.1) but does recognize 3.7 (which uses CDT 8.0). I used -D_ECLIPSE_VERSION=3.7 and Juno picked up well the project configuration (previously I had unresolved inclusions due to incompatibility of the CDT4 files generated by default). As pointed out by m3tikn0b, newer versions of CMake do recognize until Eclipse Kepler 4.3.

like image 113
Oscar Vasquez Avatar answered Sep 20 '22 12:09

Oscar Vasquez