Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply FindYamlCpp #127

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 16 comments
Open

Supply FindYamlCpp #127

GoogleCodeExporter opened this issue Mar 30, 2015 · 16 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

What would this file do?

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Here is my current suggestion.

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

  • Added labels: ****
  • Removed labels: ****

Attachments:

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

+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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

+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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

Attachments:

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@muellermartin
Copy link

The patch by @paulnovo does not seem to install the yaml-cpp-config.cmake file into the install directory respectively CMake's search path for such files or am I missing something?

@theNerd247
Copy link

I don't think you're missing anything. I've been looking through the cmake scripts as I'm using yaml-cpp for robotics as well. Did the patch ever get applied?

paulnovo added a commit to paulnovo/yaml-cpp that referenced this issue Nov 25, 2015
This adds yaml-cpp-config.cmake, yaml-cpp-config-version.cmake, and
yaml-cpp-targets.cmake to the cmake install. As a result, cmake's
find_package can easily find yaml-cpp for software that depends on
yaml-cpp.

Closes jbeder#336 jbeder#127
paulnovo added a commit to paulnovo/yaml-cpp that referenced this issue Mar 28, 2016
This adds yaml-cpp-config.cmake, yaml-cpp-config-version.cmake, and
yaml-cpp-targets.cmake to the cmake install. As a result, cmake's
find_package can easily find yaml-cpp for software that depends on
yaml-cpp.

Add code to install cmake files to $CMAKE_INSTALL_PREFIX/CMake on
Windows, which is the de-facto standard.

Closes jbeder#336 jbeder#127
ysyrov pushed a commit to ysyrov/yaml-cpp that referenced this issue Mar 30, 2016
This adds yaml-cpp-config.cmake, yaml-cpp-config-version.cmake, and
yaml-cpp-targets.cmake to the cmake install. As a result, cmake's
find_package can easily find yaml-cpp for software that depends on
yaml-cpp.

Add code to install cmake files to $CMAKE_INSTALL_PREFIX/CMake on
Windows, which is the de-facto standard.

Closes jbeder#336 jbeder#127
ysyrov pushed a commit to ysyrov/yaml-cpp that referenced this issue Mar 30, 2016
This adds yaml-cpp-config.cmake, yaml-cpp-config-version.cmake, and
yaml-cpp-targets.cmake to the cmake install. As a result, cmake's
find_package can easily find yaml-cpp for software that depends on
yaml-cpp.

Add code to install cmake files to $CMAKE_INSTALL_PREFIX/CMake on
Windows, which is the de-facto standard.

Closes jbeder#336 jbeder#127
dand-oss pushed a commit to dand-oss/yaml-cpp that referenced this issue Apr 22, 2016
This adds yaml-cpp-config.cmake, yaml-cpp-config-version.cmake, and
yaml-cpp-targets.cmake to the cmake install. As a result, cmake's
find_package can easily find yaml-cpp for software that depends on
yaml-cpp.

Add code to install cmake files to $CMAKE_INSTALL_PREFIX/CMake on
Windows, which is the de-facto standard.

Closes jbeder#336 jbeder#127
@madpipeline
Copy link
Contributor

I see yaml-cpp.pc gets installed to the Install dir. Is this still valid?

find_package(yaml-cpp REQUIRED) finds the package. I'd say to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants