diff --git a/grid_map_core/CMakeLists.txt b/grid_map_core/CMakeLists.txt index cbf8ff5da..c34d1e541 100644 --- a/grid_map_core/CMakeLists.txt +++ b/grid_map_core/CMakeLists.txt @@ -5,8 +5,7 @@ project(grid_map_core) find_package(ament_cmake REQUIRED) find_package(grid_map_cmake_helpers REQUIRED) -## Define Eigen addons. -include(cmake/${PROJECT_NAME}-extras.cmake) + ## System dependencies are found with CMake's conventions find_package(Eigen3 REQUIRED) @@ -35,6 +34,9 @@ add_library(${PROJECT_NAME} src/iterators/SlidingWindowIterator.cpp ) +## Define Eigen addons. +include(cmake/${PROJECT_NAME}-extras.cmake) + ## Specify additional locations of header files target_include_directories(${PROJECT_NAME} PUBLIC @@ -127,6 +129,7 @@ endif() ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) ament_export_dependencies(Eigen3) -ament_package(CONFIG_EXTRAS - cmake/${PROJECT_NAME}-extras.cmake -) +ament_package() +#ament_package(CONFIG_EXTRAS +# cmake/${PROJECT_NAME}-extras.cmake +#) diff --git a/grid_map_core/cmake/grid_map_core-extras.cmake b/grid_map_core/cmake/grid_map_core-extras.cmake index dd4089d4e..6f0c0c420 100644 --- a/grid_map_core/cmake/grid_map_core-extras.cmake +++ b/grid_map_core/cmake/grid_map_core-extras.cmake @@ -4,7 +4,7 @@ if(EIGEN_FUNCTORS_PLUGIN) message(FATAL_ERROR "EIGEN_FUNCTORS_PLUGIN already defined") endif() else() - add_definitions(-DEIGEN_FUNCTORS_PLUGIN=\"${EIGEN_FUNCTORS_PLUGIN_PATH}\") + target_compile_definitions(grid_map_core PUBLIC EIGEN_FUNCTORS_PLUGIN=\"${EIGEN_FUNCTORS_PLUGIN_PATH}\") endif() set(EIGEN_DENSEBASE_PLUGIN_PATH "grid_map_core/eigen_plugins/DenseBasePlugin.hpp") @@ -13,5 +13,5 @@ if(EIGEN_DENSEBASE_PLUGIN) message(FATAL_ERROR "EIGEN_DENSEBASE_PLUGIN already defined!") endif() else() - add_definitions(-DEIGEN_DENSEBASE_PLUGIN=\"${EIGEN_DENSEBASE_PLUGIN_PATH}\") + target_compile_definitions(grid_map_core PUBLIC EIGEN_DENSEBASE_PLUGIN=\"${EIGEN_DENSEBASE_PLUGIN_PATH}\") endif() \ No newline at end of file diff --git a/issue382/CMakeLists.txt b/issue382/CMakeLists.txt new file mode 100644 index 000000000..b67df731d --- /dev/null +++ b/issue382/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) +project(issue382) + +find_package(grid_map_core CONFIG REQUIRED) +find_package(Eigen3 CONFIG REQUIRED) + + +add_executable(main1 main1.cpp) +target_link_libraries(main1 PRIVATE grid_map_core::grid_map_core) + + +add_executable(main2 main2.cpp) +target_link_libraries(main2 PRIVATE Eigen3::Eigen) \ No newline at end of file diff --git a/issue382/main1.cpp b/issue382/main1.cpp new file mode 100644 index 000000000..8b62176f4 --- /dev/null +++ b/issue382/main1.cpp @@ -0,0 +1,11 @@ +#include + +int main() { + + Eigen::VectorXd v(10); + v[0] = 0.1; + v[1] = 0.2; + v(0) = 0.3; + v(1) = 0.4; + return 0; +} \ No newline at end of file diff --git a/issue382/main2.cpp b/issue382/main2.cpp new file mode 100644 index 000000000..26561340d --- /dev/null +++ b/issue382/main2.cpp @@ -0,0 +1,12 @@ +#include + + +int main() { + + Eigen::VectorXd v(10); + v[0] = 0.1; + v[1] = 0.2; + v(0) = 0.3; + v(1) = 0.4; + return 0; +} \ No newline at end of file diff --git a/issue382/package.xml b/issue382/package.xml new file mode 100644 index 000000000..22d8afbd5 --- /dev/null +++ b/issue382/package.xml @@ -0,0 +1,24 @@ + + + + issue382 + 2.0.0 + foo. + ryan f + Yoshua Nava + Ryan Friedman + BSD + + ament_cmake + + grid_map_core + eigen + + ament_cmake_gtest + ament_lint_common + ament_lint_auto + + + ament_cmake + +