-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
89 lines (64 loc) · 2.07 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
cmake_minimum_required(VERSION 3.5)
project(alacenc
VERSION 0.4.0
DESCRIPTION "command-line ALAC encoder"
LANGUAGES C CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT CMAKE_BUILD_TYPE)
set ( CMAKE_BUILD_TYPE Release )
endif (NOT CMAKE_BUILD_TYPE)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS "-Wall -Wextra -Wpedantic ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-g ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG ${CMAKE_C_FLAGS_RELEASE}")
if (CMAKE_BUILD_TYPE STREQUAL Release)
message("For building debug version use -DCMAKE_BUILD_TYPE=Debug option.")
endif()
LIST(APPEND SOURCES
main.cpp
types.h
types.cpp
wavheader.h
wavheader.cpp
encoder.h
encoder.cpp
atoms.h
atoms.cpp
tags.h
tags.cpp
)
# Defining the bit order for different architectures
if(CMAKE_VERSION VERSION_LESS "3.20.0")
include(TestBigEndian)
TEST_BIG_ENDIAN(big_endian)
if (${big_endian})
set(TARGET_RT_LITTLE_ENDIAN 0)
else()
set(TARGET_RT_LITTLE_ENDIAN 1)
endif()
else()
if (${CMAKE_CXX_BYTE_ORDER} STREQUAL "LITTLE_ENDIAN")
set(TARGET_RT_LITTLE_ENDIAN 1)
else()
set(TARGET_RT_LITTLE_ENDIAN 0)
endif()
endif()
if (${TARGET_RT_LITTLE_ENDIAN})
message(STATUS "Use little endian")
else()
message(STATUS "Use big endian")
endif()
add_definitions(-DTARGET_RT_LITTLE_ENDIAN=${TARGET_RT_LITTLE_ENDIAN})
# Defining the bit order for different architectures
add_definitions(-DPROJECT_NAME=\"${PROJECT_NAME}\")
add_definitions(-DPROJECT_VERSION=\"${CMAKE_PROJECT_VERSION}\")
add_definitions(-DPROJECT_DESCRIPTION=\"${PROJECT_DESCRIPTION}\")
add_subdirectory(vendor/alac EXCLUDE_FROM_ALL)
add_subdirectory(vendor/docopt EXCLUDE_FROM_ALL)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} alac_s docopt_s)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)