[2.1] cmake generates wrong makefiles for nmake-target

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
GrafZahl
Gnoblar
Posts: 10
Joined: Wed Sep 02, 2015 5:12 pm

[2.1] cmake generates wrong makefiles for nmake-target

Post by GrafZahl »

Hi

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
     $(CMAKE_COMMAND) -P 
CMakeFiles\OgreSamplesCommon.dir\cmake_clean_target.cmake
     cd ..\..\..\
     cd Samples\2.0\Common
     D:\Compiler\MVS14.0\VC\bin\amd64\link.exe /lib 
/out:..\..\..\lib\OgreSamplesCommon_d.lib 
@CMakeFiles\OgreSamplesCommon.dir\objects1.rsp
     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:
http://public.kitware.com/pipermail/cma ... 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,
GrafZahl

Post Reply