-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPacker.cmake
More file actions
75 lines (65 loc) · 2.11 KB
/
Packer.cmake
File metadata and controls
75 lines (65 loc) · 2.11 KB
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
## PROJECT VAR
## <=====================================>
unset(EXEC)
set( EXEC "SWEngine-packer_${CMAKE_PROJECT_VERSION}" )
set( EXT cpp )
## <=====================================>
## SOURCE FOLDERS
set( SRC_FOLDERS
${CMAKE_CURRENT_SOURCE_DIR}/sources/
${CMAKE_CURRENT_SOURCE_DIR}/sources/file/
${CMAKE_CURRENT_SOURCE_DIR}/sources/pack/
${CMAKE_CURRENT_SOURCE_DIR}/sources/log/
${CMAKE_CURRENT_SOURCE_DIR}/sources/exception/
${CMAKE_CURRENT_SOURCE_DIR}/sources/utils/
)
## INCLUDE FOLDERS
set( INC_FOLDERS
${CMAKE_CURRENT_SOURCE_DIR}/libraries/
${CMAKE_CURRENT_SOURCE_DIR}/includes/
${CMAKE_CURRENT_SOURCE_DIR}/includes/file/
${CMAKE_CURRENT_SOURCE_DIR}/includes/pack/
${CMAKE_CURRENT_SOURCE_DIR}/includes/log/
${CMAKE_CURRENT_SOURCE_DIR}/includes/exception/
)
## GET SOURCES
## <=====================================>
set(TMP "")
foreach(filePath ${SRC_FOLDERS})
string(APPEND TMP "${filePath}*.${EXT};")
endforeach()
file(GLOB SRC ${TMP})
## <=====================================>
## OUTPUT
## <=====================================>
## EXECUTABLE
add_executable(${EXEC} ${SRC})
## <=====================================>
target_compile_definitions(${EXEC} PUBLIC "SWFP_PACKER")
if (${SWFP_COMP})
message(${PREFIX_MESSAGE} "Compression process enabled!")
target_compile_definitions(${EXEC} PUBLIC "SWFP_COMP")
endif ()
## ADD INCLUDES
## <=====================================>
target_include_directories(${EXEC} PUBLIC ${INC_FOLDERS})
## <=====================================>
## ADD PARAMETER
## <=====================================>
if(MSVC)
target_compile_options(${EXEC} PRIVATE "/MP")
endif()
## <=====================================>
## STATIC LIBRARY LINKING
## <=====================================>
if (NOT ${STATIC_LIB_NAME} STREQUAL "")
target_link_libraries(${EXEC}
PUBLIC
${STATIC_LIB_NAME}
)
endif ()
## <=====================================>
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
set_target_properties(${EXEC} PROPERTIES
DEBUG_POSTFIX "d")
endif()