mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Make sure compiler does not optimize away calls to math functions
This commit is contained in:
parent
28aef8e816
commit
09f595a269
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user