summaryrefslogtreecommitdiffstats
path: root/Help/guide/tutorial/Step6/MathFunctions
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-04-07 18:54:54 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-04-07 18:54:54 (GMT)
commitd54f0aa9b71dfcc04f077e5b19c6122cb4b98d83 (patch)
tree987fbabfbdda89ed4aaea7fa9c99ee99f4e27084 /Help/guide/tutorial/Step6/MathFunctions
parent2f949be4b3a4e9da43a1c445300084a2d63837e2 (diff)
parentb8b804e2ed8dca3c6d116a6e8a1cb66cbd6ad241 (diff)
downloadCMake-d54f0aa9b71dfcc04f077e5b19c6122cb4b98d83.zip
CMake-d54f0aa9b71dfcc04f077e5b19c6122cb4b98d83.tar.gz
CMake-d54f0aa9b71dfcc04f077e5b19c6122cb4b98d83.tar.bz2
Merge branch 'master' into ninja-order-depends
Diffstat (limited to 'Help/guide/tutorial/Step6/MathFunctions')
-rw-r--r--Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt
index 4bf6024..f64c6ac 100644
--- a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt
+++ b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt
@@ -8,10 +8,20 @@ target_include_directories(MathFunctions
# does this system provide the log and exp functions?
include(CheckSymbolExists)
-set(CMAKE_REQUIRED_LIBRARIES "m")
check_symbol_exists(log "math.h" HAVE_LOG)
check_symbol_exists(exp "math.h" HAVE_EXP)
+if(NOT (HAVE_LOG AND HAVE_EXP))
+ unset(HAVE_LOG CACHE)
+ unset(HAVE_EXP CACHE)
+ set(CMAKE_REQUIRED_LIBRARIES "m")
+ check_symbol_exists(log "math.h" HAVE_LOG)
+ check_symbol_exists(exp "math.h" HAVE_EXP)
+ if(HAVE_LOG AND HAVE_EXP)
+ target_link_libraries(MathFunctions PRIVATE m)
+ endif()
+endif()
+# add compile definitions
if(HAVE_LOG AND HAVE_EXP)
target_compile_definitions(MathFunctions
PRIVATE "HAVE_LOG" "HAVE_EXP")