certik / yaml-cpp

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

Supply FindYamlCpp #127

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There currently is no FindYamlCpp.cmake (or similarly named) file. This makes 
it a little harder than it has to be to integrate this project into other 
projects.

You should supply such a file.

Original issue reported on code.google.com by svenst...@gmail.com on 12 Nov 2011 at 4:30

GoogleCodeExporter commented 9 years ago
What would this file do?

Original comment by jbe...@gmail.com on 12 Nov 2011 at 6:48

GoogleCodeExporter commented 9 years ago
Here is my current suggestion.

Original comment by svenst...@gmail.com on 12 Nov 2011 at 7:02

Attachments:

GoogleCodeExporter commented 9 years ago
It allows one to use FindPackage(YamlCpp) to get that package. Basically like 
pkg-config but works with CMake and not just on unix system. I currently use it 
like this: 
https://github.com/ducttape/ducttape-engine/blob/master/CMakeLists.txt#L69

Original comment by svenst...@gmail.com on 12 Nov 2011 at 7:04

GoogleCodeExporter commented 9 years ago
As an alternative, potentially easier solution, you could install a 
YamlCppConfig.cmake file, which would contain hard-coded values for finding the 
library. See 
http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_fi
le

Original comment by rkj...@gmail.com on 9 Mar 2012 at 9:57

GoogleCodeExporter commented 9 years ago
+1 for including a FindYamlCpp.cmake though I believe the one posted by 
{svenst..} maybe a bit more complicated then necessary:

1) I believe the use of "HINTS" is preferred over "PATHS" because PATHS will (I 
think) exclude cmake's default search paths
2) Most of the paths included in that cmake findscript are already part of the 
default search path for cmake (/usr, /usr/local on 'nix, /Library, 
/Library/Frameworks on osx

I'm not 100% confident on these but I recall running into these issues with 
cmake before... figured I'd just point it out.

Original comment by josh.bia...@gmail.com on 15 May 2012 at 3:54

GoogleCodeExporter commented 9 years ago
I agree with Erik (rkjnsn).  The CMake advice is that

"Native CMake projects that are intended to be used by other projects ... 
provide at a minimum a <name>Config.cmake ..."

I've written these for YAML for use with my projects, if they're of use to 
anyone they can be found here:

https://github.com/muhrin/cslibs/tree/master/yaml-cpp

specifically I've changed CMakeLists.txt which now requires the contents of the 
CMake folder.

If these are useful I'd be more than happy to create a patch but the changes 
are fairly minor.

Original comment by martin.u...@gmail.com on 7 Jan 2013 at 6:29

GoogleCodeExporter commented 9 years ago
+1, it should be merged, but place *.cmake into share/yaml-cpp/cmake

Original comment by dmitry.a...@gmail.com on 2 Jul 2013 at 6:45

GoogleCodeExporter commented 9 years ago
Hi Dimitry,

I agree that share/yaml-cpp/cmake seems like the right place for the files on a 
linux system.  The CMake tutorial [1] seems to use:

${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}

which on a linux system puts them in lib/CMake/yaml-cpp which maybe isn't 
ideal.  Do you know of a macro/variable combination that will put the files in 
share/... and work correctly on Windows also?  Presumably on Windows it should 
end up in Program Files/yaml-cpp/CMake.

[1] 
http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_fi
le

Original comment by martin.u...@gmail.com on 21 Jul 2013 at 10:58

GoogleCodeExporter commented 9 years ago
My bad, this is the way to to do it:

if(WIN32 AND NOT CYGWIN)
  set(DEF_INSTALL_CMAKE_DIR CMake)
else()
  set(DEF_INSTALL_CMAKE_DIR share/YamlCpp/cmake)
endif()

and by using YamlCpp instead of yaml-cpp it'll be automatically picked up if 
someone uses find_package(YamlCpp)

Original comment by martin.u...@gmail.com on 21 Jul 2013 at 12:18

GoogleCodeExporter commented 9 years ago
If you're already using CMake for building, you should install a config file, 
not a Find module.

Original comment by nicolas....@gmail.com on 15 Nov 2013 at 3:37

GoogleCodeExporter commented 9 years ago
Hello

I'm planning to add a dependency on yaml-cpp for a software I'm working on.
It is a robotics library and we have chosen YAML format to export data from 
experiments.
It may be used on several OS's, so automatic detection of dependencies is 
mandatory and we use CMake for that.

Nice job with yaml-cpp, we'll use it as soon as this issue is solved.

Original comment by okermorg...@gmail.com on 30 Nov 2013 at 2:20

GoogleCodeExporter commented 9 years ago
My company has been using yaml-cpp and have modified it to create the cmake 
config file. So you can use find_package to find yaml-cpp for your own cmake 
project. I have posted this change to my github account [1], and have attached 
a patch here.

[1] 
https://github.com/paulnovo/yaml-cpp/commit/a2f7beb218cf2cde4ab97dcf29d9f2da9803
75db

Original comment by pnovo...@simquest.com on 20 Feb 2014 at 9:13

Attachments:

GoogleCodeExporter commented 9 years ago
Until a YamlCppConfig.cmake file is officially added to the library, since it 
provides a pkg-config file you can use the PkgConfig module in cmake to 
automatically find yaml-cpp.

find_package(PkgConfig)
pkg_check_modules(YamlCpp yaml-cpp)

Original comment by julhi...@gmail.com on 20 Mar 2014 at 2:02