-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (72 loc) · 2.48 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
###
# Copyright (c) 2018 T-Life Research Center, Fudan University, Shanghai, China.
# See the accompanying Manual for the contributors and the way to cite this work.
# Comments and suggestions welcome. Please contact
# Dr. Guanghong Zuo <[email protected]>
#
# @Author: Dr. Guanghong Zuo
# @Date: 2017-09-01 16:22:53
# @Last Modified By: Dr. Guanghong Zuo
# @Last Modified Time: 2018-04-26 19:50:44
###
cmake_minimum_required(VERSION 3.0)
#cmake_policy(SET CMP0012 NEW)
project (AlnSeqTree)
enable_language(CXX)
## For Compile
##########################################################
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
SET(CMAKE_VERBOSE_MAKEFILE on)
ADD_DEFINITIONS("-O3 -std=c++11")
#set(CMAKE_FIND_LIBRARY_SUFFIXES .a .tbd .dylib .so)
### Check required LIABRARIES
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} z)
foreach(LIB ${REQUIRED_LIBRARIES})
find_library(THE${LIB} ${LIB})
if(THE${LIB})
message("-- Found library " ${LIB} ": " ${THE${LIB}})
LINK_LIBRARIES(${LIB})
else()
message(FATAL_ERROR ${LIB} " library not found!")
endif()
endforeach()
### Check the OPENMP
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if (APPLE)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib -lomp")
endif ()
endif()
### Check HDF5
find_path(HDF5_INCLUDE NAMES H5Cpp.h)
find_library(HDF5_LIBRARY hdf5)
find_library(HDF5_CXX_LIBRARY hdf5_cpp)
if(HDF5_INCLUDE AND HDF5_LIBRARY AND HDF5_CXX_LIBRARY)
ADD_DEFINITIONS("-D_HDF5")
message("-- Found HDF5_CPP Include file: " ${HDF5_INCLUDE})
INCLUDE_DIRECTORIES(${HDF5_INCLUDE})
message("-- Found HDF5 Library: " ${HDF5_LIBRARY})
LINK_LIBRARIES(${HDF5_LIBRARY})
message("-- Found HDF5_CPP Library: " ${HDF5_CXX_LIBRARY})
LINK_LIBRARIES(${HDF5_CXX_LIBRARY})
else()
message("-- HDF5 format will not support!")
endif()
### Check NetCDF
find_path(NETCDF_INCLUDE netcdfcpp.h)
find_library(NETCDF_LIBRARY netcdf_c++)
if(NETCDF_INCLUDE AND NETCDF_LIBRARY)
ADD_DEFINITIONS("-D_NETCDF")
message("-- Found NETCDF_CPP Include file: " ${NETCDF_INCLUDE})
INCLUDE_DIRECTORIES(${NETCDF_INCLUDE})
message("-- Found NETCDF Library: " ${HDF5_LIBRARY})
LINK_LIBRARIES(${NETCDF_LIBRARY})
else()
message("-- netCDF format will not support!")
endif()
## include subdirectories
ADD_SUBDIRECTORY(src)