# declare additional include directories
IF(WITH_LIBXML)
  INCLUDE_DIRECTORIES(${WITH_LIBXMLINC}/include)
ENDIF(WITH_LIBXML)

# declare directories containing used libraries
LINK_DIRECTORIES(${dcmdata_BINARY_DIR} ${ofstd_BINARY_DIR})
IF(WITH_ZLIB)
  LINK_DIRECTORIES(${WITH_ZLIBINC}/lib)
ENDIF(WITH_ZLIB)
IF(WITH_LIBXML)
  LINK_DIRECTORIES(${WITH_LIBXMLINC}/lib)
ENDIF(WITH_LIBXML)

# declare executables
ADD_EXECUTABLE(dcm2xml dcm2xml)
ADD_EXECUTABLE(dcmconv dcmconv)
ADD_EXECUTABLE(dcmcrle dcmcrle)
ADD_EXECUTABLE(dcmdrle dcmdrle)
ADD_EXECUTABLE(dcmdump dcmdump)
ADD_EXECUTABLE(dcmftest dcmftest)
ADD_EXECUTABLE(dcmgpdir dcmgpdir)
ADD_EXECUTABLE(dcmodify dcmodify mdfconen mdfdsman)
ADD_EXECUTABLE(dump2dcm dump2dcm)
ADD_EXECUTABLE(xml2dcm xml2dcm)

# make sure executables are linked to the corresponding libraries
# dcm2xml
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcm2xml netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcm2xml netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmconv
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmconv netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmconv netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmcrle
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmcrle netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmcrle netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmdrle
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmdrle netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmdrle netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmdump
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmdump netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmdump netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmftest
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmftest ofstd debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmftest ofstd)
ENDIF(WITH_ZLIB)
# dcmgpdir
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmgpdir netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmgpdir netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dcmodify
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmodify netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dcmodify netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# dump2dcm
IF(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dump2dcm netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
ELSE(WITH_ZLIB)
  TARGET_LINK_LIBRARIES(dump2dcm netapi32 wsock32 ofstd dcmdata)
ENDIF(WITH_ZLIB)
# xml2dcm
IF(WITH_ZLIB)
  IF(WITH_LIBXML)
    TARGET_LINK_LIBRARIES(xml2dcm netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o debug libxml2_d optimized libxml2_o debug iconv_d optimized iconv_o)
  ELSE(WITH_LIBXML)
    TARGET_LINK_LIBRARIES(xml2dcm netapi32 wsock32 ofstd dcmdata debug zlib_d optimized zlib_o)
  ENDIF(WITH_LIBXML)
ELSE(WITH_ZLIB)
  IF(WITH_LIBXML)
    TARGET_LINK_LIBRARIES(xml2dcm netapi32 wsock32 ofstd dcmdata debug libxml2_d optimized libxml2_o debug iconv_d optimized iconv_o)
  ELSE(WITH_LIBXML)
    TARGET_LINK_LIBRARIES(xml2dcm netapi32 wsock32 ofstd dcmdata)
  ENDIF(WITH_LIBXML)
ENDIF(WITH_ZLIB)
