summaryrefslogtreecommitdiffstats
path: root/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot
diff options
context:
space:
mode:
Diffstat (limited to 'Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot')
-rw-r--r--Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt30
-rw-r--r--Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.cxx10
-rw-r--r--Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.h5
3 files changed, 45 insertions, 0 deletions
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
new file mode 100644
index 0000000..ffa1e3d
--- /dev/null
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/CMakeLists.txt
@@ -0,0 +1,30 @@
+# create library
+add_library(SquareRoot STATIC SquareRoot.cxx)
+
+add_library(MathFunctions::SquareRoot ALIAS SquareRoot)
+
+# add include directories
+target_include_directories(SquareRoot
+ PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
+ "$<INSTALL_INTERFACE:include>"
+)
+
+# install the target and create export-set
+install(TARGETS SquareRoot
+ EXPORT SquareRootTargets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
+)
+
+# install header file
+install(FILES SquareRoot.h DESTINATION include)
+
+# generate and install export file
+install(EXPORT SquareRootTargets
+ FILE MathFunctionsSquareRootTargets.cmake
+ NAMESPACE MathFunctions::
+ DESTINATION lib/cmake
+)
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.cxx b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.cxx
new file mode 100644
index 0000000..29c0c4a
--- /dev/null
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.cxx
@@ -0,0 +1,10 @@
+#include "SquareRoot.h"
+
+#include <cmath>
+
+namespace MathFunctions {
+double sqrt(double x)
+{
+ return std::sqrt(x);
+}
+}
diff --git a/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.h b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.h
new file mode 100644
index 0000000..b38596d
--- /dev/null
+++ b/Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot/SquareRoot.h
@@ -0,0 +1,5 @@
+#pragma once
+
+namespace MathFunctions {
+double sqrt(double x);
+}