<div dir="ltr"><div><div><div><div><div>Hi!<br><br></div>I'm trying to use a toolchain file (using -DCMAKE_TOOLCHAIN_FILE=....) to cross compile with CMake. I specify my C compiler with:<br><br><a name="bugnotes" id="bugnotes"> set(CMAKE_C_COMPILER my_c_compiler)<br>
<br></a></div>I have given just the name of the compiler, and rely on CMake to find the compiler via my PATH (and this seems to work). But later in the toolchain file I need to refer to files in the same installation tree as "my_c_compiler". Specifically the linker variable <a name="bugnotes" id="bugnotes">CMAKE_EXE_LINKER_FLAGS </a>needs to contain the path to a configuration file that is located in a parallel directory to the compiler:<br>
<br></div> <dir_of_compiler>/../lib/<br><br></div>I was hoping that after CMake have found the path to the compiler, it would be possible to derive the path to the lib-directory from the compiler path. But I don't understand how to do it in the toolchain file.<br>
<br>Is it possible, without hard-coding the path in the toolchain file?<br><br></div>/Johan Holmberg<br><br></div>