diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-04-23 16:47:22 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-04-23 16:47:22 (GMT) |
commit | d837f8b6fb30c34e167c35f7e85ac3b7b19adccf (patch) | |
tree | 019af81ce98a755600df6a5b83efcfd312797961 /Help/guide | |
parent | b45976fe104902ed7f0495e0e4c822684a4455e7 (diff) | |
parent | 61ac8e6dfa06d82ff2ef3ae3f0076fb9aa65d542 (diff) | |
download | CMake-d837f8b6fb30c34e167c35f7e85ac3b7b19adccf.zip CMake-d837f8b6fb30c34e167c35f7e85ac3b7b19adccf.tar.gz CMake-d837f8b6fb30c34e167c35f7e85ac3b7b19adccf.tar.bz2 |
Merge branch 'master' into ninja-order-only-fix
Diffstat (limited to 'Help/guide')
-rw-r--r-- | Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Help/guide/tutorial/index.rst | 2 |
2 files changed, 12 insertions, 2 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") diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index a844cbf..4fbcd4c 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -386,7 +386,7 @@ these functions using the :module:`CheckSymbolExists` module in the top-level .. literalinclude:: Step6/MathFunctions/CMakeLists.txt :language: cmake :start-after: # does this system provide the log and exp functions? - :end-before: if(HAVE_LOG AND HAVE_EXP) + :end-before: # add compile definitions Now let's add these defines to ``TutorialConfig.h.in`` so that we can use them from ``mysqrt.cxx``: |