diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:10 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:10 +0900 |
commit | f58f7a233a9b66287e1a0fad0d149e3202a098b4 (patch) | |
tree | cc0cea82fae3f153df9299b27650e17c58da1125 /Help/guide | |
parent | 46f8b5215bbbfcf4bc0caed1daf52b678fd2b976 (diff) | |
download | cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.gz cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.bz2 cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.zip |
Imported Upstream version 3.18.0upstream/3.18.0
Diffstat (limited to 'Help/guide')
-rw-r--r-- | Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx | 25 | ||||
-rw-r--r-- | Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Help/guide/tutorial/index.rst | 10 | ||||
-rw-r--r-- | Help/guide/user-interaction/index.rst | 5 |
4 files changed, 23 insertions, 29 deletions
diff --git a/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx deleted file mode 100644 index ee585568c..000000000 --- a/Help/guide/tutorial/Step5/MathFunctions/MakeTable.cxx +++ /dev/null @@ -1,25 +0,0 @@ -// A simple program that builds a sqrt table -#include <cmath> -#include <fstream> -#include <iostream> - -int main(int argc, char* argv[]) -{ - // make sure we have enough arguments - if (argc < 2) { - return 1; - } - - std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); - if (fileOpen) { - fout << "double sqrtTable[] = {" << std::endl; - for (int i = 0; i < 10; ++i) { - fout << sqrt(static_cast<double>(i)) << "," << std::endl; - } - // close the table with a zero - fout << "0};" << std::endl; - fout.close(); - } - return fileOpen ? 0 : 1; // return 0 if wrote the file -} diff --git a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt index 4bf6024c2..f64c6ac54 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 a844cbf84..6e26de977 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -380,13 +380,17 @@ tutorial assume that they are not common. If the platform has ``log`` and ``exp`` then we will use them to compute the square root in the ``mysqrt`` function. We first test for the availability of these functions using the :module:`CheckSymbolExists` module in the top-level -``CMakeLists.txt``. We're going to use the new defines in -``TutorialConfig.h.in``, so be sure to set them before that file is configured. +``CMakeLists.txt``. On some platforms, we will need to link to the m library. +If ``log`` and ``exp`` are not initially found, require the m library and try +again. + +We're going to use the new defines in ``TutorialConfig.h.in``, so be sure to +set them before that file is configured. .. 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``: diff --git a/Help/guide/user-interaction/index.rst b/Help/guide/user-interaction/index.rst index 3a1038fa7..c724b6fc0 100644 --- a/Help/guide/user-interaction/index.rst +++ b/Help/guide/user-interaction/index.rst @@ -86,6 +86,7 @@ populated. It is always advised to use different directories for the source and the build. .. image:: /guide/user-interaction/GUI-Source-Binary.png + :alt: Choosing source and binary directories Generating a Buildsystem ======================== @@ -246,16 +247,19 @@ The "Configure" button triggers a new dialog to select the CMake generator to use. .. image:: /guide/user-interaction/GUI-Configure-Dialog.png + :alt: Configuring a generator All generators available on the command line are also available in :manual:`cmake-gui(1)`. .. image:: /guide/user-interaction/GUI-Choose-Generator.png + :alt: Choosing a generator When choosing a Visual Studio generator, further options are available to set an architecture to generate for. .. image:: /manual/VS-Choose-Arch.png + :alt: Choosing an architecture for Visual Studio generators .. _`Setting Build Variables`: @@ -356,6 +360,7 @@ button. This triggers a new dialog to set the value of the variable. .. image:: /guide/user-interaction/GUI-Add-Entry.png + :alt: Editing a cache entry The main view of the :manual:`cmake-gui(1)` user interface can be used to edit existing variables. |