-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
98 lines (90 loc) · 3.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
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
cmake_minimum_required(VERSION 2.6)
# create_source_group(relativeSourcePath sourceGroupName files)
#
# Creates a source group with the specified name relative to the relative path
# specified.
#
# Parameters:
# - sourceGroupName: Name of the source group to create.
# - relativeSourcePath: Relative path to the files.
# - sourceFiles: Files to add to the source group.
#
# For example if you have the following directory structure:
#
# - ExampleApplication
# - include
# - Main.h
# - Window
# Window.h
# - source
# - Main.cpp
# - Window
# Window.cpp
#
# You can get your list of files and call create_source_group the following way
#
# file(GLOB_RECURSE my_source_files ${CMAKE_CURRENT_SOURCE_DIR}/source/*)
# create_source_group("Source Files" "${CMAKE_CURRENT_SOURCE_DIR}/source" ${my_source_files})
# file(GLOB_RECURSE my_header_files ${CMAKE_CURRENT_SOURCE_DIR}/include/*)
# create_source_group("Header Files" "${CMAKE_CURRENT_SOURCE_DIR}/include" ${my_header_files})
# add_executable(ExampleApplication ${my_source_files} ${my_header_files})
#
# Then the generated solution would look like this
#
# - ExampleApplication (project)
# - Header Files
# - Main.h
# - Window
# Window.h
# - Source Files
# - Main.cpp
# - Window
# Window.cpp
#
function(create_source_group sourceGroupName relativeSourcePath)
FOREACH(currentSourceFile ${ARGN})
FILE(RELATIVE_PATH folder ${relativeSourcePath} ${currentSourceFile})
get_filename_component(filename ${folder} NAME)
string(REPLACE ${filename} "" folder ${folder})
if(NOT folder STREQUAL "")
string(REGEX REPLACE "/+$" "" folderlast ${folder})
string(REPLACE "/" "\\" folderlast ${folderlast})
SOURCE_GROUP("${sourceGroupName}\\${folderlast}" FILES ${currentSourceFile})
endif(NOT folder STREQUAL "")
ENDFOREACH(currentSourceFile ${ARGN})
endfunction(create_source_group)
# ----------------------------------------
# hellcat executable
# ----------------------------------------
project(hellcat C CXX)
#set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE Debug)
add_definitions(-mavx)
#add_definitions(-msse4.2)
add_definitions(-std=c++11)
add_definitions(-Weffc++)
add_definitions(-pedantic)
#add_definitions(-O3)
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-Wcast-align)
add_definitions(-w)
file(GLOB_RECURSE HELLCAT_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.c
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
list(SORT HELLCAT_SOURCES)
create_source_group("Source Files" "${CMAKE_CURRENT_SOURCE_DIR}/src" ${HELLCAT_SOURCES})
include_directories(${CMAKE_SOURCE_DIR}/lib/libevent-2.0.21-stable/include/)
include_directories(${CMAKE_SOURCE_DIR}/lib/mdb/libraries/liblmdb/)
include_directories(${CMAKE_SOURCE_DIR}/lib/Haywire/include/)
find_package(Threads REQUIRED)
add_executable (hellcat
${HELLCAT_SOURCES}
${CMAKE_SOURCE_DIR}/lib/mdb/libraries/liblmdb/mdb.o
${CMAKE_SOURCE_DIR}/lib/mdb/libraries/liblmdb/midl.o)
# Libraries to link in reverse order because that's what ld requires.
target_link_libraries (hellcat ${CMAKE_THREAD_LIBS_INIT}
${CMAKE_SOURCE_DIR}/lib/Haywire/builds/unix/debug/libhaywire.a
${CMAKE_SOURCE_DIR}/lib/Haywire/builds/unix/debug/libuv.a)