Pārlūkot izejas kodu

fix CMake files to work with new Pico Extension

Tobias Müller 1 mēnesi atpakaļ
vecāks
revīzija
dbafdc579b
2 mainītis faili ar 8 papildinājumiem un 16 dzēšanām
  1. 7 10
      CMakeLists.txt
  2. 1 6
      libs/foo/CMakeLists.txt

+ 7 - 10
CMakeLists.txt

@@ -45,23 +45,20 @@ pico_set_program_version(${PROJECT_NAME} "0.1")
 pico_enable_stdio_usb(${PROJECT_NAME} 1)
 pico_enable_stdio_uart(${PROJECT_NAME} 1)
 
-# Create map/bin/hex/uf2 files
-pico_add_extra_outputs(${PROJECT_NAME})
-
 # Add local folder with libs
 add_subdirectory(libs/foo)
 
-# Add the standard include files to the build
-target_include_directories(${PROJECT_NAME} PRIVATE
-  ${CMAKE_SOURCE_DIR}/inc
-  ${CMAKE_CURRENT_LIST_DIR}
-  ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required
-)
-
 # Link to external lib pico_stdlib (gpio, time, etc. functions) and internal lib
 target_link_libraries(${PROJECT_NAME} 
     pico_stdlib
     foo
 )
 
+# Add the standard include files to the build
+target_include_directories(${PROJECT_NAME} PRIVATE
+  ${CMAKE_SOURCE_DIR}/inc
+  ${CMAKE_CURRENT_LIST_DIR}
+  ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required
+)
 
+pico_add_extra_outputs(${PROJECT_NAME})

+ 1 - 6
libs/foo/CMakeLists.txt

@@ -1,16 +1,11 @@
-# Set minimum required version of CMake
-cmake_minimum_required(VERSION 3.12)
 
-# Include build functions from Pico SDK
-include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
+include(${CMAKE_SOURCE_DIR}/pico_sdk_import.cmake)
 
 # Creates a pico-sdk subdirectory in our project for the libraries
 pico_sdk_init()
 
 # Set name of project (as PROJECT_NAME) and C/C   standards
 project(foo C CXX ASM)
-set(CMAKE_C_STANDARD 11)
-set(CMAKE_CXX_STANDARD 17)
 
 # Add library information
 add_library(${PROJECT_NAME}