Skip to content

Instantly share code, notes, and snippets.

@edcote

edcote/cmake.md

Last active Jun 14, 2018
Embed
What would you like to do?
CMake Notes

Why CMake? Why? It is only me or do I find CMake to be convoluted and non intuitive?

  • Debug vs. Release:

Technically, this is all that is needed:

cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_BUILD_TYPE=Debug ..

Optionally, it may be required to manuall set debug flags.

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
  • Install
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/xyz ..
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.