forked from intel/metee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
win32.cmake
49 lines (40 loc) · 1.45 KB
/
win32.cmake
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
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2014-2024 Intel Corporation
if(BUILD_MSVC_RUNTIME_STATIC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set(TEE_SOURCES
src/Windows/metee_win.c
src/Windows/metee_winhelpers.c
)
add_library(${PROJECT_NAME} ${TEE_SOURCES})
target_link_libraries(${PROJECT_NAME} CfgMgr32.lib)
target_compile_definitions(${PROJECT_NAME} PRIVATE
UNICODE _UNICODE
$<$<BOOL:BUILD_SHARED_LIBS>:METEE_DLL>
$<$<BOOL:BUILD_SHARED_LIBS>:METEE_DLL_EXPORT>
)
if(NOT CONSOLE_OUTPUT)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DSYSLOG)
endif()
# Secure compile flags
target_compile_options(${PROJECT_NAME}
PRIVATE /GS /sdl)
# More warnings and warning-as-error
target_compile_options(${PROJECT_NAME}
PRIVATE /W4 /WX
)
set_target_properties(${PROJECT_NAME}
PROPERTIES COMPILE_FLAGS "/Zi"
)
set_target_properties(${PROJECT_NAME}
PROPERTIES PDB_NAME "${PROJECT_NAME}"
PDB_NAME_DEBUG "${PROJECT_NAME}"
COMPILE_PDB_NAME "${PROJECT_NAME}"
COMPILE_PDB_NAME_DEBUG "${PROJECT_NAME}"
)
if(${BUILD_SHARED_LIBS})
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
else()
install(FILES "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${PROJECT_NAME}.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
endif()