INCLUDE(FortranSettings)

TRIBITS_SUBPACKAGE(SVDI)

SET(SVDI_VERSION_MAJOR "1")
SET(SVDI_VERSION_MINOR "0")
SET(SVDI_VERSION_PATCH "0")
SET(SVDI_VERSION "${SVDI_VERSION_MAJOR}.${SVDI_VERSION_MINOR}")
SET(SVDI_VERSION_FULL "${SVDI_VERSION}.${SVDI_VERSION_PATCH}")

INCLUDE_DIRECTORIES(
  "${CMAKE_CURRENT_SOURCE_DIR}"
  "${CMAKE_CURRENT_SOURCE_DIR}/cgi"
  "${CMAKE_CURRENT_SOURCE_DIR}/vdi_drivers"
)

SET(CDR_SOURCES "")
APPEND_GLOB(CDR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cdr/*.f
			${CMAKE_CURRENT_SOURCE_DIR}/cdr/*.F
			${CMAKE_CURRENT_SOURCE_DIR}/cdr/*.c)
TRIBITS_ADD_LIBRARY(
	svdi_cdr
	STATIC
	SOURCES ${CDR_SOURCES}
)

SET_PROPERTY(TARGET svdi_cdr PROPERTY POSITION_INDEPENDENT_CODE TRUE)

SET(CGI_SOURCES "")
APPEND_GLOB(CGI_SOURCES
	${CMAKE_CURRENT_SOURCE_DIR}/cgi/cgisdum.c
	${CMAKE_CURRENT_SOURCE_DIR}/cgi/vdicgi.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/sdcgif.f
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/vdicgi_char.f
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/mdcgi.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/sdcgi.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/x11_vdix11.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/x11_x11xlate.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/pst_vdipst.f
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/pst_pstxlate.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/met_vdimet.f
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/met_metxlate.c
        ${CMAKE_CURRENT_SOURCE_DIR}/cgi/svdi_addrwrap.F)

TRIBITS_ADD_LIBRARY(
	svdi_cgi
	STATIC
	SOURCES ${CGI_SOURCES}
)

SET_PROPERTY(TARGET svdi_cgi PROPERTY POSITION_INDEPENDENT_CODE TRUE)

TRIBITS_SUBPACKAGE_POSTPROCESS()

