INCLUDE(FortranSettings)

TRIBITS_SUBPACKAGE(Blot)

INCLUDE_DIRECTORIES(
  "${CMAKE_CURRENT_SOURCE_DIR}"
)

SET(HEADERS "")

APPEND_GLOB(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.f ${CMAKE_CURRENT_SOURCE_DIR}/*.F)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/blot.f")

TRIBITS_ADD_LIBRARY(
	blotlib
	STATIC
	HEADERS	${HEADERS}
	SOURCES ${SOURCES}
)

TRIBITS_ADD_EXECUTABLE(blot_x11 NOEXEPREFIX NOEXESUFFIX
				LINKER_LANGUAGE Fortran
			        SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/blot.f
					${CMAKE_CURRENT_SOURCE_DIR}/cgi/x11_cgisx11.c
			        COMM serial mpi
				INSTALLABLE)

TRIBITS_ADD_EXECUTABLE(blot_xcps NOEXEPREFIX NOEXESUFFIX
				LINKER_LANGUAGE Fortran
			        SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/blot.f
					${CMAKE_CURRENT_SOURCE_DIR}/cgi/vdx11cps.F
					${CMAKE_CURRENT_SOURCE_DIR}/cgi/vdicps_dual.f
			        COMM serial mpi
				INSTALLABLE)

TRIBITS_ADD_EXECUTABLE(blot_cps NOEXEPREFIX NOEXESUFFIX
				LINKER_LANGUAGE Fortran
			        SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/blot.f
					${CMAKE_CURRENT_SOURCE_DIR}/cgi/vdicps.f
			        COMM serial mpi
				INSTALLABLE)

SET_PROPERTY(TARGET blot_x11  PROPERTY POSITION_INDEPENDENT_CODE TRUE)
SET_PROPERTY(TARGET blot_xcps PROPERTY POSITION_INDEPENDENT_CODE TRUE)
SET_PROPERTY(TARGET blot_cps  PROPERTY POSITION_INDEPENDENT_CODE TRUE)

TRIBITS_SUBPACKAGE_POSTPROCESS()
