Brad King wrote: > On 09/28/2015 03:20 PM, Brad King wrote: >> for now we should look at turning off all language standard and >> compile feature support for SolarisStudio when not hosted on Linux. > > Done here: > > Features: Disable support for Oracle SolarisStudio on non-Linux > https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61bc0f73 > > Tests: Suppress WriteCompilerDetectionHeader failure on SunPro > https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fdf7594 > > I also made a fix for Linux: > > Features: Fix C++98 flags on Oracle SolarisStudio 12.4 on Linux > https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c824b23d > > Steve, please review these changes.
Thanks, I've put some thought into this now. The existing CMake feature deals with compilation, but does not deal with linking. We pass -std=foo when compiling but not when linking. In the case of GNU and Clang, this works because the standard library binary is the same regardless of that flag. I did some experiements, and * passing no -std flag * passing -std=c++11 * passing -std=gnu++11 each resulted in invoking collect2 or ld with identical parameters for GNU and Clang in respective situations. For Solaris, the situation is different. My understanding of standard libraries there is summarized here: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c69ec6f Namely, we can pass -std=c++03 or -std=c++11 in the the compile step to use specific dialect features for compilation, but to specify the appropriate/corresponding standard library (the GNU one) we also need to specify one of those flags at link time. Currently cmake has no feature for specifying flags to use at link time for a particular standard library. This missing feature is also apparent when noting that we can specify a particular standard library to Clang by using the -stdlib=libc++ or -stdlib=libstdc++ flags. Using GNU we can specify the flag -nodefaultlibs to avoid automatic linking with libstdc++ and then specify additional flags to compile and link to libc++ if we wish. This is the same missing feature whether talking about SolarisStudio, GNU, or Clang. I think the current state is that CMake-compile-features can work with SolarisStudio to specify compile flags, but CMake currently has no feature for inferring link flags as a result of that. That is, the responsibility for specifying the link flags remains with the user for now. So, is this thread really about a bug, or is it a feature request? Perhaps those commits should be reverted. I see no reason for SolarisStudio on linux to behave any differently than on solaris, so the commit relating to that is probably not appropriate. When testing the compiler on linux, it is possible that I was operating as if the link flags were user responsibility and had configured my environment accordingly (though I don't remember). I wrote here some ideas of a design for specifying the standard library to use: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/13284/focus=13296 Perhaps, rather than passing CMAKE_CXX11_EXTENSION_COMPILE_OPTION to the linker, we should work more on a design like the above way to specify a standard library. The compile features can imply a default and a set of allowed alternatives (for example, compiling with cxx_static_assert implies the use of stdlibc++ or libc++ with Clang by default but there is a way to use the other instead). The COMPATIBLE_INTERFACE features may also be used to ensure that targets which link together all use the same standard library. Thanks, Steve. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers