#enable_language (Fortran)

#project(molpatch-tool)

#cmake_minimum_required(VERSION 2.6.2)
#if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
#  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
#    cmake_policy(VERSION 2.8.4)
#  else()
#    cmake_policy(VERSION 2.6)
#  endif()
#endif()

#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)

#find_package(GMP REQUIRED)

#include_directories(${GMP_INCLUDE_DIR})

#set(SMESH_C_CPP_SRCS
# #     pdbparser/defines.h
    
#    smesh/skinmesh.cpp
#    smesh/skinmesh.h
#    smesh/qtetmesh.cpp
#    smesh/simpsmesh.cpp
#    smesh/mixcx.cpp
#    smesh/mixcx.h
#    smesh/triring.cpp
#    smesh/triring.h
#    smesh/basic.cpp
#    smesh/basic.h
#    smesh/delone.c
#    smesh/delone.h
#    smesh/sos_minor_copy.c
#    smesh/alf_gmp.c
#    smesh/sos_minor_gmp.c
#    smesh/defines.h
#    smesh/gbvar.h
##     tdclass.cpp
#    smesh/tdclass.h
#  )

#set(PDBPARSER_FORTRAN_SRCS
##   fixpdb.f
#  pdbparser/pdb_parser.f
#  pdbparser/protein_energy.f
#  pdbparser/sidechain_scmf.f
#  pdbparser/defines.h
#)
  
#set(SMESH_FORTRAN_SRCS
  
#  smesh/add_vertex2C.f
#  smesh/vertex_tet_star.f
#  smesh/delete_vertexC.f
#  smesh/locate2C.f
#  smesh/alfcx.f
#  smesh/delcx.f
#  smesh/locate_copy.f
#  smesh/regularC.f
#  smesh/convex_new.f
#  smesh/reset_delaunayC.f
#  smesh/adjust.f
#  smesh/truncate_real.f
#  smesh/tetra_center.f
#  )

#set_source_files_properties(
#  ${PDBPARSER_FORTRAN_SRCS}
#  PROPERTIES COMPILE_FLAGS "-u -O2 -x f77-cpp-input")

#set_source_files_properties(
#  ${SMESH_FORTRAN_SRCS}
#  PROPERTIES COMPILE_FLAGS "-u -O2 -x f77-cpp-input")

#set_source_files_properties(
#  ${SMESH_C_CPP_SRCS}
#  pdbparser/ParsePDB.c
#  molsurf-tool_main.cpp
#  PROPERTIES COMPILE_FLAGS "-O -DINSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")

#add_executable(parsepdb-tool
#  ${PDBPARSER_FORTRAN_SRCS}
#  pdbparser/ParsePDB.c)

#target_link_libraries(parsepdb-tool ${GMP_LIBRARIES} )
#install(TARGETS parsepdb-tool RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
#install(FILES pdbparser/opls_rad.dat DESTINATION ${CMAKE_INSTALL_PREFIX})

#add_executable(molsurf-tool
#  ${SMESH_FORTRAN_SRCS}
#  ${SMESH_C_CPP_SRCS}
#  utl.h
#  utl.cpp
#  molsurf-tool_main.cpp)

#target_link_libraries(molsurf-tool ${GMP_LIBRARIES} )
#install(TARGETS molsurf-tool RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})



find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
if(NOT VTK_LIBRARIES)
  set(VTK_LIBRARIES vtkHybrid)
endif(NOT VTK_LIBRARIES)

find_package(Boost REQUIRED)

find_package(CGAL QUIET REQUIRED COMPONENTS Core )
include( ${CGAL_USE_FILE} )

include_directories(
    ${PROJECT_SOURCE_DIR}/
    ${Boost_INCLUDE_DIRS}
    ${CGAL_CURRENT_SOURCE_DIR}
)

add_executable(molpatch-tool
  ${PROJECT_SOURCE_DIR}/utl.h
  ${PROJECT_SOURCE_DIR}/utl.cpp
  ${PROJECT_SOURCE_DIR}/utl_inl.h
  molpatch-tool_main.cpp)

target_link_libraries(molpatch-tool ${GMP_LIBRARIES} ${VTK_LIBRARIES} GL)
install(TARGETS molpatch-tool RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})





