Skip to content

Commit a6802fa

Browse files
committed
cmake fix
1 parent ea0b100 commit a6802fa

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ set(CMAKE_CXX_STANDARD 20)
44
set(CMAKE_C_STANDARD 17)
55

66
set(PROJECT mv)
7-
option(BUILD_ID "what to build for: apple or pico" "apple")
8-
if (BUILD_ID STREQUAL "apple")
7+
8+
set(BUILDFOR "apple" CACHE STRING "what to build for: apple or pico")
9+
10+
if (BUILDFOR STREQUAL "apple" OR BUILDFOR STREQUAL "linux")
911
# PROJECT_VERSION_MAJOR year
1012
# PROJECT_VERSION_MINOR month
1113
# PROJECT_VERSION_PATCH day
@@ -16,7 +18,7 @@ if (BUILD_ID STREQUAL "apple")
1618
find_package(Threads REQUIRED)
1719
string(PREPEND CMAKE_EXE_LINKER_FLAGS " -Wl ")
1820
set(PROJECT_TARGET_PLATFORM "Unix")
19-
elseif(BUILD_ID STREQUAL "pico")
21+
elseif(BUILDFOR STREQUAL "pico")
2022
set(PICO_BOARD pico) # pico or pico_w or pico2
2123
set(PICO_SDK_PATH "$ENV{HOME}/github/pico-sdk")
2224
set(ENV{PATH} "$ENV{HOME}/github/gcc-arm/bin:$ENV{PATH}")
@@ -33,6 +35,8 @@ elseif(BUILD_ID STREQUAL "pico")
3335

3436
string(PREPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage ")
3537
set(PROJECT_TARGET_PLATFORM "Pi Pico")
38+
else()
39+
message(FATAL_ERROR "No BUILDFOR given")
3640
endif()
3741

3842
string (APPEND CMAKE_CXX_FLAGS_RELEASE " -O3 ")
@@ -85,7 +89,7 @@ if(${BUILD_EXAMPLES})
8589
endif()
8690

8791
# Tests --------------------------------------------------------------
88-
if(${BUILD_GTESTS})
89-
message(STATUS "building unix tests")
90-
add_subdirectory(test)
91-
endif()
92+
# if(${BUILD_GTESTS})
93+
# message(STATUS "building unix tests")
94+
# add_subdirectory(test)
95+
# endif()

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ unix move command.
1212
```bash
1313
$ mkdir build
1414
$ cd build
15-
$ rm -fr * && cmake -DBUILD_ID=pico .. && make
15+
$ cmake -DBUILDFOR=pico .. && make
1616
```
1717

1818
## Cool

0 commit comments

Comments
 (0)