forked from haywire/haywire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (57 loc) · 2.23 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
cmake_minimum_required(VERSION 2.6)
include("common.cmake")
# ----------------------------------------
# Haywire
# ----------------------------------------
project(haywire C)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
add_definitions(-std=gnu99)
#add_definitions(-mavx)
add_definitions(-msse4.1)
add_definitions(-pedantic)
add_definitions(-O3)
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-Wcast-align)
add_definitions(-w)
if (UNIX)
add_definitions(-DUNIX)
endif (UNIX)
file(GLOB_RECURSE HAYWIRE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/haywire/*.h
${CMAKE_CURRENT_SOURCE_DIR}/src/haywire/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/haywire/*.c
${CMAKE_CURRENT_SOURCE_DIR}/src/haywire/*.cpp)
list(SORT HAYWIRE_SOURCES)
create_source_group("Source Files" "${CMAKE_CURRENT_SOURCE_DIR}/src" ${HAYWIRE_SOURCES})
include_directories(${CMAKE_SOURCE_DIR}/lib/libuv/include)
include_directories(${CMAKE_SOURCE_DIR}/include)
find_package(Threads REQUIRED)
add_library(haywire STATIC ${HAYWIRE_SOURCES})
target_link_libraries (haywire ${CMAKE_THREAD_LIBS_INIT}
${CMAKE_SOURCE_DIR}/lib/libuv/.libs/libuv.a)
GET_PROPERTY(haywire_location TARGET haywire PROPERTY LOCATION)
# ----------------------------------------
# Hello world sample
# ----------------------------------------
file(GLOB_RECURSE HELLOWORLD_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/samples/hello_world/*.h
${CMAKE_CURRENT_SOURCE_DIR}/src/samples/hello_world/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/samples/hello_world/*.c
${CMAKE_CURRENT_SOURCE_DIR}/src/samples/hello_world/*.cpp)
list(SORT HELLOWORLD_SOURCES)
create_source_group("Source Files" "${CMAKE_CURRENT_SOURCE_DIR}/src" ${HELLOWORLD_SOURCES})
include_directories(${CMAKE_SOURCE_DIR}/lib/libuv/include)
include_directories(${CMAKE_SOURCE_DIR}/include)
find_package(Threads REQUIRED)
add_executable (hello_world
${HELLOWORLD_SOURCES})
add_dependencies(hello_world haywire)
# Libraries to link in reverse order because that's what ld requires.
target_link_libraries (hello_world
${haywire_location}
${CMAKE_SOURCE_DIR}/lib/libuv/.libs/libuv.a
${CMAKE_THREAD_LIBS_INIT})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (hello_world rt)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")