Comments (9)
ExternalProject_Add did indeed help, thank you very much! I also found the CMake option to disable the Uninstall target generation -DAMENT_CMAKE_UNINSTALL_TARGET=OFF
from ament_cmake.
When calling find_package(xxx)
multiple time in CMake the CMake config file is normally not being re-invoked. Can you please post an example how you are using it / where you are calling it multiple times.
from ament_cmake.
I am writing a code generator that generates a CMake project with several subprojects that get included with add_subdirectory
. Each subproject defines ROS messages and builds them with ament.
So the structure looks somewhat like this:
| - CMakeLists.txt
| - subproject1/CMakeLists.txt
| - subproject1/package.xml
| - subproject1/msg/Messages1.msg
| - subproject2/CMakeLists.txt
| - subproject2/package.xml
| - subproject2/msg/Messages2.msg
Inside the subproject, I call find_package(ament_cmake)
. Because there can be other subprojects that don't use ament, I thought that having the subproject find the package it depends on is the clean way.
The problem here, I think, is that the variable used to track whether ament was already included has a scope that only includes the subproject, but targets have global scope (or so is my understanding). See this answer on StackOverflow. What that would mean is that variables need to be set again, but target should not be redefined.
from ament_cmake.
In general we don't recommend to run multiple ROS 2 packages in a single CMake context which seems to be what you are doing here. There are many other problems related to that. E.g. a package B having a dependency on package A expects that A has finished building already and is available to be used. In a single CMake context that is not ensured since your targets in package B (should) have no knowledge or explicit CMake dependencies on targets in package A.
That being saif please feel free to wrap the creation of the uninstall
target in a condition check that the target doesn't exist already (
from ament_cmake.
... or I could try to do it the intended way. What is the intended way a multi-package project should be built?
from ament_cmake.
I will try to work around this with add_custom_target to implement the workflow mentioned in
#56 (comment)
and have it called by my toplevel cmake.
from ament_cmake.
What is the intended way a multi-package project should be built?
The recommended way is to use a build tool like ament_tools
which builds each package separately in the right order. As an alternative you can also do that manually buy invoking cmake
/ make
/ make install
on each package in the right order (and potentially set any environment variables in between to find the dependencies when not installing to a standard location like /usr
).
from ament_cmake.
I will try to work around this with add_custom_target to implement the workflow mentioned in #56 (comment) and have it called by my toplevel cmake.
I don't think that this will work in a single CMake invocation due to target collisions in a single CMake context and missing target dependency across package boundaries. The build tool is already implementing this process for you - just not in a single CMake context but by invoking CMake separately for each package.
from ament_cmake.
The closest analog to ament_tools
which doesn't use it would be ExternalProject_Add
, with proper dependencies between projects and any steps in between needed for them to find one another after being built. Note you can call ExternalProject_Add
on local paths, so you don't have to download with that command. I think this project does something like this:
https://github.com/Sarcasm/cmake-superbuild
But I've never tried it or know if it would work for our sources.
from ament_cmake.
Related Issues (20)
- Question about `ament_export_include_directories(include)` and `${PACKAGE_INCLUDE_DIRS}`. HOT 3
- Exporting dependencies of header-only (interface) libraries to downstream packages HOT 3
- ament_pack_build_configuration is very slow for many dependencies HOT 4
- PRIVATE option to ament_target_dependencies does not work HOT 1
- Add support for gmock in ament_cmake_auto
- Enable compulsory sign-off for ament organization or ament_cmake repo? HOT 3
- Backport `ament_auto_add_gmock` to humble HOT 3
- Fix compiler warnings related to gtest/gmock (backport #408 to humble) HOT 2
- ament cmake core fails on unexpected keyword argument 'encoding' HOT 1
- Installing Python3.12 causes import error: No module named 'distutils' HOT 3
- ament_export_dependencies can't export all PkgConfig projects found in CMake HOT 2
- Support propagation of version compatibility to consuming libraries HOT 2
- BUG: ament_cmake_core doesn't work in CMake 3.5 anymore but doesn't declare a minimum cmake version to use it HOT 7
- ament_cmake_python: Update ament_python_install_package() to allow installing more files into an existing package. HOT 9
- Corrupt ament_cmake_symlink_install.cmake may be generated HOT 1
- Ament Cmake doesnt extend LD_LIBRARY_PATH for libTorch (Ros2 Humble) HOT 1
- Issue with ament_cmake_gen_version_h install path in ros2 build farm HOT 2
- Please release to Rolling and Jazzy! HOT 4
- Should I use ament_export_dependencies for PRIVATE dependency? HOT 1
- perf: deep packages are swarmed with duplicated libraries in `ament_target_dependencies()` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ament_cmake.