Caliper icon indicating copy to clipboard operation
Caliper copied to clipboard

`C++14` support

Open kennyweiss opened this issue 3 years ago • 7 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: https://github.com/LLNL/Caliper/blob/9384bfb8d494588db2c3c5f77331a2ca133b8947/src/CMakeLists.txt#L4

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 "")

kennyweiss avatar Jan 11 '21 22:01 kennyweiss

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

daboehme avatar Jan 11 '21 22:01 daboehme

Thanks @daboehme

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

kennyweiss avatar Jan 11 '21 22:01 kennyweiss

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.

jrmadsen avatar Jan 11 '21 22:01 jrmadsen

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.

kennyweiss avatar Jan 11 '21 23:01 kennyweiss

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.

daboehme avatar Jan 11 '21 23:01 daboehme

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).

kennyweiss avatar Jan 11 '21 23:01 kennyweiss

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.

daboehme avatar Jan 11 '21 23:01 daboehme