-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
38 lines (28 loc) · 1.16 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
# how to write CMakeList.txt: https://subingwen.cn/cmake/CMake-primer
cmake_minimum_required (VERSION 3.12.0)
# Project information
project (BaseVar VERSION 1.1.0 LANGUAGES CXX)
# Set the C++ standard required for the project
set(CMAKE_CXX_STANDARD 17) # C++ 17
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fPIC -Wl,-no_compact_unwind")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
# find all source codes
file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/htslib) # include the header of htslib
link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/htslib/libhts.a) # link htslib static lib: htslib.a
# create executable basevar
add_executable(basevar ${SRC_LIST})
# Compile htslib
add_custom_target(
Buildhts ALL
COMMAND autoreconf -i && ./configure && make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/htslib
)
set(COMMON_SYS_LIB pthread z bz2 m lzma curl)
if (APPLE)
target_link_libraries(basevar ${COMMON_SYS_LIB})
else ()
target_link_libraries(basevar ${COMMON_SYS_LIB} ssl crypto)
endif()