-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (47 loc) · 2.13 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
cmake_minimum_required(VERSION 3.29)
project(wnpcli)
file(READ "VERSION" PROJECT_VERSION)
find_package(libwnp REQUIRED)
set(SRC_FILES
src/daemon.c
src/wnpcli.c
deps/cargs.c
)
add_compile_definitions(WNPCLI_VERSION="${PROJECT_VERSION}")
add_executable(${PROJECT_NAME} ${SRC_FILES})
target_include_directories(${PROJECT_NAME}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps>
)
target_link_libraries(${PROJECT_NAME} PRIVATE libwnp::libwnp)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "wnpcli - A Command Line Interface for WebNowPlaying")
set(CPACK_PACKAGE_VENDOR "keifufu")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CPACK_GENERATOR "DEB;RPM;TGZ")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "keifufu <[email protected]>")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_linux_amd64")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
unset(CPACK_PACKAGE_DESCRIPTION_FILE)
unset(CPACK_RESOURCE_FILE_LICENSE)
unset(CPACK_RESOURCE_FILE_README)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION .)
set(CPACK_GENERATOR "productbuild")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local/bin")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_macos_aarch64")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
set(CPACK_NSIS_INSTALLER_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_win64")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_win64-installer")
endif()
include(CPack)
cpack_add_component(CPACK_COMPONENTS_ALL REQUIRED) # packagebuild fix