# Set of programs to convert UNRES xdrf format (compressed Cartesian coordinates) to PDF
# or raw-Cartesian format (*.x) or to extract backbone angular coordinates (*.ang)
# The pdb files can be constructed from canonical or MREMD trajectories.
#
# The xdrf library is required
#
# Programs
#
# xdrf2pdb   : converts a single cx trajectory file to PDB format
# xdrf2x     : converts a single cx trajectory file to raw-coordinate (x) format
# xdrf2ang   : extracts backbone angles from a cx trajectory file
# xdrf2pdb-m : converts a selected trajectory of a MREMD run dumpend into a cx file to PDB format
#
# xdrf2pdb1  : converts conformation(s) selected from a wham post-processing run into PDB format
# xdrf2x1    : converts conformation(s) selected from a wham post-processing run into raw (x) format.
#
# 9/23/2010 A. Liwo
#
# CMake file by D. Jagieła
# 

set(UNRES_XDRF_XDRF2PDB_SRC-M
	xdrf2pdb.F
	geomout.F
	misc.f
	rescode.f
	nazwy.f
)

set(UNRES_XDRF_XDRF2PDB-M_SRC-M
	xdrf2pdb-m.F
	geomout.F
	misc.f
	rescode.f
	nazwy.f
)


set(UNRES_XDRF_PP_SRC-M
	geomout.F
	xdrf2pdb.F
	xdrf2pdb-m.F
	xdrf2x.F	
)

set(CPPFLAGS "PROCOR -DUNRES -DMP -DMPI -DSPLITELE -DNEWUNRES -DXDRFPDB" )

#=========================================
# System specific flags
#=========================================
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  set(CPPFLAGS "${CPPFLAGS} -DLINUX")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

# Apply preprocesor flags to *.F files
set_property(SOURCE ${UNRES_XDRF_PP_SRC-M} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )

 
#=========================================
# Build the binaries
#=========================================
add_executable(UNRES_XDRF2PDB_BIN-M   ${UNRES_XDRF_XDRF2PDB_SRC-M} )
target_link_libraries(UNRES_XDRF2PDB_BIN-M xdrf )
set_target_properties(UNRES_XDRF2PDB_BIN-M PROPERTIES OUTPUT_NAME xdrf-M2pdb )
set_property(TARGET UNRES_XDRF2PDB_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )

add_executable(UNRES_XDRF2PDBM_BIN-M ${UNRES_XDRF_XDRF2PDB-M_SRC-M} )
target_link_libraries( UNRES_XDRF2PDBM_BIN-M xdrf )
set_target_properties(UNRES_XDRF2PDBM_BIN-M PROPERTIES OUTPUT_NAME xdrf-M2pdb-m )
set_property(TARGET UNRES_XDRF2PDBM_BIN-M PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )


#=========================================
# Install Path
#=========================================
install(TARGETS UNRES_XDRF2PDB_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
install(TARGETS UNRES_XDRF2PDBM_BIN-M DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)

