SET(ICPFIND_LIB_SRC AutoCtrlPointCreator.cpp CPDetectorConfig.cpp)
SET(ICPFIND_LIB_HEADER AutoCtrlPointCreator.h CPDetectorConfig.h)

IF (${HUGIN_SHARED_LIBS})
  ADD_LIBRARY(icpfindlib SHARED ${ICPFIND_LIB_SRC} ${ICPFIND_LIB_HEADER})
  TARGET_LINK_LIBRARIES(icpfindlib ${Boost_LIBRARIES})
  SET_TARGET_PROPERTIES(icpfindlib PROPERTIES VERSION ${HUGIN_LIB_VERSION})
  IF(WIN32)
    INSTALL(TARGETS icpfindlib RUNTIME DESTINATION ${BINDIR})
  ELSEIF(${HUGIN_LIBS_PRIVATE_DIR})
    install(TARGETS icpfindlib LIBRARY DESTINATION ${LIBDIR}/hugin NAMELINK_SKIP)
  ELSE(WIN32)
    INSTALL(TARGETS icpfindlib LIBRARY DESTINATION ${LIBDIR} NAMELINK_SKIP)
  ENDIF(WIN32)
ELSE (${HUGIN_SHARED_LIBS})
  ADD_LIBRARY(icpfindlib STATIC ${ICPFIND_LIB_SRC} ${ICPFIND_LIB_HEADER})
ENDIF (${HUGIN_SHARED_LIBS})

TARGET_LINK_LIBRARIES(icpfindlib huginbase ${wxWidgets_LIBRARIES} huginbasewx)

ADD_EXECUTABLE(icpfind icpfind.h icpfind.cpp)

TARGET_LINK_LIBRARIES(icpfind icpfindlib ${wxWidgets_LIBRARIES}  ${common_libs})
INSTALL(TARGETS icpfind DESTINATION ${BINDIR})

IF(WIN32)
  INSTALL(FILES default.win DESTINATION ${HUGINDATADIR}/data RENAME default.setting)
ELSE()
  IF(APPLE)
    INSTALL(FILES default.mac DESTINATION ${HUGINDATADIR}/data RENAME default.setting)
    IF(MAC_SELF_CONTAINED_BUNDLE)
      FILE(COPY default.mac DESTINATION ".")
      FILE(RENAME ${CMAKE_CURRENT_BINARY_DIR}/default.mac ${CMAKE_CURRENT_BINARY_DIR}/default.setting)
    ENDIF(MAC_SELF_CONTAINED_BUNDLE)
  ELSE()
    INSTALL(FILES default.unix DESTINATION ${HUGINDATADIR}/data RENAME default.setting)
  ENDIF()
ENDIF()
