it's usual to uppercase CMake macro calls.

v0.27.3
HumanDynamo 15 years ago
parent aa1175e103
commit 67c267a383

@ -29,49 +29,49 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
project( exiv2 )
PROJECT( exiv2 )
cmake_minimum_required( VERSION 2.6 )
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
set( PACKAGE_BUGREPORT "ahuggel@gmx.net" )
set( PACKAGE "exiv2" )
set( PACKAGE_NAME "exiv2" )
set( PACKAGE_STRING "exiv2 0.19.1" )
set( PACKAGE_TARNAME "exiv2" )
set( PACKAGE_VERSION "0.19.1" )
set( GENERIC_LIB_VERSION "6.0.0" )
set( GENERIC_LIB_SOVERSION "6" )
SET( PACKAGE_BUGREPORT "ahuggel@gmx.net" )
SET( PACKAGE "exiv2" )
SET( PACKAGE_NAME "exiv2" )
SET( PACKAGE_STRING "exiv2 0.19.1" )
SET( PACKAGE_TARNAME "exiv2" )
SET( PACKAGE_VERSION "0.19.1" )
SET( GENERIC_LIB_VERSION "6.0.0" )
SET( GENERIC_LIB_SOVERSION "6" )
# options and there default values
option( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" OFF )
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON )
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
option( EXIV2_ENABLE_LENSDATA "include lens data" ON )
option( EXIV2_ENABLE_COMMERCIAL "compile with the EXV_COMMERCIAL_VERSION symbol set" OFF )
option( BUILD_samples "Build the unit tests" OFF )
OPTION( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
OPTION( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" OFF )
OPTION( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
OPTION( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON )
OPTION( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
OPTION( EXIV2_ENABLE_LENSDATA "include lens data" ON )
OPTION( EXIV2_ENABLE_COMMERCIAL "compile with the EXV_COMMERCIAL_VERSION symbol set" OFF )
OPTION( BUILD_samples "Build the unit tests" OFF )
if( MINGW OR UNIX )
add_definitions( -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W )
endif( MINGW OR UNIX )
IF( MINGW OR UNIX )
ADD_DEFINITIONS( -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W)
ENDIF( MINGW OR UNIX )
if( EXIV2_ENABLE_XMP )
set( HAVE_XMP_TOOLKIT ON )
set( XMPLIB "do" )
endif( EXIV2_ENABLE_XMP )
IF( EXIV2_ENABLE_XMP )
SET( HAVE_XMP_TOOLKIT ON )
SET( XMPLIB "do" )
ENDIF( EXIV2_ENABLE_XMP )
if( BUILD_samples )
IF( BUILD_samples )
EXIV2_ENABLE_TESTING()
endif( BUILD_samples )
ENDIF( BUILD_samples )
include( config/ConfigureChecks.cmake )
INCLUDE( config/ConfigureChecks.cmake )
set( INSTALL_TARGET_STANDARD_ARGS RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )
SET( INSTALL_TARGET_STANDARD_ARGS RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib )
# add sources from XMPSDK directory - this needs to be done here
set( XMPSRC ${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/ExpatAdapter.cpp
SET( XMPSRC ${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/ExpatAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/MD5.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/ParseRDF.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/UnicodeConversions.cpp
@ -86,20 +86,21 @@ set( XMPSRC ${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/ExpatAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/XMPMeta-Serialize.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/XMPMeta.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/XMPUtils-FileInfo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/XMPUtils.cpp )
${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/src/XMPUtils.cpp
)
# the following lines need to be added to circumvent the error in xmpsdk\src\MD5.h
if( ${EXV_HAVE_STDINT_H} )
add_definitions( -DEXV_HAVE_STDINT_H )
endif( ${EXV_HAVE_STDINT_H} )
IF( ${EXV_HAVE_STDINT_H} )
ADD_DEFINITIONS( -DEXV_HAVE_STDINT_H )
ENDIF( ${EXV_HAVE_STDINT_H} )
add_subdirectory( xmpsdk )
add_subdirectory( src )
ADD_SUBDIRECTORY( xmpsdk )
ADD_SUBDIRECTORY( src )
if( BUILD_samples )
add_subdirectory( samples )
endif( BUILD_samples )
IF( BUILD_samples )
ADD_SUBDIRECTORY( samples )
ENDIF( BUILD_samples )
if( EXIV2_ENABLE_XMP )
add_dependencies(exiv2 xmp)
endif( EXIV2_ENABLE_XMP )
IF( EXIV2_ENABLE_XMP )
ADD_DEPENDENCIES(exiv2 xmp)
ENDIF( EXIV2_ENABLE_XMP )

@ -30,74 +30,74 @@
#
# ConfigureChecks for exiv2
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/config )
include( CheckIncludeFile )
include( CheckFunctionExists )
include( CheckSymbolExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/config )
INCLUDE( CheckIncludeFile )
INCLUDE( CheckFunctionExists )
INCLUDE( CheckSymbolExists )
INCLUDE( CheckCSourceCompiles )
INCLUDE( CheckCXXSourceCompiles )
include( FindIconv )
INCLUDE( FindIconv )
set( STDC_HEADERS ON )
set( HAVE_DECL_STRERROR_R 0 )
SET( STDC_HEADERS ON )
SET( HAVE_DECL_STRERROR_R 0 )
set( HAVE_PRINTUCS2 ${EXIV2_ENABLE_PRINTUCS2} )
set( HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA} )
SET( HAVE_PRINTUCS2 ${EXIV2_ENABLE_PRINTUCS2} )
SET( HAVE_LENSDATA ${EXIV2_ENABLE_LENSDATA} )
include_directories( ${CMAKE_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/include )
link_directories( ${CMAKE_LIBRARY_PATH} )
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} )
INCLUDE_DIRECTORIES( ${CMAKE_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/xmpsdk/include )
LINK_DIRECTORIES( ${CMAKE_LIBRARY_PATH} )
SET( CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} )
if( EXIV2_ENABLE_PNG )
find_package( ZLIB )
include_directories( ${ZLIB_INCLUDE_DIR} )
set (HAVE_LIBZ ${ZLIB_FOUND})
endif( EXIV2_ENABLE_PNG )
IF( EXIV2_ENABLE_PNG )
FIND_PACKAGE( ZLIB )
INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} )
SET (HAVE_LIBZ ${ZLIB_FOUND})
ENDIF( EXIV2_ENABLE_PNG )
if (EXIV2_ENABLE_XMP)
find_package(EXPAT)
include_directories(${EXPAT_INCLUDE_DIR})
IF (EXIV2_ENABLE_XMP)
FIND_PACKAGE(EXPAT)
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR})
# FindEXPAT.cmake doesn't check for REQUIRED flags - so we need to check ourselves
if (NOT EXPAT_FOUND)
message(FATAL_ERROR "missing library expat required for XMP")
endif( NOT EXPAT_FOUND )
endif (EXIV2_ENABLE_XMP)
IF (NOT EXPAT_FOUND)
MESSAGE(FATAL_ERROR "missing library expat required for XMP")
ENDIF( NOT EXPAT_FOUND )
ENDIF (EXIV2_ENABLE_XMP)
if( EXIV2_ENABLE_SHARED )
add_definitions( -DEXV_HAVE_DLL )
set( STATIC_FLAG SHARED )
else( EXIV2_ENABLE_SHARED )
set( STATIC_FLAG STATIC )
endif( EXIV2_ENABLE_SHARED )
IF( EXIV2_ENABLE_SHARED )
ADD_DEFINITIONS( -DEXV_HAVE_DLL )
SET( STATIC_FLAG SHARED )
ELSE( EXIV2_ENABLE_SHARED )
SET( STATIC_FLAG STATIC )
ENDIF( EXIV2_ENABLE_SHARED )
if( EXIV2_ENABLE_NLS )
if( NOT LOCALEDIR )
set( LOCALEDIR "\"${CMAKE_INSTALL_PREFIX}/share/locale\"" )
if( WIN32 )
string( REPLACE "/" "\\\\" LOCALEDIR ${LOCALEDIR} )
endif( WIN32 )
endif( NOT LOCALEDIR )
add_definitions( -DEXV_LOCALEDIR=${LOCALEDIR} )
endif( EXIV2_ENABLE_NLS )
IF( EXIV2_ENABLE_NLS )
IF( NOT LOCALEDIR )
SET( LOCALEDIR "\"${CMAKE_INSTALL_PREFIX}/share/locale\"" )
IF( WIN32 )
STRING( REPLACE "/" "\\\\" LOCALEDIR ${LOCALEDIR} )
ENDIF( WIN32 )
ENDIF( NOT LOCALEDIR )
ADD_DEFINITIONS( -DEXV_LOCALEDIR=${LOCALEDIR} )
ENDIF( EXIV2_ENABLE_NLS )
if( EXIV2_ENABLE_COMMERCIAL )
add_definitions( -DEXV_COMMERCIAL_VERSION )
endif( EXIV2_ENABLE_COMMERCIAL )
IF( EXIV2_ENABLE_COMMERCIAL )
ADD_DEFINITIONS( -DEXV_COMMERCIAL_VERSION )
ENDIF( EXIV2_ENABLE_COMMERCIAL )
find_package(Iconv)
if( ICONV_FOUND )
set( HAVE_ICONV 1 )
include_directories(${ICONV_INCLUDE_DIR})
message ( "================> ICONV_LIBRARIES : " ${ICONV_LIBRARIES} )
endif( ICONV_FOUND )
FIND_PACKAGE(Iconv)
IF( ICONV_FOUND )
SET( HAVE_ICONV 1 )
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
MESSAGE ( "================> ICONV_LIBRARIES : " ${ICONV_LIBRARIES} )
ENDIF( ICONV_FOUND )
if( ICONV_ACCEPTS_CONST_INPUT )
message ( "ICONV_ACCEPTS_CONST_INPUT : yes" )
endif( ICONV_ACCEPTS_CONST_INPUT )
IF( ICONV_ACCEPTS_CONST_INPUT )
MESSAGE ( "ICONV_ACCEPTS_CONST_INPUT : yes" )
ENDIF( ICONV_ACCEPTS_CONST_INPUT )
# checking for Header files
check_include_file( "inttypes.h" HAVE_INTTYPES_H )
check_include_file( "inttypes.h" have_inttypes_h )
check_include_file( "libintl.h" HAVE_LIBINTL_H )
check_include_file( "malloc.h" HAVE_MALLOC_H )
check_include_file( "memory.h" HAVE_MEMORY_H )
@ -130,63 +130,57 @@ check_function_exists( strtol HAVE_STRTOL )
check_function_exists( timegm HAVE_TIMEGM )
check_function_exists( vprintf HAVE_VPRINTF )
message( STATUS "None: ${CMAKE_CXX_FLAGS}" )
message( STATUS "Debug: ${CMAKE_CXX_FLAGS_DEBUG}" )
message( STATUS "Release: ${CMAKE_CXX_FLAGS_RELEASE}" )
message( STATUS "RelWithDebInfo: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
message( STATUS "MinSizeRel: ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
MESSAGE( STATUS "None: ${CMAKE_CXX_FLAGS}" )
MESSAGE( STATUS "Debug: ${CMAKE_CXX_FLAGS_DEBUG}" )
MESSAGE( STATUS "Release: ${CMAKE_CXX_FLAGS_RELEASE}" )
MESSAGE( STATUS "RelWithDebInfo: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
MESSAGE( STATUS "MinSizeRel: ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
if( HAVE_STDBOOL_H )
check_symbol_exists( "_Bool" stdbool.h HAVE__BOOL )
endif( HAVE_STDBOOL_H )
IF( HAVE_STDBOOL_H )
CHECK_SYMBOL_EXISTS( "_Bool" stdbool.h HAVE__BOOL )
ENDIF( HAVE_STDBOOL_H )
# struct tm in sys/time.h
if( HAVE_SYS_TIME_H )
check_c_source_compiles( "#include <sys/time.h>
IF( HAVE_SYS_TIME_H )
CHECK_C_SOURCE_COMPILES( "#include <sys/time.h>
int main() {
struct tm t;
return 0;
}" TM_IN_SYS_TIME )
endif( HAVE_SYS_TIME_H )
ENDIF( HAVE_SYS_TIME_H )
#####################################################################################
# strerror_r returns char*
# NOTE : reverting commit #2041, which break compilation under linux and windows
check_c_source_compiles( "#include <string.h>
CHECK_C_SOURCE_COMPILES( "#include <string.h>
int main() {
char * c;
c = strerror_r(0,c,0);
return 0;
}" STRERROR_R_CHAR_P )
# check_cxx_source_compiles( "
# #include <cstring>
# int dfunc() { char cb[12]; return *(strerror_r(1, cb, sizeof(cb))) == '\0'; }
# " STRERROR_R_CHAR_P )
# function is declared with the above
if( STRERROR_R_CHAR_P )
set( HAVE_DECL_STRERROR_R 1 )
endif( STRERROR_R_CHAR_P )
IF( STRERROR_R_CHAR_P )
SET( HAVE_DECL_STRERROR_R 1 )
ENDIF( STRERROR_R_CHAR_P )
#####################################################################################
# time.h and sys/time.h can be included in the same file
check_c_source_compiles( "#include <time.h>
CHECK_C_SOURCE_COMPILES( "#include <time.h>
#include <sys/time.h>
int main() {
return 0;
}" TIME_WITH_SYS_TIME )
# for msvc define to int in exv_conf.h
if( NOT MSVC )
set( HAVE_PID_T TRUE )
endif( NOT MSVC )
IF( NOT MSVC )
SET( HAVE_PID_T TRUE )
ENDIF( NOT MSVC )
set( EXV_SYMBOLS
ENABLE_NLS
SET( EXV_SYMBOLS ENABLE_NLS
HAVE_ALARM
HAVE_DECL_STRERROR_R
HAVE_GMTIME_R
@ -233,34 +227,34 @@ PACKAGE_VERSION
STRERROR_R_CHAR_P
)
foreach( entry ${EXV_SYMBOLS} )
set( EXV_${entry} ${${entry}} )
FOREACH( entry ${EXV_SYMBOLS} )
SET( EXV_${entry} ${${entry}} )
# NOTE: to hack...
# message( EXV_${entry} " : " ${${entry}} )
endforeach( entry ${EXV_SYMBOLS} )
# MESSAGE( EXV_${entry} " : " ${${entry}} )
ENDFOREACH( entry ${EXV_SYMBOLS} )
configure_file( config/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/exv_conf.h )
configure_file( config/exv_msvc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/exv_msvc.h COPYONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/exv_conf.h DESTINATION include/exiv2 )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/exv_msvc.h DESTINATION include/exiv2 )
CONFIGURE_FILE( config/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/exv_conf.h )
CONFIGURE_FILE( config/exv_msvc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/exv_msvc.h COPYONLY )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/exv_conf.h DESTINATION include/exiv2 )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/exv_msvc.h DESTINATION include/exiv2 )
if( NOT MSVC )
configure_file( config/exiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION lib/pkgconfig )
endif( NOT MSVC )
IF( NOT MSVC )
CONFIGURE_FILE( config/exiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION lib/pkgconfig )
ENDIF( NOT MSVC )
# ******************************************************************************
# output chosen build options
macro( OptionOutput _outputstring )
if( ${ARGN} )
set( _var "YES" )
else( ${ARGN} )
set( _var "NO" )
endif( ${ARGN} )
message( STATUS "${_outputstring}${_var}" )
endmacro( OptionOutput _outputstring )
MACRO( OptionOutput _outputstring )
IF( ${ARGN} )
SET( _var "YES" )
ELSE( ${ARGN} )
SET( _var "NO" )
ENDIF( ${ARGN} )
MESSAGE( STATUS "${_outputstring}${_var}" )
ENDMACRO( OptionOutput _outputstring )
message( STATUS "-------------------------------------------------------------" )
MESSAGE( STATUS "-------------------------------------------------------------" )
OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND )
OptionOutput( "Building shared library: " EXIV2_ENABLE_SHARED )
OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP )
@ -269,4 +263,4 @@ OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )
OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 )
OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA )
OptionOutput( "commercial build: " EXIV2_ENABLE_COMMERCIAL )
message( STATUS "-------------------------------------------------------------" )
MESSAGE( STATUS "-------------------------------------------------------------" )

Loading…
Cancel
Save