Add EXIV2_ENABLE_INIH flag to enable building without libinih.

main
Kevin Backhouse 2 years ago
parent 842ef05ee6
commit 43c9ec0f50
No known key found for this signature in database
GPG Key ID: 9DD01852EE40366E

@ -31,6 +31,7 @@ option( EXIV2_ENABLE_CURL "Use libcurl for HttpIo (WEBREADY)"
option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON )
option( EXIV2_ENABLE_BROTLI "Use Brotli for JPEG XL compressed boxes (BMFF)" ON )
option( EXIV2_ENABLE_VIDEO "Build with video support" OFF )
option( EXIV2_ENABLE_INIH "Use inih library" ON )
option( EXIV2_BUILD_SAMPLES "Build sample applications" OFF )
option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON )

@ -21,6 +21,9 @@
// Define if you want BMFF support.
#cmakedefine EXV_ENABLE_BMFF
// Define if you want to use the inih library.
#cmakedefine EXV_ENABLE_INIH
// Define if you have the strerror_r function.
#cmakedefine EXV_HAVE_STRERROR_R

@ -76,11 +76,13 @@ if( ICONV_FOUND )
message ( "-- Iconv_LIBRARIES : " ${Iconv_LIBRARIES} )
endif()
if( EXIV2_ENABLE_INIH )
find_package(inih)
message ( "-- inih_INCLUDE_DIRS : " ${inih_INCLUDE_DIRS} )
message ( "-- inih_LIBRARIES : " ${inih_LIBRARIES} )
message ( "-- inih_inireader_INCLUDE_DIRS : " ${inih_inireader_INCLUDE_DIRS} )
message ( "-- inih_inireader_LIBRARIES : " ${inih_inireader_LIBRARIES} )
endif()
if( BUILD_WITH_CCACHE )
find_program(CCACHE_FOUND ccache)

@ -9,6 +9,7 @@ endif()
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
set(EXV_ENABLE_INIH ${EXIV2_ENABLE_INIH})
set(EXV_PACKAGE_NAME ${PROJECT_NAME})
set(EXV_PACKAGE_VERSION ${PROJECT_VERSION})

@ -72,8 +72,10 @@ target_include_directories(path-test PRIVATE
install( TARGETS metacopy RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if( EXIV2_ENABLE_INIH )
target_link_libraries( ini-test PRIVATE inih::libinih )
target_link_libraries( ini-test PRIVATE inih::inireader )
endif()
if( EXPAT_FOUND )
add_executable( geotag geotag.cpp)

@ -260,10 +260,12 @@ if( ICONV_FOUND )
target_link_libraries( exiv2lib PRIVATE Iconv::Iconv )
endif()
if( EXIV2_ENABLE_INIH )
target_link_libraries( exiv2lib_int PRIVATE inih::libinih )
target_link_libraries( exiv2lib_int PRIVATE inih::inireader )
target_link_libraries( exiv2lib PRIVATE inih::libinih )
target_link_libraries( exiv2lib PRIVATE inih::inireader )
endif()
write_basic_package_version_file(exiv2ConfigVersion.cmake COMPATIBILITY ExactVersion)

@ -15,7 +15,9 @@
#include "utils.hpp"
// + standard includes
#ifdef EXV_ENABLE_INIH
#include <INIReader.h>
#endif
#include <array>
#include <filesystem>
#include <iostream>
@ -81,10 +83,12 @@ std::string getExiv2ConfigPath() {
std::string readExiv2Config(const std::string& section, const std::string& value, const std::string& def) {
std::string result = def;
#ifdef EXV_ENABLE_INIH
INIReader reader(Exiv2::Internal::getExiv2ConfigPath());
if (reader.ParseError() == 0) {
result = reader.Get(section, value, def);
}
#endif
return result;
}

@ -48,10 +48,12 @@ target_link_libraries(unit_tests
GTest::gtest
GTest::gtest_main
std::filesystem
inih::libinih
inih::inireader
)
if( EXIV2_ENABLE_INIH )
target_link_libraries(unit_tests PRIVATE inih::libinih inih::inireader)
endif()
# ZLIB is used in exiv2lib_int.
if( EXIV2_ENABLE_PNG )
target_link_libraries(unit_tests PRIVATE ${ZLIB_LIBRARIES} )

Loading…
Cancel
Save