exiv2/cmake/generateConfigFile.cmake
Luis Díaz Más f30022d73d
Fix issues detected with PVS-Studio + other little improvements (#1689)
* avoid re-declaration of constant variables

* Replace pthreads critical section with std::mutex

* ci - better naming

* cmake - increase minimum version to 3.11. Use project DESCRIPTION

* fix - do not treat string::find() return type as bool

* remove conditions that were always true

* remove condition that were always false

* Remove EXV_HAVE_GMTIME_R which is not used anymore

* pixelWidth_ was inherited from Exiv2::Image

The width & height variables in the TiffImage class need to be mutable
to be able to change their values on the getters pixelHeight() and
pixelWidth() ... Do not ask me why ...

* Remove superfluous if

* pvs:V766 item with identical key added already

* pvs:V730 not all members were initialized (time)

* pvs:V730 not all members are initialized

* pvs:v668 no point in testing pointer against null after new

* pvs:V1048 variable assigned the same value

* replace c-style dynamic vector with std one

* pvs:547 fakeData is always true

* Remove useless constructor in derived class

* pvs:V690 modern way to disable copy-ctor

* Replace malloc/free with new/delete. No need to check for null

* pvs:V1028 cast operands and not result

* Remove custom MIN/MAX functions

* pvs:V595 pointer used before verified against null

* pvs: index used before being checked

* pvs:V1028 possible overflow. Cast operands

* pvs:v575 potential null pointer passed to other functions

* pvs:V547 deal with always true/false expressions

* pvs:V560 part of conditional expressions always false or true

* pvs:V701 possible break in realloc -> move to std::vector

* Make some classes 'final'

* Replace sprintf with std::to_string()

* fix compilation on windows
2021-06-01 12:39:10 +02:00

47 lines
1.5 KiB
CMake

include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
include(CheckCXXSymbolExists)
# Note that the scope of the EXV_ variables in local
if (${EXIV2_ENABLE_WEBREADY})
set(EXV_USE_CURL ${EXIV2_ENABLE_CURL})
endif()
set(EXV_ENABLE_BMFF ${EXIV2_ENABLE_BMFF})
set(EXV_ENABLE_WEBREADY ${EXIV2_ENABLE_WEBREADY})
set(EXV_HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA})
set(EXV_HAVE_PRINTUCS2 ${EXIV2_ENABLE_PRINTUCS2})
set(EXV_PACKAGE_NAME ${PROJECT_NAME})
set(EXV_PACKAGE_VERSION ${PROJECT_VERSION})
set(EXV_PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
if (${EXIV2_ENABLE_XMP} OR ${EXIV2_ENABLE_EXTERNAL_XMP})
set(EXV_HAVE_XMP_TOOLKIT ON)
else()
set(EXV_HAVE_XMP_TOOLKIT OFF)
endif()
set(EXV_HAVE_ICONV ${ICONV_FOUND})
set(EXV_HAVE_LIBZ ${ZLIB_FOUND})
set(EXV_UNICODE_PATH ${EXIV2_ENABLE_WIN_UNICODE})
check_cxx_symbol_exists(mmap sys/mman.h EXV_HAVE_MMAP )
check_cxx_symbol_exists(munmap sys/mman.h EXV_HAVE_MUNMAP )
check_cxx_symbol_exists(strerror_r string.h EXV_HAVE_STRERROR_R )
check_cxx_source_compiles( "
#include <string.h>
int main() {
char buff[100];
const char* c = strerror_r(0,buff,100);
return 0;
}" EXV_STRERROR_R_CHAR_P )
check_include_file_cxx( "unistd.h" EXV_HAVE_UNISTD_H )
check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H )
if ( NOT MINGW AND NOT MSYS AND NOT MSVC )
check_include_file_cxx( "regex.h" EXV_HAVE_REGEX_H )
endif()
set(EXV_ENABLE_NLS ${EXIV2_ENABLE_NLS})
configure_file(cmake/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY)