-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
32 lines (27 loc) · 1014 Bytes
/
CMakeLists.txt
File metadata and controls
32 lines (27 loc) · 1014 Bytes
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
cmake_minimum_required(VERSION 3.16)
project(pc-control C)
set(CMAKE_C_STANDARD 11)
# Find Paho MQTT C library
set(PAHO_INSTALL_DIR "${CMAKE_SOURCE_DIR}/../paho.mqtt.c/install" CACHE PATH "Paho MQTT C install directory")
list(APPEND CMAKE_PREFIX_PATH "${PAHO_INSTALL_DIR}")
find_package(eclipse-paho-mqtt-c REQUIRED)
# Common link libraries for static build
set(COMMON_LIBS
eclipse-paho-mqtt-c::paho-mqtt3c-static
powrprof
user32
ws2_32
crypt32
rpcrt4
)
# Console version (for debugging/interactive use)
add_executable(pc-control src/main.c)
target_link_libraries(pc-control ${COMMON_LIBS})
# Hidden version (GUI subsystem, no console window at all)
# Uses mainCRTStartup entry point to keep regular main() function
add_executable(pc-control-hidden src/main.c)
target_compile_definitions(pc-control-hidden PRIVATE HIDDEN_BUILD)
target_link_libraries(pc-control-hidden ${COMMON_LIBS})
if(MINGW)
target_link_options(pc-control-hidden PRIVATE -mwindows -Wl,-e,mainCRTStartup)
endif()