Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit a25cb5d

Browse files
Cleaned project setup module a bit
1 parent fb85d62 commit a25cb5d

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

‎cmake/Platform/Project/BoardSetup.cmake‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function(setup_project_board)
1+
function(setup_project_board _project_name)
22

33
cmake_parse_arguments(parsed_args "" "BOARD_NAME;BOARD_CPU" "" ${ARGV})
44

@@ -8,7 +8,7 @@ function(setup_project_board)
88

99
get_board_id(board_id ${parsed_args_BOARD_NAME} ${parsed_args_BOARD_CPU})
1010

11-
set(PROJECT_${ARDUINO_CMAKE_PROJECT_NAME}_BOARD ${board_id} CACHE STRING "Project-Global board ID")
11+
set(PROJECT_${_project_name}_BOARD ${board_id} CACHE STRING "Project-Global board ID")
1212

1313
endif ()
1414

‎cmake/Platform/Project/CoreLibSetup.cmake‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
function(setup_project_core_lib)
1+
function(setup_project_core_lib _project_name)
22

33
# Guard against redefiniton of the Core Lib target
4-
if (NOT TARGET ${${PROJECT_${ARDUINO_CMAKE_PROJECT_NAME}_BOARD}_CORELIB_TARGET})
4+
if (NOT TARGET ${${PROJECT_${_project_name}_BOARD}_CORELIB_TARGET})
55

6-
add_arduino_core_lib(${PROJECT_${ARDUINO_CMAKE_PROJECT_NAME}_BOARD} target_name)
6+
add_arduino_core_lib(${PROJECT_${_project_name}_BOARD} target_name)
77

88
# Define a global way to access Core Lib's target name
9-
set(${PROJECT_${ARDUINO_CMAKE_PROJECT_NAME}_BOARD}_CORELIB_TARGET ${target_name}
9+
set(${PROJECT_${_project_name}_BOARD}_CORELIB_TARGET ${target_name}
1010
CACHE STRING "Project-Global CoreLib target name")
1111

1212
endif ()
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
function(arduino_cmake_project _project_name)
22

3-
# Define internal variable to store the project's name, twice:
4-
# 1. Define in parent scope as if it were defined by the CMakeLists.txt file that called this function
5-
# 2. Define as a standard local variable so that functions called below also can use this variable
6-
# It helps ensure each "sub-project" can actually exists separately from the others,
3+
# Store the project's name in parent scope as if it were defined by the CMakeLists.txt file
4+
# that called this function. It helps ensure each "sub-project" can actually exists separately from the others,
75
# as is the case with the examples of the framework.
8-
# All of this is done because CMake's `project()` function doesn't maintain scope properly,
6+
# This is done because CMake's `project()` function doesn't maintain scope properly,
97
# thus a custom one is needed.
108
set(ARDUINO_CMAKE_PROJECT_NAME ${_project_name} PARENT_SCOPE)
11-
set(ARDUINO_CMAKE_PROJECT_NAME ${_project_name})
129

13-
setup_project_board(${ARGN})
10+
setup_project_board(${ARGN}${_project_name})
1411

15-
setup_project_core_lib()
12+
setup_project_core_lib(${_project_name})
1613

1714
endfunction()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /