Skip to content

Commit

Permalink
cmake: Ensure exiv2 build finds the correct exv_conf.h file.
Browse files Browse the repository at this point in the history
When looking for an include file, the compiler typically looks for the
new file in the same directory as the file as it is currently
processing.  It does this before searching in the list of include file
directories.  This is causing the compiler to find the exv_conf.h file
in mythtv/external/libexiv2/include/exiv2 (the version checked into
the MythTV sources), and not the correct version in
build-qt5/exiv2-prefix/src/exiv2-build (the one generated by cmake).
These files were similar enough to not cause a problem until the
recent changes to not compile XMP support.

1) Copy the config.h file to build-qt5/exiv2-prefix/src/exiv2-build,
since this is the file that pulls in exv_conf.h.  This ensures that
when the compiler looks for exv_conf.h, it finds the correct one
(which is in the same directory).

2) Add an include of config.h to xmp.cpp.  That file doesn't include
config.h directly but via another file, which means the wrong config.h
file is included and thus the wrong exv_config.h.  Adding this
additional include forces the include directory search path to be
used, and thus the correct config.h/xv_conf.h files are found.
  • Loading branch information
linuxdude42 committed Feb 13, 2025
1 parent 45ce959 commit 4695aa2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions mythtv/external/libexiv2/cmake/generateConfigFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H )
set(EXV_ENABLE_NLS ${EXIV2_ENABLE_NLS})

configure_file(cmake/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY)
file(COPY include/exiv2/config.h DESTINATION ${CMAKE_BINARY_DIR})
1 change: 1 addition & 0 deletions mythtv/external/libexiv2/src/xmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
// *****************************************************************************
// included header files
#include "config.h"
#include "xmp_exiv2.hpp"
#include "types.hpp"
#include "error.hpp"
Expand Down

0 comments on commit 4695aa2

Please sign in to comment.