Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all the cmake commands for finding dependencies into a separate file #18

Merged
merged 6 commits into from
Jul 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ ELSE()
SET ( EXIV2_ENABLE_DYNAMIC_RUNTIME OFF )
ENDIF()

# set include path for FindXXX.cmake files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/")
include(config/findDependencies.cmake)

IF( MINGW OR UNIX )
IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" )
Expand Down
63 changes: 0 additions & 63 deletions config/CMakeChecks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,70 +49,18 @@ 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} )

find_package(Threads REQUIRED)

IF( EXIV2_ENABLE_PNG )
FIND_PACKAGE( ZLIB REQUIRED )
INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} )
SET (HAVE_LIBZ ${ZLIB_FOUND})
ENDIF( EXIV2_ENABLE_PNG )

IF( EXIV2_ENABLE_VIDEO )
SET( ENABLE_VIDEO 1 )
ENDIF( EXIV2_ENABLE_VIDEO )

IF( EXIV2_ENABLE_WEBREADY )
SET( ENABLE_WEBREADY 1 )
IF( EXIV2_ENABLE_CURL )
FIND_PACKAGE( CURL REQUIRED)
INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIR} )
SET ( USE_CURL 1 )
ENDIF()

IF( EXIV2_ENABLE_SSH )
FIND_PACKAGE( SSH REQUIRED)
INCLUDE_DIRECTORIES( ${SSH_INCLUDE_DIR} )
SET ( USE_SSH 1 )
ENDIF( EXIV2_ENABLE_SSH )
ENDIF( EXIV2_ENABLE_WEBREADY )

IF (EXIV2_ENABLE_XMP)
FIND_PACKAGE(EXPAT REQUIRED)
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR})
# FindEXPAT.cmake doesn't check for REQUIRED flags - so we need to check ourselves
IF( MINGW OR UNIX )
IF (NOT EXPAT_FOUND)
MESSAGE(FATAL_ERROR "missing library expat required for XMP")
ENDIF( NOT EXPAT_FOUND )
ENDIF( MINGW OR UNIX )
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_NLS )
FIND_PACKAGE(Intl)
if(Intl_FOUND)
INCLUDE_DIRECTORIES(${Intl_INCLUDE_DIRS})
SET(LIBINTL_LIBRARIES ${Intl_LIBRARIES})
else()
SET(LIBINTL_LIBRARIES)
endif()
IF( NOT LOCALEDIR )
SET( LOCALEDIR "${CMAKE_INSTALL_LOCALEDIR}" )
IF( WIN32 )
STRING( REPLACE "/" "\\\\" LOCALEDIR ${LOCALEDIR} )
ENDIF( WIN32 )
ENDIF( NOT LOCALEDIR )
ADD_DEFINITIONS( -DEXV_LOCALEDIR="${LOCALEDIR}" )
SET( ENABLE_NLS 1 )
ENDIF( EXIV2_ENABLE_NLS )

# unicode path support on windows
IF( EXIV2_ENABLE_WIN_UNICODE )
Expand All @@ -126,22 +74,11 @@ 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 )

IF( ICONV_ACCEPTS_CONST_INPUT )
MESSAGE ( "ICONV_ACCEPTS_CONST_INPUT : yes" )
ENDIF( ICONV_ACCEPTS_CONST_INPUT )

FIND_PACKAGE(MSGFMT)
IF(MSGFMT_FOUND)
MESSAGE(STATUS "Program msgfmt found (${MSGFMT_EXECUTABLE})")
SET( EXIV2_BUILD_PO 1 )
ENDIF(MSGFMT_FOUND)

# checking for Header files
check_include_file( "inttypes.h" have_inttypes_h )
Expand Down
31 changes: 0 additions & 31 deletions config/FindEXPAT.cmake

This file was deleted.

4 changes: 0 additions & 4 deletions config/FindIconv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ endif()
find_path(ICONV_INCLUDE_DIR iconv.h)

if(NOT ICONV_INCLUDE_DIR STREQUAL "ICONV_INCLUDE_DIR-NOTFOUND")
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
check_function_exists(iconv_open ICONV_IN_GLIBC)
endif()

Expand All @@ -44,7 +43,6 @@ else()
set(ICONV_TEST "In glibc")
endif()

set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
check_cxx_source_compiles(
"#include <iconv.h>
Expand All @@ -63,7 +61,6 @@ else(ICONV_FOUND)
endif(ICONV_FOUND)

if(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
check_cxx_source_compiles(
"#include <iconv.h>
Expand All @@ -73,7 +70,6 @@ if(ICONV_FOUND)
}"
ICONV_ACCEPTS_NONCONST_INPUT)

set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
check_cxx_source_compiles(
"#include <iconv.h>
Expand Down
63 changes: 63 additions & 0 deletions config/findDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# set include path for FindXXX.cmake files
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/")

find_package(Threads REQUIRED)

if( EXIV2_ENABLE_PNG )
find_package( ZLIB REQUIRED )
include_directories( ${ZLIB_INCLUDE_DIR} )
set (HAVE_LIBZ ${ZLIB_FOUND})
endif( EXIV2_ENABLE_PNG )

if( EXIV2_ENABLE_WEBREADY )
set( ENABLE_WEBREADY 1 )
if( EXIV2_ENABLE_CURL )
find_package( CURL REQUIRED)
include_directories( ${CURL_INCLUDE_DIR} )
set ( USE_CURL 1 )
endif()

if( EXIV2_ENABLE_SSH )
find_package( SSH REQUIRED)
include_directories( ${SSH_INCLUDE_DIR} )
set ( USE_SSH 1 )
endif( EXIV2_ENABLE_SSH )
endif( EXIV2_ENABLE_WEBREADY )

if (EXIV2_ENABLE_XMP)
find_package(EXPAT REQUIRED)
include_directories(${EXPAT_INCLUDE_DIR})
endif (EXIV2_ENABLE_XMP)

if( EXIV2_ENABLE_NLS )
find_package(Intl)
if(Intl_FOUND)
include_directories(${Intl_INCLUDE_DIRS})
set(LIBINTL_LIBRARIES ${Intl_LIBRARIES})
else()
set(LIBINTL_LIBRARIES)
endif()
if( NOT LOCALEDIR )
set( LOCALEDIR "${CMAKE_INSTALL_LOCALEDIR}" )
if( WIN32 )
STRING( REPLACE "/" "\\\\" LOCALEDIR ${LOCALEDIR} )
endif( WIN32 )
endif( NOT LOCALEDIR )
add_definitions( -DEXV_LOCALEDIR="${LOCALEDIR}" )
set( ENABLE_NLS 1 )
endif( EXIV2_ENABLE_NLS )

find_package(Iconv)
if( ICONV_FOUND )
set( HAVE_ICONV 1 )
include_directories(${ICONV_INCLUDE_DIR})
message ( "-- ICONV_LIBRARIES : " ${ICONV_LIBRARIES} )
endif( ICONV_FOUND )

if( EXIV2_ENABLE_BUILD_PO )
find_package(MSGFMT)
if(MSGFMT_FOUND)
message(STATUS "Program msgfmt found (${MSGFMT_EXECUTABLE})")
set( EXIV2_BUILD_PO 1 )
endif(MSGFMT_FOUND)
endif()