diff options
author | Betsy McPhail <betsy.mcphail@kitware.com> | 2020-08-03 21:25:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-11 12:50:52 (GMT) |
commit | 3310801aabbdcd32f82433fbd04237a1ab1744d4 (patch) | |
tree | 976a72a5cabaf12d5f74be29f4b1e5df229dbab5 /Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot | |
parent | 5b3644fba6b3a9eb56070d8ba8f3b9b6281ba62b (diff) | |
download | CMake-3310801aabbdcd32f82433fbd04237a1ab1744d4.zip CMake-3310801aabbdcd32f82433fbd04237a1ab1744d4.tar.gz CMake-3310801aabbdcd32f82433fbd04237a1ab1744d4.tar.bz2 |
Help: Add Importing and Exporting Guide
Diffstat (limited to 'Help/guide/importing-exporting/MathFunctionsComponents/SquareRoot')
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); +} |