The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=15659 ====================================================================== Reported By: Alex Lamaison Assigned To: ====================================================================== Project: CMake Issue ID: 15659 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2015-07-22 17:34 EDT Last Modified: 2015-07-22 17:34 EDT ====================================================================== Summary: Visual Studio 2015: check_function_exists doesn't work for stdio functions Description: check_function_exists worked with previous versions of VS and correctly detected the absence of presence of stdio functions like the printf/scanf families, but with VS2015, those functions are always 'not found'
With Visual Studio 2015, those functions are now defined *inline* in stdio.h. This means that CheckFunctionExists.c, which doesn't included stdio.h, can't find any definition of the function to link with. Previously this would have linked with the symbol in the CRT. Steps to Reproduce: Add check_function_exists(snprintf) to a project. Configure with VS2015 generator. It should say 'Looking for snprintf - found'. Instead it says 'Looking for snprintf - not found'. Additional Information: A workaround is to add legacy_stdio_definitions.lib to CMAKE_REQUIRED_LIBRARIES. However, that is not ideal because it requires knowing that library is available and required in the first place. That defeats the object of feature detection. More info here: https://msdn.microsoft.com/en-us/library/bb531344.aspx ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2015-07-22 17:34 Alex Lamaison New Issue ====================================================================== -- 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