diff options
author | Brad King <brad.king@kitware.com> | 2014-12-23 13:53:45 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-12-23 13:53:45 (GMT) |
commit | 400af305efb009e5274f1122dc0d596fb6781f69 (patch) | |
tree | f146a6fd54e85d22cd0d986d8d42e0f108f5f13e /Tests | |
parent | 7a2d1cd6d4c1c8759078d2f9e26a930d5e353c88 (diff) | |
parent | 1b28e3b28b86de40ceb6d402b6f41f30eb0c8b59 (diff) | |
download | CMake-400af305efb009e5274f1122dc0d596fb6781f69.zip CMake-400af305efb009e5274f1122dc0d596fb6781f69.tar.gz CMake-400af305efb009e5274f1122dc0d596fb6781f69.tar.bz2 |
Merge topic 'add-FindGSL'
1b28e3b2 FindGSL: Add module to find the GNU Scientific Library
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindGSL/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/FindGSL/rng/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindGSL/rng/main.cc | 24 |
4 files changed, 51 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8528042..8df27f4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1243,6 +1243,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CMake_TEST_FindGSL) + add_subdirectory(FindGSL) + endif() + find_package(GTK2 QUIET) if(GTK2_FOUND) add_subdirectory(FindGTK2) diff --git a/Tests/FindGSL/CMakeLists.txt b/Tests/FindGSL/CMakeLists.txt new file mode 100644 index 0000000..45a3471 --- /dev/null +++ b/Tests/FindGSL/CMakeLists.txt @@ -0,0 +1,9 @@ +add_test(NAME FindGSL.rng COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGSL/rng" + "${CMake_BINARY_DIR}/Tests/FindGSL/rng" + ${build_generator_args} + --build-project FindGSL_rng + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) diff --git a/Tests/FindGSL/rng/CMakeLists.txt b/Tests/FindGSL/rng/CMakeLists.txt new file mode 100644 index 0000000..b15d6ac --- /dev/null +++ b/Tests/FindGSL/rng/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.0) +project(FindGSL_rng CXX) +include(CTest) + +find_package(GSL REQUIRED) + +add_executable(tstgslrng_tgt main.cc) +target_link_libraries(tstgslrng_tgt GSL::gsl) +add_test(NAME tstgslrng_tgt COMMAND tstgslrng_tgt) + +add_executable(tstgslrng_var main.cc) +target_link_libraries(tstgslrng_var ${GSL_LIBRARIES}) +target_include_directories(tstgslrng_var PRIVATE ${GSL_INCLUDE_DIRS}) +add_test(NAME tstgslrng_var COMMAND tstgslrng_var) diff --git a/Tests/FindGSL/rng/main.cc b/Tests/FindGSL/rng/main.cc new file mode 100644 index 0000000..72543be --- /dev/null +++ b/Tests/FindGSL/rng/main.cc @@ -0,0 +1,24 @@ +#include <math.h> +#include "gsl/gsl_rng.h" + +int main() +{ + // return code + int retval = 1; + + // create a generator + gsl_rng *generator; + generator = gsl_rng_alloc(gsl_rng_mt19937); + + // Read a value. + double const Result = gsl_rng_uniform(generator); + + // Check value + double const expectedResult( 0.999741748906672 ); + if( fabs( expectedResult - Result ) < 1.0e-6 ) + retval = 0; + + // free allocated memory + gsl_rng_free(generator); + return retval; +} |