-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
28 lines (22 loc) · 891 Bytes
/
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
cmake_minimum_required(VERSION 3.0.0)
project(user_idle_exporter VERSION 0.1)
option(HIDE_CONSOLE "Hides console window" ON)
set(LISTEN_ADDR "0.0.0.0:9183" CACHE STRING "Listen address")
if(NOT WIN32)
message(FATAL_ERROR "Only Windows supported")
endif()
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
if(HIDE_CONSOLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows")
endif()
# strip executable
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s")
include_directories(mongoose)
add_executable(user_idle_exporter main.c mongoose/mongoose.c)
target_link_libraries(user_idle_exporter ws2_32)
target_compile_definitions(user_idle_exporter PRIVATE
-DUSER_IDLE_EXPORTER_VERSION="${CMAKE_PROJECT_VERSION}"
-DUSER_IDLE_EXPORTER_LISTEN_ADDR="${LISTEN_ADDR}"
)