-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
81 lines (70 loc) · 2.66 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
79
80
cmake_minimum_required(VERSION 3.15)
#====================================================
# Enable policy
#====================================================
# enable CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
#====================================================
project(farcolorer CXX)
#====================================================
# 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 FarColorer: ${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
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE STRING "" FORCE)
endif()
message("FarColorer configurations for IDE: ${CMAKE_CONFIGURATION_TYPES}")
#====================================================
# global settings
#====================================================
set(COLORER_BUILD_ARCH x64 CACHE STRING "Build architecture")
if(MSVC)
# set global Visual C++ runtime
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
endif()
endif()
#====================================================
# find dependences
#====================================================
# core library
find_package(ICU COMPONENTS uc data REQUIRED)
find_package(LibXml2 REQUIRED)
if(COLORER_USE_ZIPINPUTSOURCE)
find_package(ZLIB REQUIRED)
find_package(unofficial-minizip REQUIRED)
endif()
#====================================================
# colorer
#====================================================
set(COLORER_BUILD_TOOLS OFF CACHE BOOL "Build colorer tools")
set(COLORER_BUILD_INSTALL OFF CACHE BOOL "Make targets for install")
add_subdirectory(./external/colorer)
#====================================================
# farcolorer
#====================================================
add_subdirectory(./src)
#====================================================
# install
#====================================================
install(TARGETS farcolorer RUNTIME DESTINATION bin)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/misc/ DESTINATION bin)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/src/colorer.map
DESTINATION bin)
install(FILES
${PROJECT_SOURCE_DIR}/LICENSE
${PROJECT_SOURCE_DIR}/README.md
${PROJECT_SOURCE_DIR}/docs/history.ru.txt
DESTINATION .)