-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·54 lines (46 loc) · 1.48 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
cmake_minimum_required(VERSION 3.0)
project(utils_cc)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (WIN32)
add_definitions(-DOS_WIN32=1)
else ()
if (APPLE)
# Cmake on Apple would not search packages from home brew by default
find_program(brew_bin_path brew)
if (brew_bin_path)
string(REGEX MATCH "^.+homebrew" brew_prefix ${brew_bin_path})
list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${brew_prefix})
link_directories(${brew_prefix}/lib)
include_directories(${brew_prefix}/include)
endif ()
add_definitions(-DOS_UNIX=1)
add_definitions(-DOS_XNU=1)
if (IOS)
#cmake_minimum_required(VERSION 3.15)
add_definitions(-DOS_IOS=1)
else ()
add_definitions(-DOS_MACOSX=1)
endif ()
elseif (UNIX)
add_definitions(-DOS_UNIX=1)
add_definitions(-DOS_LINUX=1)
if (ANDROID)
add_definitions(-DOS_ANDROID=1)
endif ()
else ()
endif ()
endif ()
file(GLOB_RECURSE
${PROJECT_NAME}_files
${PROJECT_SOURCE_DIR}/source/*.c
${PROJECT_SOURCE_DIR}/source/*.cc)
add_library(${PROJECT_NAME} ${${PROJECT_NAME}_files})
set_target_properties(${PROJECT_NAME}
PROPERTIES
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/include
INTERFACE_INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/include)
find_package(GTest QUIET)
if (GTEST_FOUND)
add_subdirectory(test)
endif ()