-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix relative paths #20
base: master
Are you sure you want to change the base?
Conversation
Hello, Just so I understand you correctly. How I understand this: The original code: #
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# /path/to/project/root/subdir/the_file.c
get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE}) So instead of something like this:
you get this?:
|
It was a long time since I looked at this code so I'm trying to refresh my mind a bit. #
# This macro converts from the full path format gcov outputs:
#
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
#
# to the original source file path the .gcov is for:
#
# /path/to/project/root/subdir/the_file.c
#
macro(get_source_path_from_gcov_filename _SRC_FILENAME _GCOV_FILENAME)
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# #path#to#project#root#subdir#the_file.c.gcov
get_filename_component(_GCOV_FILENAME_WEXT ${_GCOV_FILENAME} NAME)
# #path#to#project#root#subdir#the_file.c.gcov -> /path/to/project/root/subdir/the_file.c
string(REGEX REPLACE "\\.gcov$" "" SRC_FILENAME_TMP ${_GCOV_FILENAME_WEXT})
string(REGEX REPLACE "\#" "/" SRC_FILENAME_TMP ${SRC_FILENAME_TMP})
set(${_SRC_FILENAME} "${SRC_FILENAME_TMP}")
endmacro() Because I'm wondering it this would belong better in this macro maybe? |
cmake/CoverallsGenerateGcov.cmake
Outdated
set(GCOV_SRC_ABS_PATH "${GCOV_SRC_PATH}") | ||
else() | ||
if(${GCOV_SRC_PATH} MATCHES "\\^.*") | ||
string(REGEX REPLACE "\\^" ".." GCOV_SRC_PATH "${GCOV_SRC_PATH}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can ve really rely on it always being ..
here? Isn't this dependent on where you place your build
folder?
For example. I mean the usual is to have it under project_root/build/
so then ../
would be project_root/
... But what if the build
folder is completly outside of the project_root
does this still work then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can ve really rely on it always being .. here?
I'm not sure to be honest. I've got the ^ only as .. and only in front of path, for instance ^/include/cucumber-cpp/internal/drivers/GTestDriver.hpp is in fact ../include/cucumber-cpp/internal/drivers/GTestDriver.hpp
I mean the usual is to have it under project_root/build/
And this is also my case
. But what if the build folder is completly outside of the project_root does this still work then
Haven't checked
Because I'm wondering it this would belong better in this macro maybe?
Yes - later on I've moved it to that macro, just forgot to update this branch also
Forgot to thank you for the patch, just want to understand the issue before I merge so nothing gets broken :) |
Now I've pushed most of my changes. Let me know if you want it all. |
@konserw ok, good that you pushed the latest. It would be nice with your exact debug output so I can see exactly what you are getting when you are building. And maybe the version of |
In case of cucumber-cpp project sometimes ${GCOV_SRC_PATH} is not an absolute path, for example:
^/include/cucumber-cpp/internal/drivers/GTestDriver.hpp
gmock/src/gmock/googletest/include/gtest/gtest.h
This fix is sufficient for cucumber-cpp, but I'm not sure if it covers all possible paths.