Skip to content

Instantly share code, notes, and snippets.

@quocle108
Created April 29, 2020 10:03
Show Gist options
  • Save quocle108/053495bd3300fe4cd36416788471805c to your computer and use it in GitHub Desktop.
Save quocle108/053495bd3300fe4cd36416788471805c to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.15)
project(hardware)
# Define GNU standard installation directories
include( GNUInstallDirs )
# Bring the headers
include_directories(include/hardware)
# Can manually add the sources using the set command as follows:
set(SOURCES src/camera.cpp src/screen.cpp src/hardware.cpp)
# However, the file(GLOB...) allows for wildcard additions:
file(GLOB SOURCES "src/*.cpp")
file(GLOB HEADERS "include/hardware/*.hpp")
# Generate the static library from the sources
add_library(hardware STATIC ${SOURCES} ${HEADERS})
target_include_directories( hardware PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
# install header file to system
#install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/hardware DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})
# install binaries file to system
#install(TARGETS hardware
# LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
#ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment