-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (68 loc) · 2.76 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 3.15)
project(UnInstall)
#====================================================
# Enable policy
#====================================================
# enable CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
#====================================================
# Set default build to release
#====================================================
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type, one of: Release, Debug" FORCE)
endif ()
message("Build type for ${PROJECT_NAME}: ${CMAKE_BUILD_TYPE}")
#====================================================
# Set configuration types
#====================================================
if(NOT MSVC_IDE)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
else()
#target_compile_options cannot set parameters for all configurations in MSVC
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE STRING "" FORCE)
endif()
message("Configurations for IDE: ${CMAKE_CONFIGURATION_TYPES}")
# check platform for build
set(IS_x64_PLATFORM FALSE CACHE BOOL "" FORCE)
if ("$ENV{PLATFORM}" MATCHES "x64")
set(IS_x64_PLATFORM TRUE CACHE BOOL "" FORCE)
endif ()
include(cmake/utils.cmake)
plugin_extract_version(${CMAKE_CURRENT_LIST_DIR}/src/version.hpp)
if (IS_x64_PLATFORM)
set(PACKAGE_FILE_NAME "${PROJECT_NAME}.${PLUGIN_VERSION}.x64")
else ()
set(PACKAGE_FILE_NAME "${PROJECT_NAME}.${PLUGIN_VERSION}.x86")
endif ()
#====================================================
# build plugin
#====================================================
add_subdirectory(src)
#====================================================
# build resource files
#====================================================
# used @@ESCAPE and ESCAPE@@ for escape @ in files
configure_file(src/File_ID.diz src/File_ID.diz)
configure_file(src/UnInstall_Eng.hlf src/UnInstall_Eng.hlf)
configure_file(src/UnInstall_Rus.hlf src/UnInstall_Rus.hlf)
#====================================================
# install
#====================================================
install(TARGETS UnInstall RUNTIME DESTINATION .)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/src/${PROJECT_NAME}.map
${CMAKE_CURRENT_BINARY_DIR}/src/UnInstall_Eng.hlf
${CMAKE_CURRENT_BINARY_DIR}/src/UnInstall_Rus.hlf
src/UnInstall_Eng.lng
src/UnInstall_Rus.lng
${PROJECT_SOURCE_DIR}/WhatsNew.Rus.txt
${PROJECT_SOURCE_DIR}/ReadMe.Rus.txt
${CMAKE_CURRENT_BINARY_DIR}/src/File_ID.diz
DESTINATION .)
#====================================================
# cpack
#====================================================
set(CPACK_GENERATOR "ZIP" CACHE STRING "Generators to support. semi-colon delimited list")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}")
include(CPack)