forked from rcsb/mmtf-cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
59 lines (46 loc) · 1.56 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
cmake_minimum_required(VERSION 3.15...3.26 FATAL_ERROR)
# Version based on repo tag
execute_process(
COMMAND git describe --exact-match --tags
OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET
)
string(STRIP "${GIT_VERSION}" GIT_VERSION)
string(REGEX REPLACE "^v" "" GIT_VERSION "${GIT_VERSION}")
if ("${GIT_VERSION}" STREQUAL "")
set(GIT_VERSION "0.0.0")
endif()
project(mmtf-cpp VERSION ${GIT_VERSION} LANGUAGES CXX)
message("Using git to tag version as: ${GIT_VERSION}")
option(mmtf_build_examples "Build the examples" OFF)
SET(MSGPACK_USE_BOOST OFF CACHE BOOL "msgpack-c uses boost by default, lets keep that off")
# option(MSGPACK_USE_BOOST "msgpack-c uses boost by default, lets keep that off" OFF)
add_library(MMTFcpp INTERFACE)
target_compile_features(MMTFcpp INTERFACE cxx_auto_type)
target_include_directories(MMTFcpp INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
include(FetchContent)
FetchContent_Declare(
msgpack-cxx
GIT_REPOSITORY https://github.com/msgpack/msgpack-c.git
GIT_TAG cpp-6.1.0)
FetchContent_MakeAvailable(msgpack-cxx)
if(WIN32)
target_link_libraries(MMTFcpp INTERFACE ws2_32)
endif()
target_link_libraries(MMTFcpp INTERFACE msgpack-cxx)
if (build_py)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/python)
endif()
if (BUILD_TESTS)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests)
endif()
if (mmtf_build_examples)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples)
endif()
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION "include"
FILES_MATCHING PATTERN "*.hpp")