-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
63 lines (50 loc) · 1.45 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
cmake_minimum_required(VERSION 2.8.12)
project(bamdb)
set(CMAKE_C_FLAGS "-Wall -g -std=gnu99 -fPIC")
option(STATIC_BAMDB_BUILD "STATIC_BAMDB_BUILD" OFF)
option(BUILD_BAMDB_WRITER "BUILD_BAMDB_WRITER" ON)
# External dependencies
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
find_package(HTSlib REQUIRED)
find_package(LMDB REQUIRED)
set(LIBS
${HTSlib_LIBRARIES}
${LMDB_LIBRARIES}
m
pthread
)
if(BUILD_BAMDB_WRITER)
add_definitions(-DBUILD_BAMDB_WRITER)
find_package(CK REQUIRED)
list(APPEND LIBS ${CK_LIBRARIES})
include_directories(${CK_INCLUDE_DIRS})
endif()
include_directories("${PROJECT_SOURCE_DIR}/include")
file(GLOB SOURCES "src/*.c")
# Include dependency headers
include_directories(
${HTSlib_INCLUDE_DIRS}
${LMDB_INCLUDE_DIRS}
)
# Create bamdb library
if(STATIC_BAMDB_BUILD)
add_library(libbamdb STATIC ${SOURCES})
else(STATIC_BAMDB_BUILD)
add_library(libbamdb SHARED ${SOURCES})
endif(STATIC_BAMDB_BUILD)
target_link_libraries(libbamdb ${LIBS})
set_target_properties(libbamdb PROPERTIES OUTPUT_NAME "bamdb")
# Create bamdb executable
if(BUILD_BAMDB_WRITER)
add_executable(bamdb "src/bamdb_main.c")
target_link_libraries(bamdb ${LIBS} libbamdb)
endif()
# Default install path. Can be overridden with DESTDIR
if(BUILD_BAMDB_WRITER)
install(TARGETS bamdb RUNTIME DESTINATION bin)
endif()
install(DIRECTORY include/
DESTINATION include/bamdb)
install(TARGETS libbamdb
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)