From 3620371c5c95784f52bb9b711a3c78b31c640163 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Sat, 24 Oct 2020 15:22:21 +0200 Subject: [PATCH] Bug #2036 make sure find_standard_math_library_test_program actually compiles (and is guaranteed to call math functions) (cherry picked from commit ecb7bc9514b12051d050299234b2a74ac76b5a8e) --- cmake/FindStandardMathLibrary.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/FindStandardMathLibrary.cmake b/cmake/FindStandardMathLibrary.cmake index 711b0e4b4..337f1b304 100644 --- a/cmake/FindStandardMathLibrary.cmake +++ b/cmake/FindStandardMathLibrary.cmake @@ -19,8 +19,11 @@ include(CheckCXXSourceCompiles) # notice the std:: is required on some platforms such as QNX set(find_standard_math_library_test_program -"#include -int main() { std::sin(0.0); std::log(0.0f); }") +" +#include +int main(int argc, char **){ + return int(std::sin(double(argc)) + std::log(double(argc))); +}") # first try compiling/linking the test program without any linker flags