majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

CMakeLists.txt results in non-valid build files for Ninja builds #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The CMakeLists.txt contains code that seems to assume that you will build with 
make when using a gcc-compitable compiler, this results in invalid build files 
for atleast the Ninja build system.

What steps will reproduce the problem?
1.  Go into the yaml-cpp source root directory: 
2.  Run mkdir ninjabuild
3.  cd ninjabuild
4.  cmake .. -G "Ninja"
5.  ninja

What is the expected output? What do you see instead?

Expected build to be successful, instead it results in the following error:
ninja: error: build.ninja:225: bad $-escape (literal $ must be written as $$)

What version of the product are you using? On what operating system?
yaml-cpp 0.5.1, building on Ubuntu

Please provide any additional information below.

As far as I can discern the line 145 to 152 in the root CMakeLists.txt seems to 
be the problem. Specifically the use of $(MAKE) in both add_custom_target 
calls, as the build works with make I would assume that this results in valid 
makefiles. If so it might be a good idea to check that you are generating for 
makefiles and skip this part if it is generated for another build system 
instead.

Original issue reported on code.google.com by pierre.a...@gmail.com on 11 Jun 2013 at 6:22

GoogleCodeExporter commented 9 years ago
Thanks for the note. Could you provide a patch that does this?

Original comment by jbe...@gmail.com on 11 Jun 2013 at 1:14

GoogleCodeExporter commented 9 years ago
I'm not deeply into the details of every feature that CMake provides, but the 
following patch makes building possible with ninja and preserves functionality 
with make. It has been tested for both build systems.

Original comment by pierre.a...@gmail.com on 18 Jun 2013 at 12:15

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! Merged, 
https://code.google.com/p/yaml-cpp/source/detail?r=c19cdaef3b876baeb2884558e0956
0e2c6389400

Original comment by jbe...@gmail.com on 18 Jun 2013 at 1:24

GoogleCodeExporter commented 9 years ago
Hey, I discovered this issue and played around with the CMakeLists.txt before 
realising there was already a bug!

However, I fixed it and preserved the functionality when using Ninja, I've 
attached a fix if you're interested.

Original comment by samkell...@gmail.com on 27 Feb 2014 at 10:30

Attachments:

GoogleCodeExporter commented 9 years ago
I should add there was also a problem when running the commands, even with the 
correct build tool when yaml-cpp was included as a CMake subdirectory.

The WORKING_DIRECTORY parameters fix this.

Original comment by samkell...@gmail.com on 27 Feb 2014 at 10:33

GoogleCodeExporter commented 9 years ago
You're saying this is still an issue? Thanks for looking into it.

Original comment by jbe...@gmail.com on 28 Feb 2014 at 1:00

GoogleCodeExporter commented 9 years ago
It's not still as issue. I was using yaml-cpp through a git mirror so I could 
include it as a submodule to my project. However the mirror wasn't up-to-date 
(which I didn't realise while writing the fix) and didn't include this bug and 
patch!

But as I'd written it, I figured I may as well post it. :)

Original comment by samkell...@gmail.com on 28 Feb 2014 at 12:26

GoogleCodeExporter commented 9 years ago
Oh, but the WORKING_DIRECTORY thing when running `cmake --build . --target 
debuggable|releaseable` and yaml-cpp is being used as a cmake subdirectory to a 
larger project will still be an issue... but that's another bug I 'spose? I 
only discovered it while testing my fix for this one.

(I really should check I've said everything I had to say before clicking 
submit...)

Original comment by samkell...@gmail.com on 28 Feb 2014 at 12:29

GoogleCodeExporter commented 9 years ago
Replacing $(MAKE) with ${CMAKE_BUILD_TOOL} also works.

Original comment by del...@gmail.com on 7 May 2014 at 8:09

GoogleCodeExporter commented 9 years ago
I was just going back and reading through this, and I can't tell if this is 
still an issue. I'm going to close it, and if there's a related problem, please 
open a new issue with details.

Original comment by jbe...@gmail.com on 24 Jan 2015 at 10:11