Skip to content

Instantly share code, notes, and snippets.

View ruipacheco's full-sized avatar

Rui Pacheco ruipacheco

  • Vienna
View GitHub Profile
@ruipacheco
ruipacheco / effective_modern_cmake.md
Created December 21, 2018 18:51 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

Keybase proof

I hereby claim:

  • I am ruipacheco on github.
  • I am ruipacheco (https://keybase.io/ruipacheco) on keybase.
  • I have a public key whose fingerprint is 5BB1 4293 90E7 A1D0 EA10 26F8 2700 7B24 A049 2FE3

To claim this, I am signing this object:

⟩ ninja
[1/1] Linking CXX executable tests/unit_tests
FAILED: tests/unit_tests
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DASIO_STANDALONE -std=c++11 -pedantic -Wno-padded -Wno-undef -Wno-old-style-cast -gdwarf-2 -g -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names tests/CMakeFiles/unit_tests.dir/unit/main.cpp.o tests/CMakeFiles/unit_tests.dir/unit/utils.cpp.o tests/CMakeFiles/unit_tests.dir/unit/params.cpp.o tests/CMakeFiles/unit_tests.dir/unit/socket.cpp.o tests/CMakeFiles/unit_tests.dir/unit/connection.cpp.o tests/CMakeFiles/unit_tests.dir/unit/postgresql/connection.cpp.o tests/CMakeFiles/unit_tests.dir/unit/postgresql/generators.cpp.o tests/CMakeFiles/unit_tests.dir/unit/postgresql/parsers.cpp.o tests/CMakeFiles/unit_tests.dir/unit/postgresql/state_machines.cpp.o tests/CMakeFiles/unit_tests.dir/unit/mariadb/connection.cpp.o tests/CMakeFiles/unit_tests.dir/unit/mariadb/mariadb-connector-c.cpp.o tests/CMakeFiles/unit_tests.dir/unit/mariadb

Keybase proof

I hereby claim:

  • I am ruipacheco on github.
  • I am ruipacheco (https://keybase.io/ruipacheco) on keybase.
  • I have a public key whose fingerprint is 5BB1 4293 90E7 A1D0 EA10 26F8 2700 7B24 A049 2FE3

To claim this, I am signing this object:

@ruipacheco
ruipacheco / Debug MariaDB on macOS Sierra
Last active May 4, 2017 13:07
Debugging MariaDB 10.1 on macOS Sierra
These are the steps I took to be able to have lldb breakpoint on a function name in macOS Sierra:
```
cmake . -DCMAKE_BUILD_TYPE=Debug -DTOKUDB_OK=0 -DWITH_LIBARCHIVE=OFF;
make
cd mysql-test
./mtr --manual-debug 1st
```
This will log a number of parameters, like the path to the mysqld executable and the parameters to pass to it.
# This is the CMakeCache file.
# For build in directory: /Users/ruihpacheco/Desktop/mariadb2
# It was generated by CMake: /opt/local/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
name mariadb-10.1
set name_mysql ${name}
version 10.1.22
set version_branch [join [lrange [split ${version} .] 0 1] .]
# Please set revision_client and revision_server to 0 if you bump version.
set revision_client 0
//
// third_party_lib.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
//
// daytime_client.cpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false