Browse Source

update CMakeLists.txt

Tobias Müller 1 year ago
parent
commit
40348faac3
2 changed files with 7 additions and 2 deletions
  1. 4 2
      CMakeLists.txt
  2. 3 0
      libs/foo/CMakeLists.txt

+ 4 - 2
CMakeLists.txt

@@ -20,11 +20,13 @@ add_executable(${PROJECT_NAME}
 # Create map/bin/hex/uf2 files
 pico_add_extra_outputs(${PROJECT_NAME})
 
+# Add local folder with libs
 add_subdirectory(libs/foo)
-target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/inc)
 
+# Set local include directories
+target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/inc)
 
-# Link to pico_stdlib (gpio, time, etc. functions)
+# Link to external lib pico_stdlib (gpio, time, etc. functions) and internal lib
 target_link_libraries(${PROJECT_NAME} 
     pico_stdlib
     foo

+ 3 - 0
libs/foo/CMakeLists.txt

@@ -12,13 +12,16 @@ project(foo C CXX ASM)
 set(CMAKE_C_STANDARD 11)
 set(CMAKE_CXX_STANDARD 17)
 
+# Add library information
 add_library(${PROJECT_NAME}
     inc/foo.h
     src/foo.cpp
 )
 
+# Set local include directories
 target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
 
+# Link to external lib pico_stdlib (gpio, time, etc. functions)
 target_link_libraries(${PROJECT_NAME} 
     pico_stdlib
 )