Use target_compile_features instead of set(CMAKE_CXX_STANDARD 14)#56
Use target_compile_features instead of set(CMAKE_CXX_STANDARD 14)#56chhtz wants to merge 1 commit into
Conversation
The latter spills into the maps.pc file, which potentially breaks building dependencies which require a higher standard Also increase cmake_minimum_required to silence a warning
|
The cflags in the .pc file should reflect the requirements of the headers. i see that you are declaring the feature PUBLIC, so i assume the headers require c++14 and that should then be added to the .pc.in file. The users of .pc files must be smart enough to select the highest required standard; just plopping the concatenation of the cflags onto the compilers commandline just does not work. |
|
I don't think passing this via pkg-config is in any way practicable. The requirements partially come from pcl for which the pkg-config also does not explicitly add the flags anymore (probably because the default for most compilers is at least c++14, anyways): |
|
That is pcls choice, and the packages using them pay the price of needing to keep their -std= flags updated to pcls needs. I'd guess the cmake config(if any) automatically sets the target_feature. I'd like to point to icu, fcl, sdformat and ignition-math4 that all specify some -std= flag on ubuntu 20.04. Gentoo has similar for icu, libobs/obs-frontend-api, xmlb, manifold, libqpdf. Finally, both Rock.cmake macros and orogen do have infrastructure to deal with -std= flags in .pc files. |
|
Some (older) verions of PCL check explicitly for this flag in their cmake targets forcing you to have it set. |
The latter spills into the maps.pc file, which potentially breaks building dependencies which require a higher standard Also increase cmake_minimum_required to silence a warning