hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.11k stars 362 forks source link

Add modern *Config.cmake #146

Closed tastytea closed 5 years ago

tastytea commented 5 years ago

The current CMake recipes only install libraries and headers and the existing *Config.cmake files are very minimal and inflexible. So I wrote a generator for *Config.cmake files. This allows you to use libconfig in CMake projects like so:

find_package(libconfig CONFIG REQUIRED)
target_link_libraries(example_c PUBLIC libconfig::config)

find_package(libconfig++ CONFIG REQUIRED)
target_link_libraries(example_cpp PUBLIC libconfig::config++)

It works with Linux and OSX. I can't test it with Windows.

Includes https://github.com/hyperrealm/libconfig/pull/138 because CMake fails without it.

Fixes #143