-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (40 loc) · 1.13 KB
/
CMakeLists.txt
File metadata and controls
52 lines (40 loc) · 1.13 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
cmake_minimum_required(VERSION 3.10)
project(pvm C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
if (NOT DEFINED PVM_DATA_STACK_SIZE)
set(PVM_DATA_STACK_SIZE 30 CACHE STRING "Size of data stack")
endif ()
if (NOT DEFINED PVM_CALL_STACK_SIZE)
set(PVM_CALL_STACK_SIZE 10 CACHE STRING "Size of call stack")
endif ()
add_library(pvm
pvm.c
)
if (DEFINED PVM_DEBUG)
target_compile_definitions(pvm PRIVATE PVM_DEBUG="${PVM_DEBUG}")
endif ()
target_compile_definitions(pvm PRIVATE
PVM_DATA_STACK_SIZE=${PVM_DATA_STACK_SIZE}
PVM_CALL_STACK_SIZE=${PVM_CALL_STACK_SIZE}
)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_custom_command(TARGET pvm POST_BUILD
COMMENT "Printing valuable size information for pvm sections"
COMMAND echo "PVM sections sizes:"
COMMAND size -Ax "$<TARGET_FILE:pvm>" | grep -P "\\.pvm_|section"
VERBATIM
)
endif ()
target_include_directories(pvm PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
# Install targets (optional)
install(TARGETS pvm
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install(FILES pvm.h
DESTINATION include
)
add_subdirectory(samples)