<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Aug 27, 2018 at 12:43 PM Brad King <<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/25/2018 05:48 PM, Richard Shaw wrote:<br>
> set(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_SOURCE_DIR}/stm32_flash.ld")<br>
> <br>
> The build dir is the binary directory, not the source directory...<br>
<br>
Toolchain files cannot reference variables like CMAKE_SOURCE_DIR<br>
that depend on the source and build tree locations.  They are loaded<br>
inside try_compile projects in addition to the main project, and those<br>
have their own source and build trees.<br></blockquote><div><br></div><div>Ok, fixed but it's really a PITA to have to type -DCMAKE_TOOLCHAIN_FILE=.. so often when 100% of the people on this project are cross-compiling.</div><div><br></div><div>And I'm still being bit by differences between Fedora and Ubuntu...</div><div><br></div><div>Compiling is working fine again on Fedora but on Ubuntu it's failing to find the STM32 library. I quite clearly specify its in the BINARY directory but on Ubuntu it's still looking for it in the SOURCE directory...</div><div><br></div><div><div>set(PERIPHLIBVER    1.8.0)</div><div>set(PERIPHLIBNAME   STM32F4xx_DSP_StdPeriph_Lib_V)</div><div>set(PERIPHLIBDIR    ${CMAKE_BINARY_DIR}/${PERIPHLIBNAME}${PERIPHLIBVER})</div><div>set(CMSIS           ${PERIPHLIBDIR}/Libraries/CMSIS)</div><div>set(STM32F4LIB      ${PERIPHLIBDIR}/Libraries/STM32F4xx_StdPeriph_Driver)</div><div>set(STM32F4TEMPLATE ${PERIPHLIBDIR}/Project/STM32F4xx_StdPeriph_Templates)</div><div>set(DSPLIB          ${PERIPHLIBDIR}/Libraries/CMSIS/DSP_Lib)</div></div><div><br></div><div>Output on Ubuntu:</div><div><br></div><div><div> cmake -DCMAKE_TOOLCHAIN_FILE=STM32_Toolchain.cmake ~/svn/freetel/codec2-dev/stm32/-- Configuring done</div><div>CMake Error at CMakeLists.txt:134 (add_executable):</div><div>  Cannot find source file:</div><div><br></div><div>    /home/richard/svn/freetel/codec2-dev/stm32/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/CMSIS/DSP_Lib/Examples/arm_fft_bin_example/GCC/arm_fft_bin_data.c</div></div><div><br></div><div>Thanks,</div><div>Richard</div></div></div></div></div>