LLNL/Caliper

`C++14` support

kennyweiss opened this issue · 8 comments

One of the codes that I work with is upgrading its stack to c++14 and we'd like to configure caliper for c++14 as part of this work.

The following line overrides our setting:

set(CMAKE_CXX_STANDARD 11)

I suspect making this a CACHE variable would resolve the issue for us.
E.g.

- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 11 CACHE)

or possibly

- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 11 CACHE STRING "")

Ok, I'll look into that. Are you using Caliper as a git submodule?

Thanks @daboehme

No, we're building it separately and linking against it.

Local variables such as this do not propagate up directories so it is only overridden in the scope of the targets that are created in that directory and it's subdirectories. This might patch it but there is something else going on with y'all's cmake because I have a hard C++14 requirement and have never had issues with this setting in caliper propagating up to my library.

I have a hard C++14 requirement and have never had issues with this setting in caliper propagating up to my library.

Thanks @jrmadsen.

To clarify, this flag is not propagating up to my library. Rather, I am trying to configure caliper to use c++14 instead of c++11, and the above line is overriding the CMAKE_CXX_STANDARD flag that we're passing in when we configure caliper.

Oh, OK, I was also wondering how Caliper's CMAKE_CXX_STANDARD setting would propagate up. @kennyweiss , it shouldn't be necessary to build Caliper in c++14 mode to use it in a c++14 project - the c++11 build should work just fine. At least it does for me with C++17.

Thanks @daboehme.

It is not strictly necessary -- our c++14 build is working with a c++11 caliper.
This ticket was meant to request caliper support for a c++14 build (or to discover if there were any issues precluding this).

Ok. For the record, Caliper builds just fine with CMAKE_CXX_STANDARD 14. As long as we don't use any C++14 features in Caliper I'll keep it at 11, as there isn't anything preventing Caliper from being used in C++14 and up programs.

The recent update in #463 should fix this issue. Caliper uses target_compile_features() now and won't set or override CMAKE_CXX_STANDARD.