Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d24a6bcbce7464c0a6bd27318f0dad1eca587051 (plain) (blame)
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
# -*- cmake -*-

cmake_minimum_required(VERSION 2.8)
project(tcfagent C)
include(GNUInstallDirs)

set(CMAKE_COLOR_MAKEFILE OFF)

set(TCF_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(TCF_LIB_NAME tcf-agent)

if(NOT WIN32)
  if(NOT TCF_OPSYS)
    set(TCF_OPSYS "GNU/Linux")
  endif()
  if(NOT TCF_MACHINE)
    set(TCF_MACHINE "x86_64")
  endif()
  if(TCF_MACHINE STREQUAL "armv6l")
    set(TCF_MACHINE "arm")
  endif()
  if(TCF_MACHINE STREQUAL "armv7l")
    set(TCF_MACHINE "arm")
  endif()
  if(TCF_MACHINE STREQUAL "ppc64")
    set(TCF_MACHINE "powerpc")
  endif()
  if(TCF_MACHINE STREQUAL "aarch64")
    set(TCF_MACHINE "a64")
  endif()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
  set(MULTI_THREADED_COMPILE_FLAGS "-pthreads")
  set(MULTI_THREADED_LINK_LIBS pthread rt)
elseif(APPLE)
  set(MULTI_THREADED_COMPILE_FLAGS "-pthread -D_REENTRANT")
  set(MULTI_THREADED_LINK_FLAGS "")
  set(MULTI_THREADED_LINK_LIBS pthread)
elseif(UNIX)
  set(MULTI_THREADED_COMPILE_FLAGS "-pthread -D_REENTRANT")
  set(MULTI_THREADED_LINK_FLAGS "")
  set(MULTI_THREADED_LINK_LIBS pthread rt)
  set(UUID_LIB_NAME uuid)
elseif(WIN32)
  set(SOCKET_LINK_LIBS ws2_32 iphlpapi)
endif()

include(../cmake-tcf-lib.txt)

if(WIN32)
    target_link_libraries(${TCF_LIB_NAME} version.lib psapi.lib)
endif()

message(STATUS "operating system:" ${TCF_OPSYS})
message(STATUS "machine:" ${TCF_MACHINE})

add_executable(agent tcf/main/main.c)
target_link_libraries(agent ${TCF_LIB_NAME})

# executable and library cant have the same target name,
# but we can rename the output
set_target_properties(agent
        PROPERTIES OUTPUT_NAME tcf-agent)

# add target to install all outputs
install(TARGETS agent ${TCF_LIB_NAME}
  RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

Back to the top