Commit 2e62cab6 authored by Tim Übelhör's avatar Tim Übelhör
Browse files

using cmake targets

parent 5444a3ad
......@@ -2,12 +2,10 @@ cmake_minimum_required(VERSION 2.8.3)
project(gl3w_ros)
add_compile_options(-std=c++11)
#######################
## Find Dependencies ##
#######################
################################
## install conan dependencies ##
################################
# find conan packages
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.13/conan.cmake"
......@@ -18,6 +16,10 @@ conan_cmake_run(CONANFILE conanfile.txt
BUILD missing)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
#######################
## Find Dependencies ##
#######################
find_package(catkin REQUIRED COMPONENTS
roscpp)
find_package(gl3w REQUIRED)
......@@ -48,24 +50,25 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
add_executable(${PROJECT_NAME}_node)
target_sources(${PROJECT_NAME}_node PRIVATE
src/gl3w_ros_node.cpp)
target_include_directories(${PROJECT_NAME}_node PRIVATE
${catkin_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME}_node PRIVATE
${PROJECT_NAME}
${catkin_LIBRARIES})
include_directories(${catkin_INCLUDE_DIRS})
#############
## Install ##
#############
# Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# # Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.hpp"
# )
# Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
)
......@@ -22,16 +22,18 @@ catkin_package(
## Build ##
###########
include_directories(
add_library(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
src/use_gl3w_ros.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC
include
${catkin_INCLUDE_DIRS})
add_library(${PROJECT_NAME}
src/use_gl3w_ros.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC
${CONAN_LIBS}
${catkin_LIBRARIES})
add_executable(${PROJECT_NAME}_node src/use_gl3w_ros_node.cpp)
add_executable(${PROJECT_NAME}_node)
target_sources(${PROJECT_NAME}_node PRIVATE
src/use_gl3w_ros_node.cpp)
target_link_libraries(${PROJECT_NAME}_node PRIVATE
${PROJECT_NAME})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment