Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions INIReaderConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@PACKAGE_INIT@

set(inih_CFLAGS "${inih_CFLAGS}")
list(APPEND inih_CFLAGS "@EXTRA_CFLAGS@")

include(CMakeFindDependencyMacro)
find_dependency(PkgConfig)

pkg_check_modules(INIREADER REQUIRED INIReader IMPORTED_TARGET)
if(NOT TARGET inih::inireader)
add_library(inih::inireader ALIAS PkgConfig::INIREADER)
endif()
13 changes: 13 additions & 0 deletions inihConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@PACKAGE_INIT@

set(inih_CFLAGS "${inih_CFLAGS}")
list(APPEND inih_CFLAGS "@EXTRA_CFLAGS@")

include(CMakeFindDependencyMacro)
find_dependency(PkgConfig)

# Use pkg-config to locate inih and create a target
pkg_check_modules(INIH REQUIRED inih IMPORTED_TARGET)
if(NOT TARGET inih::inih)
add_library(inih::inih ALIAS PkgConfig::INIH)
endif()
27 changes: 27 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ distro_install = get_option('distro_install')
extra_args = []

if distro_install
cmake = import('cmake')
pkg = import('pkgconfig')
else
if not get_option('multi-line_entries')
Expand Down Expand Up @@ -86,6 +87,19 @@ lib_inih = library('inih',
if distro_install
install_headers('ini.h')

cmdata = configuration_data()
if host_machine.system() == 'windows' and get_option('default_library') == 'shared'
cmdata.set('EXTRA_CFLAGS', '-DINI_SHARED_LIB')
else
cmdata.set('EXTRA_CFLAGS', '')
endif

cmake.configure_package_config_file(
name : 'inih',
input : 'inihConfig.cmake.in',
configuration : cmdata,
)

pkg.generate(lib_inih,
name : 'inih',
description : 'simple .INI file parser',
Expand Down Expand Up @@ -121,6 +135,19 @@ if get_option('with_INIReader')
if distro_install
install_headers('cpp/INIReader.h')

cmdata = configuration_data()
if host_machine.system() == 'windows' and get_option('default_library') == 'shared'
cmdata.set('EXTRA_CFLAGS', '-DINI_SHARED_LIB')
else
cmdata.set('EXTRA_CFLAGS', '')
endif

cmake.configure_package_config_file(
name : 'INIReader',
input : 'INIReaderConfig.cmake.in',
configuration : cmdata,
)

pkg.generate(lib_INIReader,
name : 'INIReader',
description : 'simple .INI file parser for C++',
Expand Down