[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] Build flags not applied during compiler testing on Ubuntu
From:       Richard Shaw <hobbes1069 () gmail ! com>
Date:       2018-08-30 12:46:27
Message-ID: CAN3TeO2foEz4XaRmcrMHQyG=eS5YTA07to+7BjefNNXp8TSErw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Mon, Aug 27, 2018 at 12:43 PM Brad King <brad.king@kitware.com> wrote:

> On 08/25/2018 05:48 PM, Richard Shaw wrote:
> > set(CMAKE_EXE_LINKER_FLAGS "-T${CMAKE_SOURCE_DIR}/stm32_flash.ld")
> > 
> > The build dir is the binary directory, not the source directory...
> 
> Toolchain files cannot reference variables like CMAKE_SOURCE_DIR
> that depend on the source and build tree locations.  They are loaded
> inside try_compile projects in addition to the main project, and those
> have their own source and build trees.
> 

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.

And I'm still being bit by differences between Fedora and Ubuntu...

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...

set(PERIPHLIBVER    1.8.0)
set(PERIPHLIBNAME   STM32F4xx_DSP_StdPeriph_Lib_V)
set(PERIPHLIBDIR    ${CMAKE_BINARY_DIR}/${PERIPHLIBNAME}${PERIPHLIBVER})
set(CMSIS           ${PERIPHLIBDIR}/Libraries/CMSIS)
set(STM32F4LIB      ${PERIPHLIBDIR}/Libraries/STM32F4xx_StdPeriph_Driver)
set(STM32F4TEMPLATE ${PERIPHLIBDIR}/Project/STM32F4xx_StdPeriph_Templates)
set(DSPLIB          ${PERIPHLIBDIR}/Libraries/CMSIS/DSP_Lib)

Output on Ubuntu:

 cmake -DCMAKE_TOOLCHAIN_FILE=STM32_Toolchain.cmake
~/svn/freetel/codec2-dev/stm32/-- Configuring done
CMake Error at CMakeLists.txt:134 (add_executable):
  Cannot find source file:


/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


Thanks,
Richard


[Attachment #5 (text/html)]

<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 &lt;<a \
href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>&gt; \
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> &gt; set(CMAKE_EXE_LINKER_FLAGS \
&quot;-T${CMAKE_SOURCE_DIR}/stm32_flash.ld&quot;)<br> &gt; <br>
&gt; 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&#39;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&#39;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&#39;s failing to find the STM32 library. I quite clearly specify its in the \
BINARY directory but on Ubuntu it&#39;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/Librarie \
s/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>




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic