forked from wez/atomicparsley
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
103 lines (89 loc) · 2.04 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.5)
project(AtomicParsley)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
option(ASAN "whether to enable ASAN" OFF)
find_program(GIT git)
if(GIT)
execute_process(
COMMAND "${GIT}" "show" "-s" "--format=%H;%cd" "--date=format:%Y%m%d.%H%M%S.0"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_data
ERROR_VARIABLE git_err
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(git_result EQUAL 0)
list(GET git_data 0 BUILD_INFO)
list(GET git_data 1 PACKAGE_VERSION)
endif()
endif()
include(CheckSymbolExists)
check_symbol_exists(strsep "string.h" HAVE_STRSEP)
if(HAVE_STRSEP)
add_definitions(-DHAVE_STRSEP)
endif()
check_symbol_exists(fseeko "stdio.h" HAVE_FSEEKO)
if(HAVE_FSEEKO)
add_definitions(-DHAVE_FSEEKO)
endif()
add_definitions(
-DPACKAGE_VERSION="${PACKAGE_VERSION}"
-DBUILD_INFO="${BUILD_INFO}"
-D_FILE_OFFSET_BITS=64
)
find_package(ZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
add_definitions(-DHAVE_ZLIB_H)
endif()
list(APPEND sources
src/CDtoc.cpp
src/arrays.cpp
src/compress.cpp
src/extracts.cpp
src/iconv.cpp
src/id3v2.cpp
src/main.cpp
src/metalist.cpp
src/parsley.cpp
src/sha1.cpp
src/util.cpp
src/uuid.cpp
)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND sources
src/nsfile.mm
src/nsimage.mm
)
endif()
if(WIN32)
list(APPEND sources
src/extras/getopt.c
src/extras/getopt1.c
)
endif()
add_executable(
AtomicParsley
${sources}
)
if(ZLIB_FOUND)
target_link_libraries(
AtomicParsley
${ZLIB_LIBRARIES}
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(
AtomicParsley
"-framework Cocoa"
"-framework Foundation"
"-framework IOKit"
)
endif()
if (ASAN)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()
install(TARGETS AtomicParsley RUNTIME DESTINATION bin)