


To expand my suggestion, you can use CMake to grab an initial default path from the user configuring and building the project. How can I access this variable that is set, from the other cpp files of the project ? Or can the Path be set manually in the ExecutableScript.sh.in file ? Is there a way to do it from QT Creator alone than running it from the terminal ?(by modifying. The main.cpp runs all tests in the sample.cpp files, as below : #include "gtest/gtest.h"Īccording to answer given by, How should i structure my main.cpp ,to be able to use/access the variable "IMAGES_PATH" in the files sample1.cpp and sample2.cpp ? Sample 1,2 are c++ files with different testcases. So that now the IMG_PATH variable gets updated everywhere in the remaining parts of the project. So when someone clones my project they will just have to update the IMG_PATH variable with the path to where their image files are located.

Looking for a way for setting a variable eg.IMG_PATH = "/path/to/image/files" which can be set once and only the variable is used all over the executable files. What I am trying to accomplish: "To be able to avoid using an absolute path for the images I use and allow people trying to implement my code to only change the path at one place with their own test image locations."

I have been doing a google test on my project (cmake and qt) for which I need to test the match of two images.
