I'll explain a bit why I'm asking. I noticed that for code bases that work on Android plus other UNIX platforms, they unconditionally specify `-stdlib=libc++`, however this doesn't work on Ubuntu by default, which uses gnu stl + gcc/clang. So you get compiler errors. There's no way for me to "search" a platform to see if it is eligible for the libc++ flag, I simply have to either disable it completely or conditionally include it based on target platform and/or toolchain. None of these really address the root cause.
I'm not even really sure what a find module for this would do... but typically find modules don't provide compiler flags, so I'm not sure if that's the right tool for the job. Would love to hear from the developers on this, so I've cross posted to the dev mailing list in this reply. On Mon, Aug 20, 2018 at 10:05 PM Thompson, KT <k...@lanl.gov> wrote: > > I'm also interested in the answer to Robert's question. I've been using > > set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++") > > but it seems like there should be a more elegant approach. > > -tk > > -----Original Message----- > From: CMake <cmake-boun...@cmake.org> On Behalf Of Robert Dailey > Sent: Monday, August 20, 2018 11:48 AM > To: CMake <cm...@cmake.org> > Subject: [CMake] libc++ usage in CMake with Clang? > > Is the only way to use libc++ to muck with compile flags? Or is there a > proper find module for this or something? Is there a more CMake-esque way of > specifying the STL library to use with the toolchain? > -- > > 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: > https://cmake.org/mailman/listinfo/cmake -- 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: https://cmake.org/mailman/listinfo/cmake-developers