project(${TAKKTILE2_LIBRARY})

set(TAKKTILE2_MAJOR_VERSION 1 PARENT_SCOPE)
set(TAKKTILE2_MINOR_VERSION 0 PARENT_SCOPE)
set(TAKKTILE2_PATCH_VERSION 0 PARENT_SCOPE)

vp_include_directories(${CMAKE_CURRENT_SOURCE_DIR})

file(GLOB lib_srcs *.cpp)
file(GLOB lib_hdrs *.h)

add_library(${TAKKTILE2_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})

if(UNIX)
  if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
  endif()
endif()

if((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_11) AND CXX11_CXX_FLAGS)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_CXX_FLAGS}")
elseif((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_14) AND CXX14_CXX_FLAGS)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX14_CXX_FLAGS}")
elseif((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_17) AND CXX17_CXX_FLAGS)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX17_CXX_FLAGS}")
endif()

if(ENABLE_SOLUTION_FOLDERS)
  set_target_properties(${TAKKTILE2_LIBRARY} PROPERTIES FOLDER "3rdparty")
endif()

set_target_properties(${TAKKTILE2_LIBRARY}
  PROPERTIES OUTPUT_NAME ${TAKKTILE2_LIBRARY}
  DEBUG_POSTFIX "${VISP_DEBUG_POSTFIX}"
  COMPILE_PDB_NAME ${TAKKTILE2_LIBRARY}
  COMPILE_PDB_NAME_DEBUG "${TAKKTILE2_LIBRARY}${VISP_DEBUG_POSTFIX}"
  ARCHIVE_OUTPUT_DIRECTORY ${VISP_3P_LIBRARY_OUTPUT_PATH}
  )

if(NOT BUILD_SHARED_LIBS)
  vp_install_target(${TAKKTILE2_LIBRARY} EXPORT VISPModules ARCHIVE DESTINATION ${VISP_3P_LIB_INSTALL_PATH} COMPONENT dev)
endif()

