anchao commented on code in PR #6718:
URL: https://github.com/apache/nuttx/pull/6718#discussion_r1098234634


##########
CMakeLists.txt:
##########
@@ -0,0 +1,664 @@
+# 
##############################################################################
+# CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may 
not
+# use this file except in compliance with the License.  You may obtain a copy 
of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# 
##############################################################################
+
+# Request a version available on latest Ubuntu LTS (20.04)
+
+cmake_minimum_required(VERSION 3.16)
+
+# Handle newer CMake versions correctly by setting policies
+
+if(POLICY CMP0115)
+  # do not auto-guess extension in target_sources()
+  cmake_policy(SET CMP0115 NEW)
+endif()
+
+# Basic CMake configuration ##################################################
+
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_EXTENSIONS OFF)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+# Setup build type (Debug Release RelWithDebInfo MinSizeRel Coverage). Default
+# to minimum size release
+
+# Use nuttx optimization configuration options, workaround for cmake build type
+# TODO Integration the build type with CMAKE
+
+# if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING
+# "Build type" FORCE) endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
+# STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel")
+
+# Process board config & directory locations #################################
+
+set(NUTTX_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(NUTTX_APPS_DIR
+    "../apps"

Review Comment:
   Thanks for your suggestion, I added support for absolute paths, which allows 
nuttx compilation to be separated from the nuttx directory:
   
   ```bash
   archer@c:~/code/nuttx/n8$ ls
   apps  incubator-nuttx
   archer@c:~/code/nuttx/n8$ cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja 
incubator-nuttx/
   -- Initializing NuttX
   --   Board:  sim
   --   Config: nsh
   --   Appdir: /home/archer/code/nuttx/n8/incubator-nuttx/../apps
   -- The C compiler identification is GNU 11.1.0
   -- The CXX compiler identification is GNU 11.1.0
   -- The ASM compiler identification is GNU
   -- Found assembler: /usr/bin/cc
   -- Detecting C compiler ABI info
   -- Detecting C compiler ABI info - done
   -- Check for working C compiler: /usr/bin/cc - skipped
   -- Detecting C compile features
   -- Detecting C compile features - done
   -- Detecting CXX compiler ABI info
   -- Detecting CXX compiler ABI info - done
   -- Check for working CXX compiler: /usr/bin/c++ - skipped
   -- Detecting CXX compile features
   -- Detecting CXX compile features - done
   -- Detected system: x86_64
   -- Configuring done
   -- Generating done
   -- Build files have been written to: /home/archer/code/nuttx/n8/build
   archer@c:~/code/nuttx/n8$ cmake --build build
   [979/979] Linking C executable nuttx
   ```
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to