1include(CheckIncludeFileCXX)
2include(CheckCXXSourceCompiles)
3include(CheckCXXSymbolExists)
4
5# Note that the scope of the EXV_ variables in local
6if (${EXIV2_ENABLE_WEBREADY})
7    set(EXV_USE_SSH   ${EXIV2_ENABLE_SSH})
8    set(EXV_USE_CURL  ${EXIV2_ENABLE_CURL})
9endif()
10set(EXV_ENABLE_BMFF      ${EXIV2_ENABLE_BMFF})
11set(EXV_ENABLE_VIDEO     ${EXIV2_ENABLE_VIDEO})
12set(EXV_ENABLE_WEBREADY  ${EXIV2_ENABLE_WEBREADY})
13set(EXV_HAVE_LENSDATA    ${EXIV2_ENABLE_LENSDATA})
14set(EXV_HAVE_PRINTUCS2   ${EXIV2_ENABLE_PRINTUCS2})
15
16set(EXV_PACKAGE_NAME     ${PROJECT_NAME})
17set(EXV_PACKAGE_VERSION  ${PROJECT_VERSION})
18set(EXV_PACKAGE_STRING   "${PROJECT_NAME} ${PROJECT_VERSION}")
19if (${EXIV2_ENABLE_XMP} OR ${EXIV2_ENABLE_EXTERNAL_XMP})
20    set(EXV_HAVE_XMP_TOOLKIT ON)
21else()
22    set(EXV_HAVE_XMP_TOOLKIT OFF)
23endif()
24set(EXV_HAVE_ICONV       ${ICONV_FOUND})
25set(EXV_HAVE_LIBZ        ${ZLIB_FOUND})
26set(EXV_UNICODE_PATH     ${EXIV2_ENABLE_WIN_UNICODE})
27
28check_cxx_symbol_exists(gmtime_r    time.h         EXV_HAVE_GMTIME_R)
29check_cxx_symbol_exists(mmap        sys/mman.h     EXV_HAVE_MMAP )
30check_cxx_symbol_exists(munmap      sys/mman.h     EXV_HAVE_MUNMAP )
31check_cxx_symbol_exists(strerror_r  string.h       EXV_HAVE_STRERROR_R )
32
33check_cxx_source_compiles( "
34#include <string.h>
35int main() {
36    char buff[100];
37    const char* c = strerror_r(0,buff,100);
38    (void)c;  // ignore unuse-variable
39    return 0;
40}" EXV_STRERROR_R_CHAR_P )
41
42check_include_file_cxx( "memory.h"      EXV_HAVE_MEMORY_H )
43check_include_file_cxx( "process.h"     EXV_HAVE_PROCESS_H )
44check_include_file_cxx( "stdbool.h"     EXV_HAVE_STDBOOL_H )
45check_include_file_cxx( "strings.h"     EXV_HAVE_STRINGS_H )
46check_include_file_cxx( "sys/stat.h"    EXV_HAVE_SYS_STAT_H )
47check_include_file_cxx( "sys/types.h"   EXV_HAVE_SYS_TYPES_H )
48check_include_file_cxx( "inttypes.h"    EXV_HAVE_INTTYPES_H )
49check_include_file_cxx( "unistd.h"      EXV_HAVE_UNISTD_H )
50check_include_file_cxx( "sys/mman.h"    EXV_HAVE_SYS_MMAN_H )
51if ( NOT MINGW AND NOT MSYS AND NOT MSVC )
52check_include_file_cxx( "regex.h"       EXV_HAVE_REGEX_H )
53endif()
54
55set(EXV_ENABLE_NLS ${EXIV2_ENABLE_NLS})
56
57configure_file(cmake/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY)
58