🌸 CppDrive
.
├── CMakeLists.txt
├── app
│ └── main.cpp # Application source code.
├── include
│ ├── example.h # Library header file.
├── src
└── example.cpp # Library source code.
Sources go in src/, header files in include/, main programs in app/.
If you add a new executable, say app/hello.cpp, you only need to add the following two lines to CMakeLists.txt:
add_executable(main app/main.cpp) # Name of exec. and location of file.
target_link_libraries(main PRIVATE ${LIBRARY_NAME}) # Link the executable to lib built from src/*.cpp (if it uses it).Build by making a build directory (i.e. build/), run cmake in that dir, and then use make to build the desired target.
Example:
mkdir build && cd build
cmake ..
make
./main
- CMake
- C++ Compiler:
g++,clangormsvc
In ubuntu:
sudo apt-get install build-essential cmake
Install the following extensions: