Page 1 of 1

[2.1] cmake generates wrong makefiles for nmake-target

Posted: Fri Sep 04, 2015 5:02 pm
by GrafZahl

I noticed that cmake generates wrong makefiles for nmake target on Windows platforms.
The error happens when you want to clean the code: "nmake clean" or if you compile also the Samples for Version 2.

It seems, that cmake generates a Makefile with such commands:

Code: Select all

 cd Samples\2.0\Common
     cd ..\..\..\
     cd Samples\2.0\Common
     D:\Compiler\MVS14.0\VC\bin\amd64\link.exe /lib 
     cd ..\..\..\
As you can see, some cd-commands have a backslash at the end. These backslashes are interpreted by nmake as multiline backslashes.
So insteas of doing this:

Code: Select all

cd ..\..\..\
cd Samples\2.0\Common
the nmake wants to do this:

Code: Select all

cd ..\..\.. cd Samples\2.0\Common
And this leads to an error: Unknown path.
The backslash after cd .. is in almost all Ogre makefiles, but only in case of the Samples and the Clean target it comes to an error during compile time due to the context where the backslash appears.

I'm not sure if this is an error of cmake or if the cmake configuration for Ogre3D is wrong. I also wrote a mail to the cmake-mailinglist: ... 61484.html

But maybe someone knows why cmake adds these backslashes at the end of line?
I also wonder why in the ogre project cmake generates so much directory changes. In all other projects where I tried cmake there was not a single cd-command in the makefiles. Maybe there is an option to prevent cmake from using cd and doing everything from the root path?
Or maybe there is a custom function in the Ogre cmake build system that adds cd-commands and also the backslash at the end of line?

I'm open for every idea that could help :)

BTW: As a workaround you can simply delete the backslash from the end of the cd-command and then everything compiles without errors. However you have to do it every time after generating the makefiles with cmake.

Best regards,