Cmake Guide:

 In the middle parts of the below:
https://cmake.org/runningcmake/
"For larger projects like VTK, using ccmake, cmake -i, or CMakeSetup is recommended."
Option -i means interactive.

 

 CMake Guide:

---

 CMake Tutorial:

https://cmake.org/cmake/help/latest/guide/tutorial/index.html#a-basic-starting-point-step-1 

---

 CMakeLists.txt:

cmake_minimum_required(VERSION 3.6.1)

project(Tutorial)


add_executable(Tutorial main_001.c)

---
cmake3 ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: ..../src/read_006/src/build

---

cmake3 does work well in our project directory.

---

configure_file(TutorialConfig.h.in TutorialConfig.h)
In C++, we could include header_files "main.h" in another header_files "something.h" in base.
And we check the reason why *.h.in exists as configured.

https://ftp.gnu.org/old-gnu/Manuals/autoconf-2.57/html_mono/autoconf.html


---

(20200916: Camke and Edit inside: )
Watching start at 00:00 on the movie:

And Edit inside "CMakeLists.txt", which is empty in the first step "cmake .." in the build folder.
Thank you for their messages:
---
$ grep -R . |grep main\\.c
main.c:#include <stdio.h>
main.c:int main () {
main.c:    printf("hello world!");
main.c:    return 0;
main.c:}
directory.txt:└── main.c
---
$ grep -R . |grep main\\.c
main.c:#include <stdio.h>
main.c:int main () {
main.c:    printf("hello world!");
main.c:    return 0;
main.c:}
directory.txt:└── main.c
---
grep -R . |grep main/.c
 

 

----

And, to the Hello world!

(20200917: Empty cmake3)
$ cmake3 ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nakagawa/src/build

---

(20200917: Empty cmake3)
$ cmake3 --build .
Scanning dependencies of target Tutorial
[ 50%] Building C object CMakeFiles/Tutorial.dir/main.c.o
[100%] Linking C executable Tutorial

---
./build/../CMakeLists.txt

cmake_minimum_required(VERSION 3.6.1)

project(Tutorial)

add_executable(Tutorial main.c)
#configure_file(TutorialConfig.h.in TutorialConfig.h)
#configure_file(array_counter.h.in array_counter.h)

---

(20200917: Empty cmake3)
./Tutorial
hello world!

---

Analyzer: get_char (STRUCT_FILE sf): ensured the type of character.

コメント