replaced add_definitions calls within PCLConfig.cmake.in with appending PCL_DEFINITIONS #1478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PCLConfig previously used two strategies for providing compile definitions to the CMake targets dependent on pcl. Mostly, the defines were added to the PCL_DEFINITIONS variable, which then could be used in the dependency's cmake. In two instances, add_definitions was used directly.
The latter strategy causes errors in compilation of projects having some targets that use PCL and some that don't, while, for instance, using CUDA / nvcc. In the nvcc case, the error caused by extra compile flags is "nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified"
Discussion:
It is unclear to me why compile definitions are necessary at all in this case. The file pcl_config.h.in is configured at the time of CMake generation for pcl, and it probably should have all the flags set correctly at that time instead of relying on -DDISABLE_<?> flags and such. Files that rely on these definitions should include the pcl_config.h header. This way, users don't need to use PCL_DEFINTIONS explicitly at all.