[cmake-developers] Bug in CMake: Generated Ninja files do not work on Windows

Michael.Jaentsch at gmx.de Michael.Jaentsch at gmx.de
Tue Jun 7 02:07:55 EDT 2016


Hi,
 
problem is not the POST_BUILD which is set to "cd ." as you said but the CMAKE_CXX_ARCHIVE_FINISH which is before the POST_BUILD
 
I attached a small example which is using a cross toolchain for cross compiling mips24.
 
On my windows host it generates a build rule which looks like this:
rule CXX_STATIC_LIBRARY_LINKER__ctrl
  command = cmd.exe /C "$PRE_LINK && "C:\Program Files\CMake\bin\cmake.exe" -E remove $TARGET_FILE && D:\gcc\win32\mips-sde-elf\bin\mips-sde-elf-ar.exe qc $TARGET_FILE $LINK_FLAGS $in && : $TARGET_FILE && $POST_BUILD"
  description = Linking CXX static library $TARGET_FILE
  restat = $RESTAT

 
You see the : command before the $POST_BUILD
 
Michael
 

Gesendet: Montag, 06. Juni 2016 um 17:00 Uhr
Von: "Brad King" <brad.king at kitware.com>
An: "Michael Jäntsch" <Michael.Jaentsch at gmx.de>
Cc: cmake-developers at cmake.org
Betreff: Re: [cmake-developers] Bug in CMake: Generated Ninja files do not work on Windows
On 06/06/2016 10:11 AM, "Michael Jäntsch" wrote:
> I would like to report a bug which I found in CMake 3.6.0-rc1. However,
> it is also present in release 3.5.2 and probably earlier releases as well.
>
> Description:
> The generated rule in rules.ninja for linking static libraries contains
> the command for actual linking and an additional command ": $TARGET_FILE".
> This works fine on linux but fails on windows (":" is not a valid command).

I'm not able to see the behavior you describe. The Ninja generator is
well-tested on Windows. The code that generates a ":" command is here:

https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalNinjaGenerator.cxx;hb=v3.6.0-rc1#l291

but is conditioned to generate "cd ." on Windows hosts instead.

Where did you get the CMake binary you're running?

What toolchain are you using to build?

Can you provide a sample CMakeLists.txt file (or source tarball)
that shows the problem?

Thanks,
-Brad
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ninjaTest.zip
Type: application/zip
Size: 1809 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160607/e91ef8e5/attachment.zip>


More information about the cmake-developers mailing list