On 06/20/2016 07:23 AM, Sergei Nikulov wrote: > Documentation will tell that "the compiler does not give an error > message when it encounters the flag". > Unfortunately, it not only compiles but try to link executable. > > If linker fails, due missed libraries it also does not produce > positive result even if compilation was successful. > > Is it expected behaviour or issue?
It is expected. If a compiler cannot do "cc -flag hello.c" then the flag must have some special behavior that needs a smarter check. CMake 3.6 introduces CMAKE_TRY_COMPILE_TARGET_TYPE: https://cmake.org/cmake/help/v3.6/variable/CMAKE_TRY_COMPILE_TARGET_TYPE.html which might be of help here. -Brad -- 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