Skip to content

cnruby/w3h1_cmake

 
 

Repository files navigation

Hello, Default Include Paths!

Query the Default Include Directories with CMake



@Gitter :gitter.im/cnruby
Code ID: basic_112
Code Name: Hello, Default Include Paths!

TABLE of CONTENTS

The Structure of Project "basic_112"

Get The Code with Shell Commands

git clone https://github.com/cnruby/w3h1_cmake.git basic_112
cd basic_112
git checkout basic_112
code .

What is The Folder's Structure of Project

#<!-- markdown-exec(cmd:cat docs/tree.txt) -->#
.
├── CMakeLists.txt
└── src
   ├── CMakeLists.txt
   ├── header.hxx
   └── main.cxx
#<!-- /markdown-exec -->

CMake Code

#<!-- markdown-exec(cmd:cat src/CMakeLists.txt) -->#
add_executable(
  main_112
  main.cxx
)
#target_include_directories(
#  main_112
#  PRIVATE
#  ${PROJECT_SOURCE_DIR}/src/
#)
#<!-- /markdown-exec -->

What is The Command's Structure of Project

_image

What is The Process's Structure of Project

_image

Demonstrate Build's Process in CMake

Analyze The Build of Project

Build's Commands on C++ Complier

#<!-- markdown-exec(cmd:cat shell/cl.sh) -->#!/bin/bash
# compile
c++  -c ./src/main.cxx -MD -MF ./bin/main.cxx.o.d \
  -o ./bin/main.cxx.o
# link
c++ ./bin/main.cxx.o  -o ./bin/main_112
#<!-- /markdown-exec -->

Demonstrate Build's Process on C++ Complier

How to Graph the relationship of Build's Process

_image

Final Summary

_image

感谢大家观看!

@Gitter: gitter.im/cnruby

@Github: github.com/cnruby

@Twitter: twitter.com/cnruby

@Blogspot: cnruby.blogspot.com

References

The Project's Commands

Formtting The Codes

ruby format-codes.rb

Build and Run The Project

cmake -GNinja -Bbuild/
cmake --build build/ --clean-first -v
./bin/main_112
rm ./bin/main.* ./bin/main_*
./shell/start.sh
code ./shell/start.sh
code ./shell/cl.sh
exa -T &> docs/tree.txt