Skip to content

CMake: Add include directory to jsoncpp_lib target #94

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

Merged
merged 2 commits into from
Dec 24, 2014

Conversation

Gachapen
Copy link
Contributor

@Gachapen Gachapen commented Dec 3, 2014

This is needed if using the jsoncpp CMake project as a subproject of another application. The application CMake project will only need to link with the jsoncpp_lib target and the include directory will follow. Without this the application project would need to manually include the json include directory.

@cdunn2001
Copy link
Contributor

CMake Error at src/lib_json/CMakeLists.txt:46 (TARGET_INCLUDE_DIRECTORIES):
  Unknown CMake command "TARGET_INCLUDE_DIRECTORIES".

@Gachapen
Copy link
Contributor Author

Gachapen commented Dec 5, 2014

I don't understand why it can't find the command. Is it a problem with the build bot? The exact same command is used inside the if test below at line 48 (this was there from earlier).

@Gachapen
Copy link
Contributor Author

I did some more research and it seems that you need CMake 2.8.11 to use target_include_directories (http://www.cmake.org/files/v2.8/CMakeChangeLog-2.8.11). I couldn't find out which version is being used on the build machine, but it has to be an earlier version.

There are two solutions to this: The first is to increase the version requirement to 2.8.11 and upgrade CMake on the build machine. The other one is to check if CMake version is equal or greater than 2.8.11 before using target_include_directories.

I implemented the latter in the latest commit and it builds on the build bot and works as expected together with my project.

@Robotex Robotex mentioned this pull request Dec 21, 2014
cdunn2001 added a commit that referenced this pull request Dec 24, 2014
CMake: Add include directory to jsoncpp_lib target

Well-researched. Passes Travis CI.
@cdunn2001 cdunn2001 merged commit 8dd32e1 into open-source-parsers:master Dec 24, 2014
@cdunn2001
Copy link
Contributor

Thanks!

@Gachapen Gachapen deleted the cmake_target_include branch January 6, 2015 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants