cmake is working for cluster_unres
[unres.git] / source / cluster / unres / src / CMakeLists.txt
1 #
2 # CMake project file for cluster analysis from UNRESMD  
3
4
5 enable_language (Fortran)
6
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CLUSTER_UNRES_SRC0 
11         arcos.f
12         cartprint.f
13         chainbuild.f
14         contact.f
15         convert.f
16         fitsq.f
17         geomout.F
18         hc.f
19         initialize.f
20         intcor.f
21         main_clust.F
22         matmult.f
23         misc.f
24         noyes.f
25         pinorm.f
26         readpdb.f
27         readrtns.F
28         rescode.f
29         srtclust.f
30         timing.F
31         track.F
32         wrtclust.f
33         cxread.F
34 )
35
36 set(UNRES_CLUSTER_PP_SRC
37         geomout.F
38         readrtns.F
39         timing.F
40         track.F
41
42
43
44 #================================================
45 # Set comipiler flags for different sourcefiles  
46 #================================================
47 if (Fortran_COMPILER_NAME STREQUAL "ifort")
48   set(FFLAGS0 "-ip -w -I." ) 
49 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
50   set(FFLAGS0 "-std=legacy -I. " ) 
51 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
52
53
54 set_property(SOURCE ${UNRES_CLUSTER_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
55
56
57 #=========================================
58 # System specific flags
59 #=========================================
60 set(CPPFLAGS "NEWUNRES")
61 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
62   set(CPPFLAGS "${CPPFLAGS} -DLINUX") 
63 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
64
65
66
67 #=========================================
68 # Apply preprocesor flags to *.F files
69 #=========================================
70 set_property(SOURCE ${UNRES_CLUSTER_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )  
71
72
73 #========================================
74 #  Setting binary name
75 #========================================
76 set(UNRES_CLUSTER_BIN "cluster_unres_${Fortran_COMPILER_NAME}.exe")
77
78 #=========================================
79 # Set full unres CLUSTER sources
80 #=========================================
81 set(UNRES_CLUSTER_SRCS ${UNRES_CLUSTER_UNRES_SRC0} )
82
83 #=========================================
84 # Build the binary
85 #=========================================
86 add_executable(UNRES_CLUSTER_BIN ${UNRES_CLUSTER_SRCS} )
87 set_target_properties(UNRES_CLUSTER_BIN PROPERTIES OUTPUT_NAME ${UNRES_CLUSTER_BIN})
88 set_property(TARGET UNRES_CLUSTER_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
89
90 #=========================================
91 # Link libraries
92 #=========================================
93 # link libxdrf.a 
94 target_link_libraries( UNRES_CLUSTER_BIN xdrf )
95
96
97 #=========================================
98 # Install Path
99 #=========================================
100 install(TARGETS UNRES_CLUSTER_BIN DESTINATION ${CMAKE_INSTALL_PREFIX})
101