I'm writing a .cmake file that handles a bunch of stuff and needs access to an executable in a fixed relative path to the .cmake file. In this instance, the orgianization looks like this:
CMakeLists.txt
- cmake
- tools.cmake
- bin
- exectuable.exe
The issue is that tools.cmake
is included using include
and thus, CMAKE_CURRENT_SOURCE_DIR
returns the directory of the CMakeLists.txt
. The reason I don't want to hardcode the path is that I want to put the tools.cmake
and binary in a separate GIT repository and I don't want to force the user to place it in some specific folder.
Only solution I can come up with right now is to supply a function that sets and stores the path to tools.cmake
. That's not really elegant.