0

I've got main project structure in 1 folder, and units tests closed in another folder(2 different meson instances). In unit tests i need to include one file from main project(element to be tested). I dont want to specify relative path as i want to be portable between other programmers.

How can i instruct meson to first go back from current folder and then look through application files if there is file i'm looking for? I want to make it that way so any change in code can be tested right away without any copying or modifications.

C:\Users\User1\Project\application
C:\Users\User1\Project\unittests

I need to be able to see files from application while beeing currently on unittests

akimata
  • 131
  • 1
  • 7

1 Answers1

0

Declare project dependency at top level meson.build like

project_dep = declare_dependency(include_directories: inc_dir, sources: srcs, dependencies:[...])

Make sure that your main is not in the sources. In test level meson.build include project_dep like this:

unit_tests_exec = executable('UnitTests', gtest_srcs, 
dependencies :[gtest_dep, gmock_dep, project_dep])

You can check how I organized project using meson for Tdd session here: https://github.com/elvisoric/tdd_session

Elvis Oric
  • 1,289
  • 8
  • 22