Skip to main content

2 posts tagged with "cmake"

View All Tags

· One min read
Hreniuc Cristian-Alexandru

I've found this. I haven't tried it, but I want to save it just in case.

Contents:

Boost has experimental CMake support. You have to do a bit of dev to get it working but we've had good experiences so far.

set(BOOST_INCLUDE_LIBRARIES system thread) # enabled libraries
set(BOOST_ENABLE_CMAKE ON) # CMake support
FetchContent_Declare(boost GIT_REPOSITORY https://github.com/boostorg/boost.git ...

The above will get you the compiled libs working. For the header library (Boost::boost aka Boost::headers) there doesn't seem to be CMake support as yet so we wrote a few lines of CMake code to iterate through the FetchContent source directory and added all include folders to a new IMPORTED INTERFACE target.

· 2 min read
Hreniuc Cristian-Alexandru

Tools

# Make sure pip is using python3
pip install conan

# Cmake
sudo apt-get install cmake

# gcc + make
sudo apt-get install build-essential

Install clang for automatic formatting:

#!/bin/bash

# Use this script to install the clang formatter and all its utilities.
# Install Clang(Used for clang-format)
# ============================================================================ #
mkdir -p ~/programs/clang && cd ~/programs/clang &&
# http://releases.llvm.org/download.html
clang_version="9.0.0" &&
archive_name="clang+llvm-${clang_version}-x86_64-linux-gnu-ubuntu-18.04" &&
wget http://releases.llvm.org/${clang_version}/${archive_name}.tar.xz &&
tar xf ${archive_name}.tar.xz &&
rm -Rf ${archive_name}.tar.xz &&
unlink clang_latest # Just in case there was another sym link
ln -sf ${archive_name} clang_latest &&
(
echo "CLANG_INSTALL_PATH=\"/mnt/programs/clang/clang_latest\"" &&
echo "export PATH=\"\${CLANG_INSTALL_PATH}/bin:\$PATH\"" &&
echo -n "export LD_LIBRARY_PATH=\"\${CLANG_INSTALL_PATH}/lib" &&
echo ":\$LD_LIBRARY_PATH\""
) >> ~/.bashrc
# ============================================================================ #

IDE

Use QtCreator.

Activate these plugins:

Go to Help -> About plugins:
- C++
- Check ClangCodeModel
- Check ClangFormat
- Beautifier
- Code Analyzer
- Check ClangTools
- Utilities
- Check Todo

Set these settings:

Go to Tools -> Options:
- Text Editor
- Behavior:
- Tab policy: Spaces Only
- Tab size: 2
- Indend size: 2
- Align continuation lines: With Spaces
- Clean whitespace (upon saving)
- Display:
- Display right margin at column: 80
- Display line numbers
- Display folding markers
- Visualize whitespace
- Highlight search results on the scrollbar
- Highlight current line
- Highlight blocks
- Animate matching parentheses
- Highlight matching parentheses
- Completion:
- Enable Doxygen blocks
- Generate brief description
- Add leading asterisks
- Beautifier
- Enable auto format on file save
- Clang Format
- Use predefined style: `File`
- Debugger
- General:
- Set breakpoints using full absolute path