[CMake] FindIce module and C++11

rleigh at codelibre.net rleigh at codelibre.net
Thu Aug 10 05:28:31 EDT 2017


On 2017-08-10 09:50, Jones J.W. wrote:
> I'm building my code on Linux using the g++ flags "-std=c++11". This
> means that I must link with the libIce++11 libraries instead of
> libIce.
> 
> The FindIce module, however as no provision for choosing these
> libraries thus resulting in unresolved symbols at link time.
> 
> I tried getting around the problem by simply listing Ice++11 as a
> COMPONENT which works in Linux but the same CMakeLists.txt file in
> Windows won't work as there is no Ice++11. Currently I have resolved
> this by having two calls to the FindIce module inside an IF( MSVC )
> conditional.
> 
> Would it be possible to add a flag to tell the FindIce module whether
> C++11 is being used or not?

FindIce certainly needs an update for Ice 3.7.

Regarding C++11, their approach here is certainly a bit unorthodox as 
well as being inconsistent between platforms, and FindIce will need to 
deal with that unfortunate situation.  Since the old and new APIs are 
incompatible, and you have to explicitly opt-in to using the new one, I 
don't think that using "-std=c++11" on its own is sufficient reason to 
select the C++11 library?  Can you use the old API with a C++11 
compiler?  It might be best to have a set of C++11 component names, and 
map these to the appropriate library names on Linux (separate libs) and 
Windows (not separate), if that would make the intent of the user clear 
and unambiguous.

I will try to look at this, but I'm a little busy with other things at 
the moment, and so it's not at top of my list.  If you wanted to propose 
a change an/or open a merge request that would certainly be welcome.


Kind regards,
Roger Leigh



More information about the CMake mailing list