CMake has the macros CHECK_C_COMPILER_FLAG and CHECK_CXX_COMPILER_FLAG, which allow checking for whether a given C or C++ compiler flag is supported by the compiler being used.
However, there's no CHECK_LINKER_FLAG macro, so that you can check whether a given *linker* flag is supported by the linker being used, so there doesn't seem to be a good way to use a flag, such as the --as-needed flag, if it's not *required*, but is "nice to have", but isn't available on all platforms. So what's the best way to do such a check? (I'm assuming here that, for all generators on UN*X platforms, linking is done by using the compiler driver, so that you don't have to worry about, for example, using -Wl,{linker flag} with some generators and just {linker flag} with other generators.) -- 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