Skip to content

Instantly share code, notes, and snippets.

@jameskbride
Last active May 23, 2018 19:29
Show Gist options
  • Save jameskbride/5736969 to your computer and use it in GitHub Desktop.
Save jameskbride/5736969 to your computer and use it in GitHub Desktop.
Basic CMakeLists.txt for a "Hello, World!" C++ project. It shows the use of a library which contains the class file for the application.
cmake_minimum_required (VERSION 2.8)
project (CMakeHelloWorld)
#version number
set (CMakeHelloWorld_VERSION_MAJOR 1)
set (CMakeHelloWorld_VERSION_MINOR 0)
#include the subdirectory containing our libs
add_subdirectory (Hello)
#indicate the entry point for the executable
add_executable (CMakeHelloWorld Hello HelloWorld.cpp)
# Indicate which libraries to include during the link process.
target_link_libraries (CMakeHelloWorld Hello)
install (TARGETS CMakeHelloWorld DESTINATION bin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment