cmake: add format file

Helps to keep the CMake stuff consistent.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 2 years ago
parent 590f615320
commit 0f85d5a0e9

@ -0,0 +1,17 @@
with section("format"):
# How wide to allow formatted cmake files
line_width = 150
# How many spaces to tab for indent
tab_size = 2
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on its own line.
dangle_parens = True

@ -1,15 +1,20 @@
# Minimum version imposed by Ubuntu:20.04
cmake_minimum_required( VERSION 3.16.3 )
project(exiv2 # use TWEAK to categorize the build
VERSION 1.00.0.9 # 1.00.0 = GM (tagged and released)
# 1.00.0.9 = 1.00.0 Development
# 1.00.0.00 = GM Preview
# 1.00.0.2 = RC2 (tagged and released)
# 1.00.0.20 = RC2 Preview
# 1.00.0.29 = RC2 Development
DESCRIPTION "Exif/IPTC/Xmp C++ metadata library and tools plus ICC Profiles, Previews and more."
LANGUAGES C CXX
cmake_minimum_required(VERSION 3.16.3)
# use TWEAK to categorize the build:
#
# * 1.00.0 = GM (tagged and released)
# * 1.00.0.9 = 1.00.0 Development
# * 1.00.0.00 = GM Preview
# * 1.00.0.2 = RC2 (tagged and released)
# * 1.00.0.20 = RC2 Preview
# * 1.00.0.29 = RC2 Development
#
project(
exiv2
VERSION 1.00.0.9
DESCRIPTION "Exif/IPTC/Xmp C++ metadata library and tools plus ICC Profiles, Previews and more."
LANGUAGES C CXX
)
# Shared Object versioning (SemVer-like: must bump major on API breakage)
@ -22,88 +27,84 @@ else()
endif()
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Release)
endif()
include(cmake/mainSetup.cmake REQUIRED)
include(cmake/mainSetup.cmake)
# options and their default values
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF )
option( EXIV2_ENABLE_PNG "Build with PNG support (requires zlib)" ON )
option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" OFF )
option( EXIV2_ENABLE_LENSDATA "Build including Nikon lens data" ON )
option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" ON )
option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF )
option( EXIV2_ENABLE_CURL "Use libcurl for HttpIo (WEBREADY)" OFF )
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" ON )
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 )
option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF )
option( EXIV2_BUILD_FUZZ_TESTS "Build fuzz tests (libFuzzer)" OFF )
option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF )
option(BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON)
option(EXIV2_ENABLE_XMP "Build with XMP metadata support" ON)
option(EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF)
option(EXIV2_ENABLE_PNG "Build with PNG support (requires zlib)" ON)
option(EXIV2_ENABLE_NLS "Build native language support (requires gettext)" OFF)
option(EXIV2_ENABLE_LENSDATA "Build including Nikon lens data" ON)
option(EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" ON)
option(EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF)
option(EXIV2_ENABLE_CURL "Use libcurl for HttpIo (WEBREADY)" OFF)
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" ON)
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)
option(EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF)
option(EXIV2_BUILD_FUZZ_TESTS "Build fuzz tests (libFuzzer)" OFF)
option(EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF)
# Only intended to be used by Exiv2 developers/contributors
option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF )
option( EXIV2_TEAM_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF )
option( EXIV2_TEAM_USE_SANITIZERS "Enable ASAN and UBSAN when available" OFF )
option(EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF)
option(EXIV2_TEAM_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
option(EXIV2_TEAM_USE_SANITIZERS "Enable ASAN and UBSAN when available" OFF)
# The EXIV2_TEAM_OSS_FUZZ option is used by the OSS-Fuzz build script:
# https://github.com/google/oss-fuzz/tree/master/projects/exiv2/build.sh
option( EXIV2_TEAM_OSS_FUZZ "Build config for OSS-Fuzz" OFF )
#
# * https://github.com/google/oss-fuzz/tree/master/projects/exiv2/build.sh
#
option(EXIV2_TEAM_OSS_FUZZ "Build config for OSS-Fuzz" OFF)
option( EXIV2_TEAM_PACKAGING "Additional stuff for generating packages" OFF )
option(EXIV2_TEAM_PACKAGING "Additional stuff for generating packages" OFF)
set(EXTRA_COMPILE_FLAGS " ")
mark_as_advanced(
EXIV2_TEAM_EXTRA_WARNINGS
EXIV2_TEAM_WARNINGS_AS_ERRORS
EXIV2_ENABLE_EXTERNAL_XMP
EXTRA_COMPILE_FLAGS
EXIV2_TEAM_USE_SANITIZERS
)
mark_as_advanced(EXIV2_TEAM_EXTRA_WARNINGS EXIV2_TEAM_WARNINGS_AS_ERRORS EXIV2_ENABLE_EXTERNAL_XMP EXTRA_COMPILE_FLAGS EXIV2_TEAM_USE_SANITIZERS)
option( BUILD_WITH_STACK_PROTECTOR "Build with stack protector" ON )
option( BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF )
option( BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF )
option(BUILD_WITH_STACK_PROTECTOR "Build with stack protector" ON)
option(BUILD_WITH_CCACHE "Use ccache to speed up compilations" OFF)
option(BUILD_WITH_COVERAGE "Add compiler flags to generate coverage stats" OFF)
include(cmake/gcovr.cmake REQUIRED)
set( PACKAGE_URL "https://exiv2.org")
set(PACKAGE_URL "https://exiv2.org")
if ( EXIV2_ENABLE_EXTERNAL_XMP )
if(EXIV2_ENABLE_EXTERNAL_XMP)
set(EXIV2_ENABLE_XMP OFF)
endif()
include(cmake/findDependencies.cmake REQUIRED)
include(cmake/compilerFlags.cmake REQUIRED)
include(cmake/findDependencies.cmake REQUIRED)
include(cmake/compilerFlags.cmake REQUIRED)
include(cmake/generateConfigFile.cmake REQUIRED)
if (EXIV2_BUILD_DOC)
include(cmake/generateDoc.cmake REQUIRED)
if(EXIV2_BUILD_DOC)
include(cmake/generateDoc.cmake REQUIRED)
generate_documentation("${PROJECT_SOURCE_DIR}/cmake/Doxyfile.in")
endif()
include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project
include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project
if( EXIV2_ENABLE_XMP )
add_subdirectory( xmpsdk )
if(EXIV2_ENABLE_XMP)
add_subdirectory(xmpsdk)
endif()
include(cmake/compilerFlagsExiv2.cmake REQUIRED)
add_subdirectory( src )
add_subdirectory(src)
if(BUILD_TESTING AND EXIV2_BUILD_UNIT_TESTS)
add_subdirectory ( unitTests )
add_subdirectory(unitTests)
endif()
if( EXIV2_BUILD_FUZZ_TESTS )
add_subdirectory ( fuzz )
if(EXIV2_BUILD_FUZZ_TESTS)
add_subdirectory(fuzz)
endif()
if(EXIV2_BUILD_EXIV2_COMMAND)
@ -114,58 +115,70 @@ if(EXIV2_BUILD_EXIV2_COMMAND)
get_directory_property(SAMPLES DIRECTORY samples DEFINITION APPLICATIONS)
if(BUILD_TESTING AND Python3_Interpreter_FOUND)
add_test(NAME bashTests
add_test(
NAME bashTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests)
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests
)
endif()
endif()
if(BUILD_TESTING AND Python3_Interpreter_FOUND)
add_test(NAME bugfixTests
add_test(
NAME bugfixTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bugfixes)
add_test(NAME lensTests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bugfixes
)
add_test(
NAME lensTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose lens_tests)
add_test(NAME tiffTests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose lens_tests
)
add_test(
NAME tiffTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose tiff_test)
add_test(NAME versionTests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose tiff_test
)
add_test(
NAME versionTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests/version_test.py )
add_test(NAME regressionTests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests/version_test.py
)
add_test(
NAME regressionTests
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose regression_tests)
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose regression_tests
)
endif()
endif()
if( EXIV2_ENABLE_NLS )
add_subdirectory( po )
if(EXIV2_ENABLE_NLS)
add_subdirectory(po)
endif()
if (EXIV2_TEAM_PACKAGING)
if(EXIV2_TEAM_PACKAGING)
include(cmake/packaging.cmake)
endif()
# Handle both relative and absolute paths (e.g. NixOS) for a relocatable package
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(libdir_for_pc_file "${CMAKE_INSTALL_LIBDIR}")
set(libdir_for_pc_file "${CMAKE_INSTALL_LIBDIR}")
else()
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir_for_pc_file "${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir_for_pc_file "${CMAKE_INSTALL_INCLUDEDIR}")
else()
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(cmake/exiv2.pc.in exiv2.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# ******************************************************************************
# Man page
install( FILES ${PROJECT_SOURCE_DIR}/man/man1/exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
install(FILES ${PROJECT_SOURCE_DIR}/man/man1/exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
include(cmake/printSummary.cmake)
# That's all Folks!
##
#

@ -1,57 +1,62 @@
add_executable( exiv2
exiv2.cpp
exiv2app.hpp
actions.cpp actions.hpp
getopt.cpp getopt.hpp
app_utils.cpp app_utils.hpp
add_executable(
exiv2
exiv2.cpp
exiv2app.hpp
actions.cpp
actions.hpp
getopt.cpp
getopt.hpp
app_utils.cpp
app_utils.hpp
)
target_include_directories(exiv2 PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find i18n.hpp
set_target_properties( exiv2 PROPERTIES
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES"
)
if (MSVC)
set_target_properties(exiv2 PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
set_target_properties(exiv2 PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS} XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES")
if(MSVC)
set_target_properties(exiv2 PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
endif()
target_link_libraries( exiv2 PRIVATE exiv2lib )
target_link_libraries(exiv2 PRIVATE exiv2lib)
if( EXIV2_ENABLE_NLS )
target_link_libraries(exiv2 PRIVATE ${Intl_LIBRARIES})
target_include_directories(exiv2 PRIVATE ${Intl_INCLUDE_DIRS})
if(EXIV2_ENABLE_NLS)
target_link_libraries(exiv2 PRIVATE ${Intl_LIBRARIES})
target_include_directories(exiv2 PRIVATE ${Intl_INCLUDE_DIRS})
endif()
target_link_libraries(exiv2 PRIVATE std::filesystem)
if(MSVC OR MINGW)
# Trick to get properly UTF-8 encoded argv
# More info at: https://github.com/huangqinjin/wmain
add_library(wmain STATIC wmain.cpp)
target_link_libraries(exiv2 PRIVATE wmain)
# Trick to get properly UTF-8 encoded argv More info at: https://github.com/huangqinjin/wmain
add_library(wmain STATIC wmain.cpp)
target_link_libraries(exiv2 PRIVATE wmain)
endif()
if (MSVC)
target_link_options(wmain INTERFACE /WHOLEARCHIVE:$<TARGET_FILE:wmain>)
target_link_options(exiv2 PRIVATE "/ENTRY:wWinMainCRTStartup")
if(MSVC)
target_link_options(wmain INTERFACE /WHOLEARCHIVE:$<TARGET_FILE:wmain>)
target_link_options(exiv2 PRIVATE "/ENTRY:wWinMainCRTStartup")
endif()
if (MINGW)
target_compile_options(exiv2 PRIVATE -municode)
target_link_options(exiv2 PRIVATE -municode)
if(MINGW)
target_compile_options(exiv2 PRIVATE -municode)
target_link_options(exiv2 PRIVATE -municode)
endif()
if (USING_CONAN AND WIN32 AND EXISTS ${PROJECT_BINARY_DIR}/conanDlls)
# In case of using conan recipes with their 'shared' option turned on, we will have dlls of
# the 3rd party dependencies in the conanDlls folder.
if(USING_CONAN
AND WIN32
AND EXISTS ${PROJECT_BINARY_DIR}/conanDlls
)
# In case of using conan recipes with their 'shared' option turned on, we will have dlls of the 3rd party dependencies in the conanDlls folder.
# Copy 3rd party DLLs the bin folder. [build step]
add_custom_command(TARGET exiv2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/conanDlls ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_custom_command(
TARGET exiv2
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/conanDlls ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMENT "Copy 3rd party DLLs the bin folder"
)
# Copy 3rd party DLLs the bin folder. [install step]
install(DIRECTORY ${PROJECT_BINARY_DIR}/conanDlls/ DESTINATION bin)
# Copy 3rd party DLLs the bin folder. [install step]
install(DIRECTORY ${PROJECT_BINARY_DIR}/conanDlls/ DESTINATION bin)
endif()
install(TARGETS exiv2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

@ -1,22 +1,15 @@
# Macro for different fuzzers
macro(FUZZER name)
add_executable(${name} ${name}.cpp)
macro(fuzzer name)
add_executable(${name} ${name}.cpp)
# The EXIV2_TEAM_OSS_FUZZ option is used by the OSS-Fuzz build script:
# https://github.com/google/oss-fuzz/tree/master/projects/exiv2/build.sh
# OSS-Fuzz wants full control of the sanitizer flags, and it uses
# the LIB_FUZZING_ENGINE option to supply its own main function.
if(EXIV2_TEAM_OSS_FUZZ)
set_target_properties(${name}
PROPERTIES
LINK_FLAGS "${LIB_FUZZING_ENGINE}")
else()
set_target_properties(${name}
PROPERTIES
COMPILE_FLAGS "-fsanitize=fuzzer"
LINK_FLAGS "-fsanitize=fuzzer")
endif()
target_link_libraries(${name} PRIVATE exiv2lib std::filesystem)
# The EXIV2_TEAM_OSS_FUZZ option is used by the OSS-Fuzz build script: https://github.com/google/oss-fuzz/tree/master/projects/exiv2/build.sh
# OSS-Fuzz wants full control of the sanitizer flags, and it uses the LIB_FUZZING_ENGINE option to supply its own main function.
if(EXIV2_TEAM_OSS_FUZZ)
set_target_properties(${name} PROPERTIES LINK_FLAGS "${LIB_FUZZING_ENGINE}")
else()
set_target_properties(${name} PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer" LINK_FLAGS "-fsanitize=fuzzer")
endif()
target_link_libraries(${name} PRIVATE exiv2lib std::filesystem)
endmacro()
fuzzer(fuzz-read-print-write)
FUZZER(fuzz-read-print-write)

@ -1,38 +1,34 @@
find_package(Gettext REQUIRED)
GETTEXT_CREATE_TRANSLATIONS(exiv2.pot ALL
bs.po
de.po
ca.po
es.po
fi.po
fr.po
gl.po
ms.po
nl.po
pl.po
pt.po
ru.po
sk.po
sv.po
ug.po
uk.po
vi.po
gettext_create_translations(
exiv2.pot
ALL
bs.po
de.po
ca.po
es.po
fi.po
fr.po
gl.po
ms.po
nl.po
pl.po
pt.po
ru.po
sk.po
sv.po
ug.po
uk.po
vi.po
)
find_program(XGETTEXT xgettext)
add_custom_target(
update-pot
COMMAND
${XGETTEXT} -o ${CMAKE_CURRENT_SOURCE_DIR}/exiv2.pot
-D ${PROJECT_SOURCE_DIR}
--keyword=_ --keyword=N_
--files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in
--from-code=UTF-8
--copyright-holder='Exiv2 authors'
--msgid-bugs-address='https://github.com/Exiv2/exiv2/issues'
--package-name=${CMAKE_PROJECT_NAME}
--package-version=${CMAKE_PROJECT_VERSION}
COMMENT "Extract translatable messages to exiv2.pot"
update-pot
COMMAND
${XGETTEXT} -o ${CMAKE_CURRENT_SOURCE_DIR}/exiv2.pot -D ${PROJECT_SOURCE_DIR} --keyword=_ --keyword=N_
--files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in --from-code=UTF-8 --copyright-holder='Exiv2 authors'
--msgid-bugs-address='https://github.com/Exiv2/exiv2/issues' --package-name=${CMAKE_PROJECT_NAME} --package-version=${CMAKE_PROJECT_VERSION}
COMMENT "Extract translatable messages to exiv2.pot"
)

@ -1,103 +1,92 @@
# CMakeLists.txt for exiv2 library sample applications
set( SAMPLES
addmoddel.cpp
convert-test.cpp
easyaccess-test.cpp
exifcomment.cpp
exifdata-test.cpp
exifdata.cpp
exifprint.cpp
exifvalue.cpp
ini-test.cpp
iotest.cpp
iptceasy.cpp
iptcprint.cpp
iptctest.cpp
key-test.cpp
largeiptc-test.cpp
mmap-test.cpp
mrwthumb.cpp
prevtest.cpp
stringto-test.cpp
taglist.cpp
tiff-test.cpp
write-test.cpp
write2-test.cpp
xmpparse.cpp
xmpparser-test.cpp
xmpprint.cpp
xmpsample.cpp
xmpdump.cpp
set(SAMPLES
addmoddel.cpp
convert-test.cpp
easyaccess-test.cpp
exifcomment.cpp
exifdata-test.cpp
exifdata.cpp
exifprint.cpp
exifvalue.cpp
ini-test.cpp
iotest.cpp
iptceasy.cpp
iptcprint.cpp
iptctest.cpp
key-test.cpp
largeiptc-test.cpp
mmap-test.cpp
mrwthumb.cpp
prevtest.cpp
stringto-test.cpp
taglist.cpp
tiff-test.cpp
write-test.cpp
write2-test.cpp
xmpparse.cpp
xmpparser-test.cpp
xmpprint.cpp
xmpsample.cpp
xmpdump.cpp
)
##
#
# build samples AND add them to the APPLICATIONS list
foreach(entry ${SAMPLES})
string( REPLACE ".cpp" "" target ${entry})
add_executable( ${target} ${target}.cpp )
set_target_properties(${target} PROPERTIES
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS})
list(APPEND APPLICATIONS ${target})
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find enforce.hpp
if ( NOT ${target} MATCHES ".*test.*") # don't install tests
install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
string(REPLACE ".cpp" "" target ${entry})
add_executable(${target} ${target}.cpp)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS})
list(APPEND APPLICATIONS ${target})
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find enforce.hpp
if(NOT ${target} MATCHES ".*test.*") # don't install tests
install(TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endforeach()
###################################
# ####################################################################################################################################################
if (MSVC)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
if(MSVC)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
endif()
add_executable( getopt-test getopt-test.cpp ../app/getopt.cpp)
add_executable(getopt-test getopt-test.cpp ../app/getopt.cpp)
list(APPEND APPLICATIONS getopt-test)
target_include_directories(getopt-test PRIVATE
${PROJECT_SOURCE_DIR}/app
) # To find getopt.hpp
target_include_directories(getopt-test PRIVATE ${PROJECT_SOURCE_DIR}/app) # To find getopt.hpp
add_executable( metacopy metacopy.cpp metacopy.hpp ../app/getopt.cpp)
add_executable(metacopy metacopy.cpp metacopy.hpp ../app/getopt.cpp)
list(APPEND APPLICATIONS metacopy)
target_include_directories(metacopy PRIVATE
${PROJECT_SOURCE_DIR}/app
) # To find getopt.hpp
target_include_directories(metacopy PRIVATE ${PROJECT_SOURCE_DIR}/app) # To find getopt.hpp
add_executable( path-test path-test.cpp ../app/getopt.cpp)
add_executable(path-test path-test.cpp ../app/getopt.cpp)
list(APPEND APPLICATIONS path-test)
set_target_properties( path-test PROPERTIES OUTPUT_NAME path-test )
target_include_directories(path-test PRIVATE
${PROJECT_SOURCE_DIR}/app
) # To find getopt.hpp
set_target_properties(path-test PROPERTIES OUTPUT_NAME path-test)
target_include_directories(path-test PRIVATE ${PROJECT_SOURCE_DIR}/app) # To find getopt.hpp
install( TARGETS metacopy RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
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 )
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)
list(APPEND APPLICATIONS geotag)
target_link_libraries(geotag
PRIVATE
exiv2-xmp
${EXPAT_LIBRARIES}
)
target_include_directories(geotag PRIVATE ${CMAKE_BINARY_DIR}) # exv_conf.h
target_include_directories(geotag PRIVATE ${PROJECT_SOURCE_DIR}/include) # <exiv2/exiv2.hpp>
target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR})
if (WIN32)
target_compile_definitions(geotag PRIVATE XML_STATIC)
endif()
if(EXPAT_FOUND)
add_executable(geotag geotag.cpp)
list(APPEND APPLICATIONS geotag)
target_link_libraries(geotag PRIVATE exiv2-xmp ${EXPAT_LIBRARIES})
target_include_directories(geotag PRIVATE ${CMAKE_BINARY_DIR}) # exv_conf.h
target_include_directories(geotag PRIVATE ${PROJECT_SOURCE_DIR}/include) # <exiv2/exiv2.hpp>
target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR})
if (MSVC)
set_target_properties(geotag PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
if(WIN32)
target_compile_definitions(geotag PRIVATE XML_STATIC)
endif()
if(MSVC)
set_target_properties(geotag PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
install( TARGETS geotag RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS geotag RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
# ******************************************************************************
@ -105,11 +94,11 @@ endif()
add_executable(conntest conntest.cpp)
list(APPEND APPLICATIONS conntest)
if (EXIV2_ENABLE_WEBREADY)
if( EXIV2_ENABLE_CURL )
target_include_directories(conntest SYSTEM PRIVATE ${CURL_INCLUDE_DIR} )
target_link_libraries(conntest PRIVATE ${CURL_LIBRARIES})
endif()
if(EXIV2_ENABLE_WEBREADY)
if(EXIV2_ENABLE_CURL)
target_include_directories(conntest SYSTEM PRIVATE ${CURL_INCLUDE_DIR})
target_link_libraries(conntest PRIVATE ${CURL_LIBRARIES})
endif()
endif()
# ******************************************************************************
@ -119,23 +108,23 @@ list(APPEND APPLICATIONS remotetest)
# ******************************************************************************
foreach(application ${APPLICATIONS})
target_link_libraries(${application} PRIVATE exiv2lib std::filesystem)
target_link_libraries(${application} PRIVATE exiv2lib std::filesystem)
if(MSVC)
target_link_libraries(${application} PRIVATE wmain)
target_link_options(${application} PRIVATE "/ENTRY:wWinMainCRTStartup")
endif()
if(MINGW)
target_link_libraries(${application} PRIVATE wmain)
target_compile_options(${application} PRIVATE -municode)
target_link_options(${application} PRIVATE -municode)
endif()
if(EXIV2_ENABLE_PNG)
target_link_libraries(${application} PRIVATE ${ZLIB_LIBRARIES})
if(MSVC)
target_link_libraries(${application} PRIVATE wmain)
target_link_options(${application} PRIVATE "/ENTRY:wWinMainCRTStartup")
endif()
if (MINGW)
target_link_libraries(${application} PRIVATE wmain)
target_compile_options(${application} PRIVATE -municode)
target_link_options(${application} PRIVATE -municode)
endif()
if( EXIV2_ENABLE_PNG )
target_link_libraries(${application} PRIVATE ${ZLIB_LIBRARIES} )
if (MSVC)
set_target_properties(${application} PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
endif()
set_target_properties(${application} PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
endif()
endif()
endforeach()
# That's all Folks!
##
#

@ -2,34 +2,58 @@ include(CMakePackageConfigHelpers)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library( exiv2lib_int OBJECT
canonmn_int.cpp canonmn_int.hpp
casiomn_int.cpp casiomn_int.hpp
cr2header_int.cpp cr2header_int.hpp
crwimage_int.cpp crwimage_int.hpp
fujimn_int.cpp fujimn_int.hpp
helper_functions.cpp helper_functions.hpp
image_int.cpp image_int.hpp
jp2image_int.cpp jp2image_int.hpp
makernote_int.cpp makernote_int.hpp
minoltamn_int.cpp minoltamn_int.hpp
nikonmn_int.cpp nikonmn_int.hpp
olympusmn_int.cpp olympusmn_int.hpp
orfimage_int.cpp orfimage_int.hpp
panasonicmn_int.cpp panasonicmn_int.hpp
pentaxmn_int.cpp pentaxmn_int.hpp
rw2image_int.cpp rw2image_int.hpp
safe_op.hpp
samsungmn_int.cpp samsungmn_int.hpp
sigmamn_int.cpp sigmamn_int.hpp
sonymn_int.cpp sonymn_int.hpp
tags_int.cpp tags_int.hpp
tiffcomposite_int.cpp tiffcomposite_int.hpp
tiffimage_int.cpp tiffimage_int.hpp
tiffvisitor_int.cpp tiffvisitor_int.hpp
tifffwd_int.hpp
utils.hpp utils.cpp
add_library(
exiv2lib_int OBJECT
canonmn_int.cpp
canonmn_int.hpp
casiomn_int.cpp
casiomn_int.hpp
cr2header_int.cpp
cr2header_int.hpp
crwimage_int.cpp
crwimage_int.hpp
fujimn_int.cpp
fujimn_int.hpp
helper_functions.cpp
helper_functions.hpp
image_int.cpp
image_int.hpp
jp2image_int.cpp
jp2image_int.hpp
makernote_int.cpp
makernote_int.hpp
minoltamn_int.cpp
minoltamn_int.hpp
nikonmn_int.cpp
nikonmn_int.hpp
olympusmn_int.cpp
olympusmn_int.hpp
orfimage_int.cpp
orfimage_int.hpp
panasonicmn_int.cpp
panasonicmn_int.hpp
pentaxmn_int.cpp
pentaxmn_int.hpp
rw2image_int.cpp
rw2image_int.hpp
safe_op.hpp
samsungmn_int.cpp
samsungmn_int.hpp
sigmamn_int.cpp
sigmamn_int.hpp
sonymn_int.cpp
sonymn_int.hpp
tags_int.cpp
tags_int.hpp
tiffcomposite_int.cpp
tiffcomposite_int.hpp
tiffimage_int.cpp
tiffimage_int.hpp
tiffvisitor_int.cpp
tiffvisitor_int.hpp
tifffwd_int.hpp
utils.hpp
utils.cpp
)
set(PUBLIC_HEADERS
@ -76,191 +100,189 @@ set(PUBLIC_HEADERS
../include/exiv2/xmpsidecar.hpp
)
add_library( exiv2lib
asfvideo.cpp
basicio.cpp
bmffimage.cpp
bmpimage.cpp
convert.cpp
cr2image.cpp
crwimage.cpp
datasets.cpp
easyaccess.cpp
epsimage.cpp
error.cpp
exif.cpp
futils.cpp
fff.h
gifimage.cpp
http.cpp
image.cpp
iptc.cpp
jp2image.cpp
jpgimage.cpp
metadatum.cpp
mrwimage.cpp
orfimage.cpp
pgfimage.cpp
photoshop.cpp
preview.cpp
properties.cpp
psdimage.cpp
rafimage.cpp
rw2image.cpp
tags.cpp
tgaimage.cpp
tiffimage.cpp
types.cpp
value.cpp
version.cpp
webpimage.cpp
xmp.cpp
xmpsidecar.cpp
${PUBLIC_HEADERS}
$<TARGET_OBJECTS:exiv2lib_int>
add_library(
exiv2lib
asfvideo.cpp
basicio.cpp
bmffimage.cpp
bmpimage.cpp
convert.cpp
cr2image.cpp
crwimage.cpp
datasets.cpp
easyaccess.cpp
epsimage.cpp
error.cpp
exif.cpp
futils.cpp
fff.h
gifimage.cpp
http.cpp
image.cpp
iptc.cpp
jp2image.cpp
jpgimage.cpp
metadatum.cpp
mrwimage.cpp
orfimage.cpp
pgfimage.cpp
photoshop.cpp
preview.cpp
properties.cpp
psdimage.cpp
rafimage.cpp
rw2image.cpp
tags.cpp
tgaimage.cpp
tiffimage.cpp
types.cpp
value.cpp
version.cpp
webpimage.cpp
xmp.cpp
xmpsidecar.cpp
${PUBLIC_HEADERS}
$<TARGET_OBJECTS:exiv2lib_int>
)
add_library(Exiv2::exiv2lib ALIAS exiv2lib)
generate_export_header(exiv2lib
EXPORT_MACRO_NAME EXIV2API
EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exiv2lib_export.h
STATIC_DEFINE exiv2lib_STATIC
generate_export_header(
exiv2lib
EXPORT_MACRO_NAME
EXIV2API
EXPORT_FILE_NAME
${CMAKE_BINARY_DIR}/exiv2lib_export.h
STATIC_DEFINE
exiv2lib_STATIC
)
# Conditional addition of sources to library targets
# ---------------------------------------------------------
if( EXIV2_ENABLE_PNG )
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/pngimage.hpp)
target_sources(exiv2lib_int PRIVATE pngchunk_int.cpp pngchunk_int.hpp)
target_sources(exiv2lib PRIVATE pngimage.cpp ../include/exiv2/pngimage.hpp)
if(EXIV2_ENABLE_PNG)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/pngimage.hpp)
target_sources(exiv2lib_int PRIVATE pngchunk_int.cpp pngchunk_int.hpp)
target_sources(exiv2lib PRIVATE pngimage.cpp ../include/exiv2/pngimage.hpp)
endif()
if( EXV_ENABLE_VIDEO )
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/asfvideo.hpp)
target_sources(exiv2lib PRIVATE asfvideo.cpp ../include/exiv2/asfvideo.hpp)
if(EXV_ENABLE_VIDEO)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/asfvideo.hpp)
target_sources(exiv2lib PRIVATE asfvideo.cpp ../include/exiv2/asfvideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/matroskavideo.hpp)
target_sources(exiv2lib PRIVATE matroskavideo.cpp ../include/exiv2/matroskavideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/matroskavideo.hpp)
target_sources(exiv2lib PRIVATE matroskavideo.cpp ../include/exiv2/matroskavideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/quicktimevideo.hpp)
target_sources(exiv2lib PRIVATE quicktimevideo.cpp ../include/exiv2/quicktimevideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/quicktimevideo.hpp)
target_sources(exiv2lib PRIVATE quicktimevideo.cpp ../include/exiv2/quicktimevideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/riffvideo.hpp)
target_sources(exiv2lib PRIVATE riffvideo.cpp ../include/exiv2/riffvideo.hpp)
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ../include/exiv2/riffvideo.hpp)
target_sources(exiv2lib PRIVATE riffvideo.cpp ../include/exiv2/riffvideo.hpp)
endif()
# Other library target properties
# ---------------------------------------------------------
set_target_properties( exiv2lib PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${EXIV2LIB_SOVERSION}
OUTPUT_NAME exiv2
PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
set_target_properties(
exiv2lib
PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION ${EXIV2LIB_SOVERSION}
OUTPUT_NAME exiv2
PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
)
if (MSVC)
set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099")
if(MSVC)
set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
set_target_properties( exiv2lib_int PROPERTIES
POSITION_INDEPENDENT_CODE ON
COMPILE_DEFINITIONS exiv2lib_EXPORTS
)
set_target_properties(exiv2lib_int PROPERTIES POSITION_INDEPENDENT_CODE ON COMPILE_DEFINITIONS exiv2lib_EXPORTS)
# NOTE: Cannot use target_link_libraries on OBJECT libraries with old versions of CMake
target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR})
target_include_directories(exiv2lib SYSTEM PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/xmpsdk/include>
)
target_include_directories(exiv2lib SYSTEM PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/xmpsdk/include>)
if (EXIV2_ENABLE_XMP OR EXIV2_ENABLE_EXTERNAL_XMP)
target_include_directories(exiv2lib PRIVATE ${EXPAT_INCLUDE_DIR})
target_link_libraries(exiv2lib PRIVATE EXPAT::EXPAT)
list(APPEND requires_private_list "expat")
if(EXIV2_ENABLE_XMP OR EXIV2_ENABLE_EXTERNAL_XMP)
target_include_directories(exiv2lib PRIVATE ${EXPAT_INCLUDE_DIR})
target_link_libraries(exiv2lib PRIVATE EXPAT::EXPAT)
list(APPEND requires_private_list "expat")
endif()
if (EXIV2_ENABLE_XMP)
target_sources(exiv2lib PRIVATE $<TARGET_OBJECTS:exiv2-xmp>)
if(EXIV2_ENABLE_XMP)
target_sources(exiv2lib PRIVATE $<TARGET_OBJECTS:exiv2-xmp>)
elseif(EXIV2_ENABLE_EXTERNAL_XMP)
target_link_libraries(exiv2lib PUBLIC ${XMPSDK_LIBRARY})
target_include_directories(exiv2lib PUBLIC ${XMPSDK_INCLUDE_DIR})
target_compile_definitions(exiv2lib PUBLIC EXV_ADOBE_XMPSDK=2016)
target_link_libraries(exiv2lib PUBLIC ${XMPSDK_LIBRARY})
target_include_directories(exiv2lib PUBLIC ${XMPSDK_INCLUDE_DIR})
target_compile_definitions(exiv2lib PUBLIC EXV_ADOBE_XMPSDK=2016)
endif()
# Use include/exiv2 to build library code
target_include_directories(exiv2lib PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/exiv2>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
target_include_directories(
exiv2lib PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/exiv2> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(exiv2lib_int PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/exiv2>
)
target_include_directories(exiv2lib_int PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/exiv2>)
if (EXIV2_ENABLE_WEBREADY)
if( EXIV2_ENABLE_CURL )
target_include_directories(exiv2lib SYSTEM PRIVATE ${CURL_INCLUDE_DIR} )
target_link_libraries(exiv2lib PRIVATE ${CURL_LIBRARIES})
list(APPEND requires_private_list "libcurl")
endif()
if(EXIV2_ENABLE_WEBREADY)
if(EXIV2_ENABLE_CURL)
target_include_directories(exiv2lib SYSTEM PRIVATE ${CURL_INCLUDE_DIR})
target_link_libraries(exiv2lib PRIVATE ${CURL_LIBRARIES})
list(APPEND requires_private_list "libcurl")
endif()
endif()
if (WIN32)
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)
# Since windows.h is included in some headers, we need to propagate this definition
target_compile_definitions(exiv2lib PUBLIC WIN32_LEAN_AND_MEAN)
if(WIN32)
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)
# Since windows.h is included in some headers, we need to propagate this definition
target_compile_definitions(exiv2lib PUBLIC WIN32_LEAN_AND_MEAN)
endif()
if (NOT MSVC)
if ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
target_link_libraries( exiv2lib PRIVATE -lprocstat)
endif()
if(NOT MSVC)
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
target_link_libraries(exiv2lib PRIVATE -lprocstat)
endif()
if (MINGW)
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 )
endif()
if(MINGW)
target_link_libraries(exiv2lib PRIVATE psapi ws2_32 shell32)
endif()
else()
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 shell32 )
target_link_libraries(exiv2lib PRIVATE psapi ws2_32 shell32)
endif()
if( EXIV2_ENABLE_PNG )
target_link_libraries( exiv2lib PRIVATE ZLIB::ZLIB)
list(APPEND requires_private_list "zlib")
if(EXIV2_ENABLE_PNG)
target_link_libraries(exiv2lib PRIVATE ZLIB::ZLIB)
list(APPEND requires_private_list "zlib")
endif()
if( EXIV2_ENABLE_BMFF AND BROTLI_FOUND )
target_link_libraries( exiv2lib PRIVATE ${Brotli_LIBRARIES})
target_include_directories(exiv2lib PRIVATE ${Brotli_INCLUDE_DIRS})
list(APPEND requires_private_list "libbrotlidec")
if(EXIV2_ENABLE_BMFF AND BROTLI_FOUND)
target_link_libraries(exiv2lib PRIVATE ${Brotli_LIBRARIES})
target_include_directories(exiv2lib PRIVATE ${Brotli_INCLUDE_DIRS})
list(APPEND requires_private_list "libbrotlidec")
endif()
if( EXIV2_ENABLE_NLS )
target_link_libraries(exiv2lib PRIVATE ${Intl_LIBRARIES})
target_include_directories(exiv2lib PRIVATE ${Intl_INCLUDE_DIRS})
target_include_directories(exiv2lib_int PRIVATE ${Intl_INCLUDE_DIRS})
if( Intl_LIBRARIES )
list(APPEND libs_private_list "intl")
endif()
# Definition needed for translations
join_paths(EXV_LOCALEDIR ".." "${CMAKE_INSTALL_LOCALEDIR}")
target_compile_definitions(exiv2lib PUBLIC EXV_LOCALEDIR="${EXV_LOCALEDIR}")
if(EXIV2_ENABLE_NLS)
target_link_libraries(exiv2lib PRIVATE ${Intl_LIBRARIES})
target_include_directories(exiv2lib PRIVATE ${Intl_INCLUDE_DIRS})
target_include_directories(exiv2lib_int PRIVATE ${Intl_INCLUDE_DIRS})
if(Intl_LIBRARIES)
list(APPEND libs_private_list "intl")
endif()
# Definition needed for translations
join_paths(EXV_LOCALEDIR ".." "${CMAKE_INSTALL_LOCALEDIR}")
target_compile_definitions(exiv2lib PUBLIC EXV_LOCALEDIR="${EXV_LOCALEDIR}")
endif()
if( Iconv_FOUND AND Iconv_LIBRARIES )
target_link_libraries( exiv2lib PRIVATE Iconv::Iconv )
list(APPEND libs_private_list "iconv")
if(Iconv_FOUND AND Iconv_LIBRARIES)
target_link_libraries(exiv2lib PRIVATE Iconv::Iconv)
list(APPEND libs_private_list "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 )
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)
list(APPEND requires_private_list "INIReader")
endif()
@ -268,13 +290,19 @@ endif()
list(SORT libs_private_list)
string(REPLACE ";" " -l" libs_private_string "${libs_private_list}")
if(libs_private_string)
string(PREPEND libs_private_string "-l")
string(PREPEND libs_private_string "-l")
endif()
list(SORT requires_private_list)
string(REPLACE ";" ", " requires_private_string "${requires_private_list}")
set(libs_private_for_pc_file "${libs_private_string}" PARENT_SCOPE)
set(requires_private_for_pc_file "${requires_private_string}" PARENT_SCOPE)
set(libs_private_for_pc_file
"${libs_private_string}"
PARENT_SCOPE
)
set(requires_private_for_pc_file
"${requires_private_string}"
PARENT_SCOPE
)
write_basic_package_version_file(exiv2ConfigVersion.cmake COMPATIBILITY ExactVersion)
@ -282,25 +310,17 @@ install(TARGETS exiv2lib EXPORT exiv2Export)
include(CMakePackageConfigHelpers)
configure_package_config_file(
../cmake/exiv2Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
../cmake/exiv2Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
)
install(FILES
${PUBLIC_HEADERS}
${CMAKE_BINARY_DIR}/exv_conf.h
${CMAKE_BINARY_DIR}/exiv2lib_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/exiv2)
install(EXPORT exiv2Export
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
NAMESPACE Exiv2::
)
install(FILES ${PUBLIC_HEADERS} ${CMAKE_BINARY_DIR}/exv_conf.h ${CMAKE_BINARY_DIR}/exiv2lib_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/exiv2)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2")
EXPORT exiv2Export
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
NAMESPACE Exiv2::
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2Config.cmake
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/exiv2"
)

@ -1,76 +1,64 @@
# Prefer using Google supplied CMake config as built-in module is buggy before 3.23
find_package(GTest CONFIG)
if(NOT GTest_FOUND)
find_package(GTest REQUIRED)
find_package(GTest REQUIRED)
endif()
# video support.
if( EXV_ENABLE_VIDEO )
set(VIDEO_SUPPORT test_asfvideo.cpp test_matroskavideo.cpp test_riffVideo.cpp)
if(EXV_ENABLE_VIDEO)
set(VIDEO_SUPPORT test_asfvideo.cpp test_matroskavideo.cpp test_riffVideo.cpp)
endif()
add_executable(unit_tests
test_basicio.cpp
test_bmpimage.cpp
test_cr2header_int.cpp
test_datasets.cpp
test_Error.cpp
test_DateValue.cpp
test_enforce.cpp
test_FileIo.cpp
test_futils.cpp
test_helper_functions.cpp
test_image_int.cpp
test_ImageFactory.cpp
test_jp2image.cpp
test_jp2image_int.cpp
test_IptcKey.cpp
test_LangAltValueRead.cpp
test_Photoshop.cpp
test_pngimage.cpp
test_safe_op.cpp
test_slice.cpp
test_tiffheader.cpp
test_types.cpp
test_TimeValue.cpp
test_utils.cpp
test_XmpKey.cpp
${VIDEO_SUPPORT}
$<TARGET_OBJECTS:exiv2lib_int>
add_executable(
unit_tests
test_basicio.cpp
test_bmpimage.cpp
test_cr2header_int.cpp
test_datasets.cpp
test_Error.cpp
test_DateValue.cpp
test_enforce.cpp
test_FileIo.cpp
test_futils.cpp
test_helper_functions.cpp
test_image_int.cpp
test_ImageFactory.cpp
test_jp2image.cpp
test_jp2image_int.cpp
test_IptcKey.cpp
test_LangAltValueRead.cpp
test_Photoshop.cpp
test_pngimage.cpp
test_safe_op.cpp
test_slice.cpp
test_tiffheader.cpp
test_types.cpp
test_TimeValue.cpp
test_utils.cpp
test_XmpKey.cpp
${VIDEO_SUPPORT}
$<TARGET_OBJECTS:exiv2lib_int>
)
target_compile_definitions(unit_tests
PRIVATE
exiv2lib_STATIC
TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
)
target_compile_definitions(unit_tests PRIVATE exiv2lib_STATIC TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data")
target_link_libraries(unit_tests
PRIVATE
exiv2lib
GTest::gmock_main
std::filesystem
)
target_link_libraries(unit_tests PRIVATE exiv2lib GTest::gmock_main std::filesystem)
if( EXIV2_ENABLE_INIH )
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} )
if(EXIV2_ENABLE_PNG)
target_link_libraries(unit_tests PRIVATE ${ZLIB_LIBRARIES})
endif()
target_include_directories(unit_tests
PRIVATE ${PROJECT_SOURCE_DIR}/src
)
target_include_directories(unit_tests PRIVATE ${PROJECT_SOURCE_DIR}/src)
set_target_properties(unit_tests PROPERTIES
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
)
set_target_properties(unit_tests PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS})
if (MSVC)
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099")
if(MSVC)
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
add_test(NAME unitTests COMMAND unit_tests)

@ -1,51 +1,46 @@
add_library(exiv2-xmp OBJECT
src/ExpatAdapter.cpp
src/MD5.cpp
src/ParseRDF.cpp
src/UnicodeConversions.cpp
src/WXMPIterator.cpp
src/WXMPMeta.cpp
src/WXMPUtils.cpp
src/XML_Node.cpp
src/XMPCore_Impl.cpp
src/XMPIterator.cpp
src/XMPMeta-GetSet.cpp
src/XMPMeta-Parse.cpp
src/XMPMeta-Serialize.cpp
src/XMPMeta.cpp
src/XMPUtils-FileInfo.cpp
src/XMPUtils.cpp
include/MD5.h
include/TXMPIterator.hpp
include/TXMPMeta.hpp
include/TXMPUtils.hpp
include/XMP_Const.h
include/XMP_Environment.h
include/XMP.incl_cpp
include/XMPSDK.hpp
include/XMP_Version.h
add_library(
exiv2-xmp OBJECT
src/ExpatAdapter.cpp
src/MD5.cpp
src/ParseRDF.cpp
src/UnicodeConversions.cpp
src/WXMPIterator.cpp
src/WXMPMeta.cpp
src/WXMPUtils.cpp
src/XML_Node.cpp
src/XMPCore_Impl.cpp
src/XMPIterator.cpp
src/XMPMeta-GetSet.cpp
src/XMPMeta-Parse.cpp
src/XMPMeta-Serialize.cpp
src/XMPMeta.cpp
src/XMPUtils-FileInfo.cpp
src/XMPUtils.cpp
include/MD5.h
include/TXMPIterator.hpp
include/TXMPMeta.hpp
include/TXMPUtils.hpp
include/XMP_Const.h
include/XMP_Environment.h
include/XMP.incl_cpp
include/XMPSDK.hpp
include/XMP_Version.h
)
target_include_directories(exiv2-xmp SYSTEM
PRIVATE
${PROJECT_SOURCE_DIR}/xmpsdk/include
${EXPAT_INCLUDE_DIRS}
)
target_include_directories(exiv2-xmp SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/xmpsdk/include ${EXPAT_INCLUDE_DIRS})
# Prevent a denial-service-attack related to XML entity expansion
# ("billion laughs attack").
# See https://bugzilla.redhat.com/show_bug.cgi?id=888769
# Prevent a denial-service-attack related to XML entity expansion ("billion laughs attack"). See https://bugzilla.redhat.com/show_bug.cgi?id=888769
target_compile_definitions(exiv2-xmp PRIVATE BanAllEntityUsage=1)
if (WIN32)
target_compile_definitions(exiv2-xmp PRIVATE XML_STATIC)
if(WIN32)
target_compile_definitions(exiv2-xmp PRIVATE XML_STATIC)
endif()
if (MINGW)
# https://stackoverflow.com/questions/18551409/localtime-r-support-on-mingw
target_compile_definitions(exiv2-xmp PRIVATE _POSIX_THREAD_SAFE_FUNCTIONS)
if(MINGW)
# https://stackoverflow.com/questions/18551409/localtime-r-support-on-mingw
target_compile_definitions(exiv2-xmp PRIVATE _POSIX_THREAD_SAFE_FUNCTIONS)
endif()
if (BUILD_SHARED_LIBS)
set_property(TARGET exiv2-xmp PROPERTY POSITION_INDEPENDENT_CODE ON)
if(BUILD_SHARED_LIBS)
set_property(TARGET exiv2-xmp PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()

Loading…
Cancel
Save