-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
72 lines (57 loc) · 2.23 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
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 NEW)
option(ELIBRARY_COMPACT_STL "Currently no effects" ON)
option(ELIBRARY_LINKAGE_DYNAMIC "ON for dynamical linkage, OFF for statical linkage(Default OFF)" OFF)
option(ELIBRARY_MODULE_IO "eLibrary::IO(Default ON)" ON)
option(ELIBRARY_MODULE_MULTIMEDIA "eLibrary::Multimedia(Default OFF)" OFF)
option(ELIBRARY_MODULE_NETWORK "eLibrary::Network(Default ON)" ON)
option(ELIBRARY_PACKAGE OFF)
option(ELIBRARY_UNIT_TEST OFF)
if(ELIBRARY_COMPACT_STL)
add_compile_definitions(eLibraryCompact_STL=1)
endif()
if(ELIBRARY_MODULE_IO)
add_compile_definitions(eLibraryFeature_IO=1)
endif()
if(ELIBRARY_MODULE_MULTIMEDIA)
list(APPEND VCPKG_MANIFEST_FEATURES "module-multimedia")
add_compile_definitions(eLibraryFeature_Multimedia=1)
endif()
if(ELIBRARY_MODULE_NETWORK)
add_compile_definitions(eLibraryFeature_Network=1)
endif()
project(eLibrary DESCRIPTION "An all-in-one cpp library" VERSION 0.21.2 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
include_directories(eLibrary)
add_compile_options(-Wall)
add_compile_definitions(eLibraryArchitecture_${CMAKE_SYSTEM_PROCESSOR}=1)
add_compile_definitions(eLibraryCompiler_${CMAKE_CXX_COMPILER_ID}=1)
add_compile_definitions(eLibrarySystem_${CMAKE_SYSTEM_NAME}=1)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
add_compile_options(/wd4514 /wd4577 /wd4623 /wd4668 /wd4710 /wd4711 /wd4820 /wd4996 /wd5045 /wd5267)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
file(GLOB_RECURSE FileList "eLibrary/*")
if(ELIBRARY_LINKAGE_DYNAMIC)
add_compile_definitions(eLibraryLinkage_Dynamic=1)
add_library(eLibrary SHARED ${FileList})
else()
add_compile_definitions(eLibraryLinkage_Static=1)
add_library(eLibrary STATIC ${FileList})
endif()
if(ELIBRARY_PACKAGE)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_VENDOR "eSoftware")
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_HOME_DIRECTORY}/LICENSE")
include(CPack)
endif()
if(ELIBRARY_UNIT_TEST)
include(CTest)
enable_testing()
add_subdirectory(eLibraryTest)
endif()