+# 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
+ xdrf2pdb.F
+ geomout.F
+ misc.f
+ rescode.f
+ nazwy.f
+)
+
+set(UNRES_XDRF_XDRF2PDB-M_SRC
+ xdrf2pdb-m.F
+ geomout.F
+ misc.f
+ rescode.f
+ nazwy.f
+)
+
+
+set(UNRES_XDRF_XDRF2X_SRC
+ xdrf2x.F
+)
+
+
+set(UNRES_XDRF_XDRF2XANG_SRC
+ xdrf2ang.f
+ misc.f
+ rescode.f
+ nazwy.f
+ intcor.f
+ arcos.f
+)
+
+set(UNRES_XDRF_PP_SRC
+ geomout.F
+ xdrf2pdb.F
+ xdrf2pdb-m.F
+ xdrf2x.F
+)
+
+set(CPPFLAGS "PROCOR -DUNRES -DSPLITELE -DNEWUNRES" )
+
+#=========================================
+# 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} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
+
+
+#=========================================
+# Build the binaries
+#=========================================
+add_executable(xdrf2pdb ${UNRES_XDRF_XDRF2PDB_SRC} )
+target_link_libraries( xdrf2pdb xdrf )
+
+add_executable(xdrf2pdb-m ${UNRES_XDRF_XDRF2PDB-M_SRC} )
+target_link_libraries( xdrf2pdb-m xdrf )
+
+add_executable(xdrf2x ${UNRES_XDRF_XDRF2X_SRC} )
+target_link_libraries( xdrf2x xdrf )
+
+add_executable(xdrf2ang ${UNRES_XDRF_XDRF2XANG_SRC} )
+target_link_libraries( xdrf2ang xdrf )
+
+
+#=========================================
+# TESTS
+#=========================================
+
+
+# Create files needed for tests
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10one.seq
+"XAAAAAAAAAAX"
+)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10three.seq
+"D Ala Ala Ala Ala Ala Ala Ala Ala Ala Ala D "
+)
+
+file( COPY ${CMAKE_SOURCE_DIR}/ctest/ala10MD.cx
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+
+# Test xdrf2pdb
+add_test(NAME XDRF2PDB-one COMMAND xdrf2pdb one ala10one.seq ala10MD.cx )
+add_test(NAME XDRF2PDB-three COMMAND xdrf2pdb three ala10three.seq ala10MD.cx )
+
+# Test xdrf2ang
+add_test(NAME XDRF2ANG-one COMMAND xdrf2ang one ala10one.seq ala10MD.cx )
+add_test(NAME XDRF2ANG-three COMMAND xdrf2ang three ala10three.seq ala10MD.cx )
+
+
+