-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
51 lines (46 loc) · 1.31 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
cmake_minimum_required(VERSION 3.20)
# Be sure it is built as Release Mode
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
project(qmapi LANGUAGES CXX)
file(GLOB_RECURSE QQMUSIC_API_SOURCE CONFIGURE_DEPENDS src/*.cc include/*.h)
find_package(CURL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(jsoncpp REQUIRED)
add_subdirectory(utils)
add_library(qmapi SHARED ${QQMUSIC_API_SOURCE})
target_include_directories(
qmapi PUBLIC
include
)
target_link_libraries(
qmapi PUBLIC
qmutils
ZLIB::ZLIB
CURL::libcurl
JsonCpp::JsonCpp
)
if (NOT DEFINED QQMUSIC_API_BUILD_TYPE)
message(FATAL_ERROR "==>QQMUSIC_API_BUILD_TYPE not set...")
elseif(${QQMUSIC_API_BUILD_TYPE} STREQUAL "DEMO")
message("==>Building Demo...")
add_executable(demo demo/main.cc)
target_include_directories(
demo PUBLIC
include
)
target_link_libraries(
demo PUBLIC
qmapi
)
elseif(${QQMUSIC_API_BUILD_TYPE} STREQUAL "SHARED_LIB")
message("==>Building as shared library...")
else ()
message(FATAL_ERROR "==>QQMUSIC_API_BUILD_TYPE set error...")
endif()