forked from EyeTribe/tet-cpp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (56 loc) · 2.35 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
##############################################################################
#
# C++ SDK - Cross-platform SDK for The Eye Tribe Tracker
#
##############################################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#----------------------------------------------------------------
#
# Indicate CMake 2.7 and above that we don't want to mix relative
# and absolute paths in linker lib lists.
#
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
PROJECT(TET_CPPSDK)
#-----------------------------------------------------------------------------
#
# We only want a debug and release configurations
#
SET(CMAKE_CONFIGURATION_TYPES "Debug" "Release" CACHE INTERNAL "Allowed Configuration types" FORCE)
SET(TET_GENERATE_DOCS FALSE CACHE BOOL "Should we run docs compilation")
SET(TET_CPPSDK_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/include)
SET(TET_CPPSDK_LIBS "")
SET( Boost_USE_MULTITHREAD ON )
SET( Boost_USE_STATIC_LIBS ON )
SET(BOOST_MIN_VERSION "1.53.0")
FIND_PACKAGE( Boost REQUIRED thread system )
IF(Boost_FOUND)
SET(TET_CPPSDK_INCLUDE_DIRS ${TET_CPPSDK_INCLUDE_DIRS} "${Boost_INCLUDE_DIR}")
SET(TET_CPPSDK_LIBS ${TET_CPPSDK_LIBS} "${Boost_LIBRARIES}")
ELSE()
message (FATAL_ERROR "Could not find Boost libraries!")
ENDIF(Boost_FOUND)
FILE( GLOB TET_CPPSDK_FILES ${CMAKE_CURRENT_LIST_DIR}/include/*.h ${CMAKE_CURRENT_LIST_DIR}/src/*.hpp ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp )
INCLUDE_DIRECTORIES( ${TET_CPPSDK_INCLUDE_DIRS} )
SET(TET_CPPSDK_LIBRARY_OUTPUT "${TET_CPPSDK_SOURCE_DIR}/lib")
IF( NOT EXISTS ${TET_CPPSDK_LIBRARY_OUTPUT} )
MAKE_DIRECTORY( "${TET_CPPSDK_LIBRARY_OUTPUT}" )
ENDIF( NOT EXISTS ${TET_CPPSDK_LIBRARY_OUTPUT} )
SET( LIB_NAME "GazeApiLib" )
ADD_LIBRARY(${LIB_NAME} ${TET_CPPSDK_FILES} )
SET(TET_CPPSDK_LIBS ${TET_CPPSDK_LIBS} ${LIB_NAME})
IF( WIN32 )
SET_TARGET_PROPERTIES( ${LIB_NAME} PROPERTIES DEBUG_POSTFIX "D" )
ENDIF( WIN32 )
TARGET_LINK_LIBRARIES(${LIB_NAME} ${Boost_LIBRARIES})
#-----------------------------------------------------------------------------
#
# Copy static lib into correct folder using a post-build event
#
ADD_CUSTOM_COMMAND(
TARGET ${LIB_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different $<TARGET_FILE:${LIB_NAME}> ${TET_CPPSDK_LIBRARY_OUTPUT}
)