-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (35 loc) · 1.26 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
cmake_minimum_required(VERSION 3.5.0)
set(CMAKE_CXX_STANDARD 17)
set(HWINFO_STATIC true)
set(HWINFO_OS OFF)
set(HWINFO_MAINBOARD OFF)
set(HWINFO_CPU ON)
set(HWINFO_DISK OFF)
set(HWINFO_RAM ON)
set(HWINFO_GPU ON)
set(HWINFO_GPU_OPENCL OFF)
set(HWINFO_GPU_BATTERY ON)
option(FEATURE_INFOPLACEHOLDERS "Add placeholders for system information" ON)
configure_file(./build_flags.in.hpp ./generated/headers/build_flags.hpp)
project(linyhi LANGUAGES CXX VERSION 0.1.3)
add_executable(${PROJECT_NAME} ./src/main.cpp)
target_link_options(${PROJECT_NAME} PRIVATE -static)
add_subdirectory(./src/thirdparty/base64)
add_subdirectory(./src/thirdparty/hwinfo)
target_link_libraries(${PROJECT_NAME} PRIVATE
base64 lfreist-hwinfo::hwinfo
)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}/generated/headers)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(${PROJECT_NAME} PRIVATE -Os -flto -s -Wl,-s -Wl,--gc-sections)
endif()
# TESTS
include(CTest)
enable_testing()
file(GLOB TEST_FILES ./test/*.cpp)
foreach(test ${TEST_FILES})
get_filename_component(test_suffix ${test} NAME_WLE)
add_executable(test_${test_suffix} ${test})
target_include_directories(test_${test_suffix} PRIVATE ./src)
add_test(test_${test_suffix} test_${test_suffix})
endforeach()