# Minimum required version of CMake
cmake_minimum_required(VERSION 3.1.3)

# Set CMake project name
project(SVN2GIT)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SVN2GIT_SOURCE_DIR}/CMake")
find_package(SubversionLibrary)
find_package(APR)
find_package(Qt5 REQUIRED Core)
include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${Qt5Core_INCLUDE_DIRS}
  ${SUBVERSION_INCLUDE_DIRS}
  ${APR_INCLUDE_DIRS}
  )

add_definitions(-fPIC)
add_definitions(-g)

include(CheckFunctionExists)
set(CMAKE_REQUIRED_INCLUDES ${SUBVERSION_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${SUBVERSION_LIBRARIES})
check_function_exists(svn_repos_open3 HAVE_SVN_REPOS_OPEN3)
if(NOT HAVE_SVN_REPOS_OPEN3)
  check_function_exists(svn_repos_open HAVE_SVN_REPOS_OPEN)
  if(HAVE_SVN_REPOS_OPEN)
    add_definitions(-DUSE_SVN_REPOS_OPEN=1)
    add_definitions(-Wno-deprecated-declarations)
  endif(HAVE_SVN_REPOS_OPEN)
endif(NOT HAVE_SVN_REPOS_OPEN3)
check_function_exists(svn_stream_read_full HAVE_SVN_STREAM_READ_FULL)
if(NOT HAVE_SVN_STREAM_READ_FULL)
  check_function_exists(svn_stream_read HAVE_SVN_STREAM_READ)
  if(HAVE_SVN_STREAM_READ)
    add_definitions(-DUSE_SVN_STREAM_READ=1)
    add_definitions(-Wno-deprecated-declarations)
  endif(HAVE_SVN_STREAM_READ)
endif(NOT HAVE_SVN_STREAM_READ_FULL)
check_function_exists(svn_stream_copy3 HAVE_SVN_STREAM_COPY3)
if(NOT HAVE_SVN_STREAM_COPY3)
  check_function_exists(svn_stream_copy HAVE_SVN_STREAM_COPY)
  if(HAVE_SVN_STREAM_COPY)
    add_definitions(-DUSE_SVN_STRAM_COPY=1)
    add_definitions(-Wno-deprecated-declarations)
  endif(HAVE_SVN_STREAM_COPY)
endif(NOT HAVE_SVN_STREAM_COPY3)

set(SVN2GIT_SRCS
  ruleparser.cpp
  repository.cpp
  svn.cpp
  main.cpp
  CommandLineParser.cpp
  )

add_definitions(-DVER="brlcad-svn2git-20200725")

add_executable(svn-all-fast-export ${SVN2GIT_SRCS})
target_link_libraries(svn-all-fast-export ${SUBVERSION_LIBRARIES} ${Qt5Core_LIBRARIES})

# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8

