akheron/jansson — pull request #155 by JoakimSoderberg (2014-01-23 11:13:25+00:00)
Title: Cmake config support

This adds support for CMake configuration files.

This is similar to what pkg-config does but for CMake. It enables the `find_package` command to more easily find jansson by installing config files into the CMake system repository when doing `make install`.

It also creates these configuration files within the build-tree, so that you can compile a specific version of jansson for your project, and then simply use `find_package` to search for it in a specific path, without hard coding the specific paths to libs and include files and such:

Example:

```cmake
find_package(jansson
CONFIG # Don't try find the package using the FindLibwebsocket.cmake module. Use config.
NO_CMAKE_PACKAGE_REGISTRY # Ignore system package registry.
PATHS ${PATH_TO_JANSSON_BUILD_TREE}) # Specify specific path to search in.

include_directories(${JANSSON_INCLUDE_DIRS})
target_link_libraries(my_program jansson)

```

Prepended `JANSSON_` to all the CMake options so that we don't get collisions with other project settings. Specifically when compiling jansson as a sub directory in CMake using `add_subdirectory` in a parent project.

Also renamed `config.h` for CMake to jansson_private_config.h aaeff26 since this would find the wrong `config.h` in the above scenario.