diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2018-11-18 02:48:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-12-06 19:16:44 (GMT) |
commit | 170bcb6fdca5942d0484042ad38c09b420554792 (patch) | |
tree | bf5798b7ff6bee823e38af4f79594861a86568bb /Tests/FindOctave | |
parent | 81bea69bd1d52977c3782d26560f34563394f487 (diff) | |
download | CMake-170bcb6fdca5942d0484042ad38c09b420554792.zip CMake-170bcb6fdca5942d0484042ad38c09b420554792.tar.gz CMake-170bcb6fdca5942d0484042ad38c09b420554792.tar.bz2 |
FindOctave: Add module to find GNU octave
Diffstat (limited to 'Tests/FindOctave')
-rw-r--r-- | Tests/FindOctave/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindOctave/Test/CMakeLists.txt | 20 | ||||
-rw-r--r-- | Tests/FindOctave/Test/main.cpp | 18 | ||||
-rw-r--r-- | Tests/FindOctave/Test/testtrue.m | 1 |
4 files changed, 49 insertions, 0 deletions
diff --git a/Tests/FindOctave/CMakeLists.txt b/Tests/FindOctave/CMakeLists.txt new file mode 100644 index 0000000..1acc966 --- /dev/null +++ b/Tests/FindOctave/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindOctave.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOctave/Test" + "${CMake_BINARY_DIR}/Tests/FindOctave/Test" + ${build_generator_args} + --build-project TestFindOctave + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindOctave/Test/CMakeLists.txt b/Tests/FindOctave/Test/CMakeLists.txt new file mode 100644 index 0000000..ce33fcd --- /dev/null +++ b/Tests/FindOctave/Test/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.3) +project(TestFindOctave CXX) +enable_testing() + +find_package(Octave REQUIRED COMPONENTS Development Interpreter) + +add_definitions(-DCMAKE_EXPECTED_Octave_VERSION=${Octave_VERSION}) + +add_executable(test_tgt main.cpp) +target_link_libraries(test_tgt Octave::Octave) +add_test(NAME test_tgt COMMAND test_tgt) + +add_test(NAME test_tgt_exe + COMMAND Octave::Interpreter -q --eval "runtests('.')" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + +add_executable(test_var main.cpp) +target_include_directories(test_var PRIVATE ${Octave_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${Octave_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindOctave/Test/main.cpp b/Tests/FindOctave/Test/main.cpp new file mode 100644 index 0000000..68270b1 --- /dev/null +++ b/Tests/FindOctave/Test/main.cpp @@ -0,0 +1,18 @@ +#include <iostream> +#include <oct.h> + +// http://www.dm.unibo.it/~achilles/calc/octave.html/Standalone-Programs.html +int main(void) +{ + int n = 2; + Matrix a_matrix = Matrix(n, n); + for (octave_idx_type i = 0; i < n; i++) { + for (octave_idx_type j = 0; j < n; j++) { + a_matrix(i, j) = (i + 1) * 10 + (j + 1); + } + } + + std::cout << a_matrix << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Tests/FindOctave/Test/testtrue.m b/Tests/FindOctave/Test/testtrue.m new file mode 100644 index 0000000..0c28a9e --- /dev/null +++ b/Tests/FindOctave/Test/testtrue.m @@ -0,0 +1 @@ +%!assert(true) |