Commit b71cfa67 authored by Dylan Baker's avatar Dylan Baker

meson: Generate cmake config and version files if meson is new enough

Meson 0.50.0 added a module similar to the pkg-config module for
generating cmake config files. Since the CMake build system provides
these the meson build system should as well.

v2: - Bump version to 0.50 instead of incorrect 0.49
v3: - remove TODO comment that this fixes
    - Add a definition of set_and_check for meson-generated Config
Reviewed-by: Eric Engestrom's avatarEric Engestrom <>
parent c876c9ea
......@@ -7,6 +7,16 @@
# This should only be used for meson
if (NOT DEFINED set_and_check)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
set_and_check(Waffle_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@waffle_libname@")
set(Waffle_LIBRARIES "@waffle_libname@")
......@@ -231,5 +231,3 @@ endif
if get_option('build-examples')
# TODO: CMake config file
......@@ -211,6 +211,26 @@ pkg.generate(
description : 'A library for selecting an OpenGL API and windows system at runtime.',
if meson.version().version_compare('>= 0.50')
cmake = import('cmake')
name : 'Waffle',
version : meson.project_version(),
compatibility : 'SameMajorVersion',
cmake_conf = configuration_data()
cmake_conf.set('waffle_libname', waffle_name)
cmake_conf.set('PACKAGE_CMAKE_INSTALL_INCLUDEDIR', join_paths('${PACKAGE_PREFIX_DIR}', get_option('includedir')))
cmake_conf.set('PACKAGE_CMAKE_INSTALL_LIBDIR', join_paths('${PACKAGE_PREFIX_DIR}', get_option('libdir')))
name : 'Waffle',
input : '../../cmake/Modules/',
configuration : cmake_conf,
if get_option('build-tests')
if get_option('default_library') == 'shared'
# The unit tests need to poke at internals of the library, but with a
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment