forked from injinj/rdbparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
46 lines (46 loc) · 1.94 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
cmake_minimum_required (VERSION 3.9.0)
if (POLICY CMP0111)
cmake_policy(SET CMP0111 OLD)
endif ()
project (rdbparser)
include_directories (
include
${CMAKE_SOURCE_DIR}/lzf/include
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions(/DPCRE2_STATIC)
if ($<CONFIG:Release>)
add_compile_options (/arch:AVX2 /GL /std:c11)
else ()
add_compile_options (/arch:AVX2 /std:c11)
endif ()
if (NOT TARGET pcre2-8-static)
add_library (pcre2-8-static STATIC IMPORTED)
set_property (TARGET pcre2-8-static PROPERTY IMPORTED_LOCATION_DEBUG ../pcre2/build/Debug/pcre2-8-staticd.lib)
set_property (TARGET pcre2-8-static PROPERTY IMPORTED_LOCATION_RELEASE ../pcre2/build/Release/pcre2-8-static.lib)
include_directories (../pcre2/build)
else ()
include_directories (${CMAKE_BINARY_DIR}/pcre2)
endif ()
if (NOT TARGET lzf)
add_library (lzf STATIC IMPORTED)
set_property (TARGET lzf PROPERTY IMPORTED_LOCATION_DEBUG ../lzf/build/Debug/lzf.lib)
set_property (TARGET lzf PROPERTY IMPORTED_LOCATION_RELEASE ../lzf/build/Release/lzf.lib)
endif ()
else ()
add_compile_options (-Wall -Wextra -Werror -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -ggdb -O3 -fno-omit-frame-pointer)
if (TARGET pcre2-8-static)
include_directories (${CMAKE_BINARY_DIR}/pcre2)
endif ()
if (NOT TARGET lzf)
add_library (lzf STATIC IMPORTED)
set_property (TARGET lzf PROPERTY IMPORTED_LOCATION ../lzf/build/liblzf.a)
endif ()
endif ()
add_library (rdbparser STATIC src/rdb_decode.cpp src/rdb_json.cpp src/rdb_restore.cpp src/rdb_pcre.cpp)
if (TARGET pcre2-8-static)
link_libraries (rdbparser lzf pcre2-8-static)
else ()
link_libraries (rdbparser lzf -lpcre2-8)
endif ()
add_executable (rdbp src/rdb_main.cpp)