Skip to content

Instantly share code, notes, and snippets.

@larsch
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save larsch/10021395 to your computer and use it in GitHub Desktop.

Select an option

Save larsch/10021395 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 2.8.11)
# Specify the project name. Not required for subprojects, but it
# will create a dingbat.sln for Visual Studio, which will only
# contain the dingbat project and its dependencies.
project(dingbat)
# Create variables with source and header files. Nice to have if we
# need them as arguments to custom macros.
set(sources dingbat.cpp)
set(headers dingbat.h)
# Add the library target. Include the header files so that they show
# up in Visual Studio projects.
add_library(dingbat ${sources} ${headers})
# Set the public include directories that will be added to both this
# project, and projects that depend on dingbat.
target_include_directories(dingbat PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Set the compile definitions that will be added to this project and
# projects that depend on dingbat.
target_compile_definitions(dingbat PUBLIC DINGBAT_DEBUG=1)
# Set the dependencies for dingbat, i.e. libraries that must be
# linked. This will also add public include directory and compile
# definitions from doodad and its dependencies.
target_link_libraries(dingbat doodad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment