Skip to content
Snippets Groups Projects
Verified Commit a6ed1749 authored by Moritz Lammerich's avatar Moritz Lammerich
Browse files

improve CMake to allow for standard build/install workflows

parent 72c0d41f
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.14)
project(tfEEROS)
set(CMAKE_CXX_STANDARD 14)
## search eeros globally
# find_package(eeros)
include(GNUInstallDirs)
## include eeros library by path
message("EEROS path manually setted: $ENV{TFEEROS_EEROS_PATH}")
include_directories("$ENV{TFEEROS_EEROS_PATH}/include")
link_directories("$ENV{TFEEROS_EEROS_PATH}/lib")
include_directories("include")
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(src)
find_package(EEROS REQUIRED)
add_library(tf_eeros
src/TrafoMatrix.cpp
src/TF_Tree.cpp
src/MatrixExtension.cpp
src/Quaternion.cpp)
add_subdirectory(test)
target_link_libraries(tf_eeros PUBLIC EEROS::eeros)
target_include_directories(tf_eeros PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)
install(TARGETS tf_eeros EXPORT ${PROJECT_NAME})
install(EXPORT ${PROJECT_NAME} NAMESPACE ${PROJECT_NAME}:: DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
install(FILES ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
\ No newline at end of file
include(CMakeFindDependencyMacro)
include(${CMAKE_CURRENT_LIST_DIR}/tfEEROS.cmake)
get_target_property(interface_libs tfEEROS::tf_eeros "INTERFACE_LINK_LIBRARIES")
foreach(dependency IN LISTS interface_libs)
message("found tfEEROS dep: ${dependency}")
string(FIND ${dependency} :: package_name_end)
string(SUBSTRING ${dependency} 0 ${package_name_end} dep_package)
message("package name: ${dep_package}")
find_dependency(${dep_package})
endforeach()
\ No newline at end of file
add_library(tfEEROS
TrafoMatrix.cpp
TF_Tree.cpp
MatrixExtension.cpp
Quaternion.cpp )
install(TARGETS tfEEROS LIBRARY )
INSTALL (
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION include
FILES_MATCHING PATTERN "*.h*")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment