-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
45 lines (34 loc) · 1.29 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
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include("common-config")
include("auto-toolchain")
# Configure project
project(
Hello8Bit-${PROJECT_TARGET_NAME}
DESCRIPTION "Hello World template for 8-bit platforms using CMake, targetting LLVM-MOS"
LANGUAGES ASM C CXX
VERSION 1.0
)
# Try to determine which toolchain was used to specify additional options
if(LLVM_MOS)
# Using the LLVM-MOS-SDK toolchain. We need to set some options for it
message(STATUS "Using LLVM-MOS toolchain")
include_directories(${LLVM_INCLUDE_DIRS})
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
add_definitions(${LLVM_DEFINITIONS_LIST})
endif()
# Build the main project executable
add_executable(${CMAKE_PROJECT_NAME} "src/main.c")
# Add the project source code
add_subdirectory("src/")
# You can add custom commands to build resources and other things
# add_custom_command(
# OUTPUT resource.bin
# COMMAND make-resource -o resource.bin res-source1 res-source2
# VERBATIM
# )
# Add some preprocessor defines
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC "$<$<CONFIG:DEBUG>:DEBUG>")
target_compile_definitions(${CMAKE_PROJECT_NAME}
PUBLIC PROJECT_TARGET_NAME="${PROJECT_TARGET_NAME}"
)