-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (49 loc) · 1.84 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
cmake_minimum_required(VERSION 2.8)
#add macro
#TODO put it in another file
MACRO(SUBDIRLIST result curdir)
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
SET(dirlist "")
FOREACH(child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
LIST(APPEND dirlist ${child})
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()
#set defines
#set external-directory
add_definitions(-DEXTERNAL_DIR="${CMAKE_CURRENT_BINARY_DIR}/external")
#set config-directory
add_definitions(-DCONFIGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/configs")
if(POLICY CMP0042)
# Set old MACOSX_RPATH policy on OS X
cmake_policy(SET CMP0042 OLD)
endif()
if(APPLE)
# OS X tries to resolve symbols upon link-time by default (in contrast to linux),
# thus we need to specify to resolve symbols dynamically.
# See http://stackoverflow.com/questions/3695234/what-is-the-deal-with-undefined-symbols-in-a-shared-library-or-dylib
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
endif()
#set compiler flags
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"))
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -std=c++0x -Wall -Wextra -pedantic -O0 ")
endif()
# show config files in QtCreator
file(GLOB_RECURSE CONFIG_FILES_LCONF "**/*.lconf")
file(GLOB_RECURSE CONFIG_FILES_XML "**/*.xml")
add_executable(stub stub.cpp ${CONFIG_FILES_LCONF} ${CONFIG_FILES_XML})
#compile core
add_subdirectory(LMS/lms)
#Add shared headers
file(GLOB_RECURSE SHARED_HEADER **/CMakeSharedHeaders.txt)
if (SHARED_HEADER)
foreach(filepath ${SHARED_HEADER})
get_filename_component(FOLDER ${filepath} DIRECTORY)
include_directories(${FOLDER})
include("${FOLDER}/CMakeSharedHeaders.txt")
endforeach()
endif()
#compile libs/modules
add_subdirectory(external)