diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindStandardMathLibrary.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmake/FindStandardMathLibrary.cmake b/cmake/FindStandardMathLibrary.cmake index fc4728a82..b174cbb4f 100644 --- a/cmake/FindStandardMathLibrary.cmake +++ b/cmake/FindStandardMathLibrary.cmake @@ -10,6 +10,7 @@ # pass the "-lm" linker flag. # # Copyright (c) 2010 Benoit Jacob <jacob.benoit.1@gmail.com> +# 2020 Susi Lehtola <susi.lehtola@gmail.com> # Redistribution and use is allowed according to the terms of the 2-clause BSD license. @@ -19,9 +20,15 @@ include(CheckCXXSourceCompiles) # notice the std:: is required on some platforms such as QNX # notice the (void) is required if -Wall (-Wunused-value) is added to CMAKE_CXX_FLAG +# We read in the arguments from standard input to avoid the compiler optimizing away the calls set(find_standard_math_library_test_program -"#include<cmath> -int main() { (void)std::sin(0.0); (void)std::log(0.0f); }") +" +#include<cmath> +int main(int argc, char **argv) { + (void)std::sin(argc)); + (void)std::log(argc)); + return 0; +}") # first try compiling/linking the test program without any linker flags |