diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1b043c489d4fddb4bec0416243270d869a6a47c4..bf81e184b0ccf54cc02325e4e77c3812a38786ae 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,3 +3,4 @@ ADD_UNIT_TEST(
   )
 PKG_CONFIG_USE_DEPENDENCY(curves_tests eigen3)
 TARGET_LINK_LIBRARIES(curves_tests ${Boost_LIBRARIES})
+TARGET_COMPILE_DEFINITIONS(curves_tests PRIVATE -DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/data/")
diff --git a/tests/Main.cpp b/tests/Main.cpp
index 3cad07e20cd12a30b1f6a6fea38d20662b49323b..5c513e755dc0a02235ea33a59829b85cfd8dcb13 100644
--- a/tests/Main.cpp
+++ b/tests/Main.cpp
@@ -2304,10 +2304,8 @@ void BezierLinearProblemInitInequalities(bool& error) {
   }
 }
 
-static const std::string path = "../../tests/data/";
-
 void BezierLinearProblemsetupLoadProblem(bool& /*error*/) {
-  problem_definition_t pDef = loadproblem(path + "test.pb");
+  problem_definition_t pDef = loadproblem(TEST_DATA_PATH "test.pb");
   // problem_data_t pData = setup_control_points<point_t, 3, double>(pDef);
   generate_problem<point3_t, double, true>(pDef, VELOCITY);
   // initInequalityMatrix<point_t,3,double>(pDef,pData,prob);