Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMakeLists.txt #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create library
  • Loading branch information
vkotaru committed Sep 22, 2021
commit d7b9f2e356b30f97ea157c75cdd1f773391c9a9b
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.o
*.a
/C++/Build
build/
48 changes: 48 additions & 0 deletions C++/Navio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cmake_minimum_required(VERSION 2.8.3)
project(navio)
add_definitions(-std=c++11)

include_directories(
Common
Navio+
Navio2
)


set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

include(GNUInstallDirs)

set(SOURCE_FILES
Common/I2Cdev.cpp
Common/MPU9250.cpp
Common/MS5611.cpp
Common/Ublox.cpp
Common/Util.cpp
Common/gpio.cpp
Navio2/ADC_Navio2.cpp
Navio2/LSM9DS1.cpp
Navio2/Led_Navio2.cpp
Navio2/PWM.cpp
Navio2/RCInput_Navio2.cpp
Navio2/RCOutput_Navio2.cpp
Navio2/RGBled.cpp
)

add_library(navio SHARED ${SOURCE_FILES})
target_include_directories(navio PUBLIC .)
# set_target_properties(navio PROPERTIES PUBLIC_HEADER ${HEADER_FILES})
install(TARGETS navio
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY "${CMAKE_SOURCE_DIR}/" # source directory
DESTINATION "include" # target directory
FILES_MATCHING # install only matched files
PATTERN "*.h" # select header files
)