Giter Club home page Giter Club logo

cpp-clion-template's Introduction

cpp_clion_template

Falven

Template project for Clion C++ projects.

This project uses CMake for cross-platform compliance.

Building - Out of Source (Recommended)

I recommend you build this project out-of-source so source files don't get mixed with build files and cause problems. What this means is placing the build files outside of the project's source root directory.

  1. Create a directory outside of this project where binaries will be built.
    • If building with a CMake GUI application:
      1. Right click anywhere outside the project and make a new folder cpp_clion_template_build/.
    • If building through the cmake CLI (command line interface):
      1. mkdir cpp_clion_template_build/
  2. Set appropriate directories; depending on your CMake utility:
    • If building with a CMake GUI application:
      1. Set the 'source' directory to the top-level directory of this project.
      2. Set the 'build' directory to the directory you created in step 1.
    • If building through a CMake CLI (command line interface):
      1. cd to the directory we created in step 1. cpp_clion_template_build/ (important!)
  3. Set appropriate cmake variables
    • If building with a CMake GUI application:
      1. Set appropriate variable values in 'cache values'.
    • If building through a CMake CLI (command line interface):
      1. You can pass options to CMake CLI using the -D <var>:<type>=<value> command.
      2. cmake [options] <path-to-source>
  4. Create build tools for the project.
    • If building with a CMake GUI application:
      1. Select configure and select an appropriate generator, where the generator is the type of build project you would like to create, and completely dependent on your platform.
    • If building through the cmake CLI (command line interface):
      1. cmake -G <generator-name> where generator is the type of project you would like to create, and completely dependent on your platform. Make sure you are in the cpp_clion_template_build/ directory when you do this.
        1. To see available options simply type cmake -G
  5. Build the project using the generated build tools
    • For example, if you generated a Makefile type make.

Example

Generating a Unix Makefile:

  1. mkdir cpp_clion_template_build/ && cd cpp_clion_template_build/
  2. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../cpp_clion_template/

Sample CMake results

  1. make

Running the tests.

This project uses CTest, CMake's built-in testing framework.

To run the tests:

  1. Make sure you have built the project.
  2. Run the tests:
  • If built with a CMake GUI application:
    1. Simply run the project associated with the test (in Visual Studio, XCode...)
  • If built with the CMake CLI: 2. Open a CLI and switch to the binary directory of your build. cd cd cpp_clion_template_build/ 3. run ctest and cmake will run all of the tests associated with the project and output results.

Sample CTest results

cpp-clion-template's People

Contributors

falven avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.