summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Jeremie Guichard <djebrest@gmail.com>2017-02-24 13:52:07 +0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-24 01:10:22 -0800
commit1e2580c3fd73d5b1ca06ecc870f38c43dfc4abe8 (patch)
tree393fe706bb12c962915726ee624fdf1718e48789 /tests/CMakeLists.txt
parent5b8bde8e1e97ea597c28e52e88fbc9475e6ea294 (diff)
downloadsubsurface-1e2580c3fd73d5b1ca06ecc870f38c43dfc4abe8.tar.gz
Use SUBSURFACE_TEST_DATA definition to point to test data dir
Update tests with a (compile time) option SUBSURFACE_TEST_DATA, pointing to test data base path. It is needed for cross compilation cases. SUBSURFACE_TEST_DATA is set to SUBSURFACE_SOURCE by default, or configurable via cmake option -DSUBSURFACE_TEST_DATA="...". Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1aab4ab1c..14116449d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,6 +1,13 @@
# QTest based tests
qt5_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc)
+# Access test data (dive folder) from SUBSURFACE_SOURCE by default.
+# In cross compilation cases or when test will not be executed at build time
+# a differnt value can be set via cmake -DSUBSURFACE_TEST_DATA.
+if(NOT SUBSURFACE_TEST_DATA)
+ set(SUBSURFACE_TEST_DATA ${SUBSURFACE_SOURCE})
+endif()
+
add_library(RESOURCE_LIBRARY STATIC ${SUBSURFACE_TEST_RESOURCES})
macro(TEST NAME FILE)
@@ -11,6 +18,7 @@ endmacro()
enable_testing()
add_definitions(-g)
+add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}")
TEST(TestUnitConversion testunitconversion.cpp)
TEST(TestProfile testprofile.cpp)
TEST(TestGpsCoords testgpscoords.cpp)