suppose I have this:
#root/CMakeLists.txt
include(folder/file.cmake)
foo()
and
#root/folder/file.cmake
function(foo)
message(${SOME_SPECIAL_CMAKE_VARIABLE})
endfunction()
And I want to get path/to/root/folder
printed.
I tried these 2 but they don't get me what I want: CMAKE_CURRENT_LIST_DIR
or CMAKE_CURRENT_SOURCE_DIR
.
So is there a cmake variable that will get me what I want?
Or is there a way to get the full path to file.cmake
so I can atleast get it's path that way?
I ended up caching the CMAKE_CURRENT_LIST_DIR
variable when the file is included outside of the function and later I use the cached value inside the function - based on the comments of my question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With