User Tools

Site Tools


code:work:generic:cmake:start

This is an old revision of the document!


Layout

Example Structure Build

Sample structure layout

  • project
    • bin
      • utils
      • tests
        • hello_world
    • build
    • include
    • lib
  1. make a folder for your project and here is the top layer CMakeLists.txt file
    project(lvis24)
    cmake_minimum_required(VERSION 3.0)
    
    add_subdirectory( bin )
  2. create a .gitignore to exclude build folder so repos/project/.gitignore should contain this
    # ignore the build directory
    build/*
  3. CMakeLists.txt in bin
    add_subdirectory( tests )
  4. CMakeLists.txt in tests
    add_subdirectory( hello_world )

Now you can compile it all by

  1. going to ~/project/build
  2. cmake ..
  3. build
code/work/generic/cmake/start.1723558142.txt.gz · Last modified: 2024/08/13 14:09 by david