democorps.blogg.se

Mac v38-260 cleaner
Mac v38-260 cleaner








If your parent sets CMAKE_CXX_STANDARD to 14 or the compilers default is c++14, abseil will still be compiled with c++14. And if the parent just uses the compiler default, then so will abseil.īut this is a problem in a library like abseil which changes depending on language level.Ĭxx_std_11 only sets the minimum required level to 11. If your parent manually adds -std=c++11 to the global CXX flags (it shouldn't but.) your targets will adopt them. If the parent project / toolchain file sets CMAKE_CXX_STANDARD, then your targets will automatically adopt it. My broader point stands though: you should not set an explicit cmake standard for individual targets./libraries I read this as "the correct way is for abseil to use set(CMAKE_CXX_STANDARD". We need to know what language level our dependents are using, and so we must use the tool given to us in CMake to detect C++ language Sorry, my mistake.

Mac v38 260 cleaner code#

The relvant code is here In fact our test scripts do what you suggested, using -DCMAKE_CXX_STANDARD in the command line.īut this is a problem in a library like abseil which changes depending on language level. We don't set CMAKE_CXX_STANDARD, we only read it. Or both are using a different version and everything is blowing up in your face. How do you propose to do this besides the standard mechanism in CMake?Įither the library and the application happen to use the same c++ version and doing a set CMAKE_CXX_STANDARD in the library cmake file is redundant, The only thing a library cmake file should do is a target_compile_features(mylib PUBLIC cxx_std_11) to state the minimum language version it needs. for testing and ci) in the command line command that invokes cmake( cmake -DCMAKE_CXX_STANDARD=17. ) ) or even better in the toolchain file that is used to build all the applications and libraries or (e.g.

mac v38-260 cleaner

Set CMAKE_CXX_STANDARD belongs either in the top level cmake file of the Application (if the libraries are added via add_subdirectory(.

  • or both are using a different version and everything is blowing up in your face.
  • Either the library and the application happen to use the same c++ version and doing a set CMAKE_CXX_STANDARD in the library cmake file is redundant,.
  • Especially if your API changes depending on the language level, then the used standard is something that you should simply adopt from the project abseil is used from. If I may make a comment on this: In my experience this is the absolutely wrong approach for a library. The correct way to set the language level for abseil is to set CMAKE_CXX_STANDARD to 11, 14, or 17.








    Mac v38-260 cleaner