<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le lun. 26 nov. 2018 à 09:36, Ciccio Pasticcio <<a href="mailto:dodungocorporation@gmail.com">dodungocorporation@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all, <br></div><div><br></div><div>I'm refactoring some libraries cmake files to be compliant to the use of targets instead of tons of variables. Since these libraries are cross-compiled I'm facing some problem finding how to properly set some specific flags like: -march -marm -mfloat-abi etc. For now I set the CMAKE_CXX_FLAGS:</div><div><br></div><div>set(CMAKE_CXX_FLAGS -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -Wno-psabi)<br></div></div><div><br></div><div>Is this the only way to do this? </div></div></div></div></blockquote><div><br></div><div>I'm not sure to understand, you can perfectly setup flags on a target specific way using 'target_compile_option'</div><div><a href="https://cmake.org/cmake/help/latest/command/target_compile_options.html">https://cmake.org/cmake/help/latest/command/target_compile_options.html</a><br></div><div><br></div><div>If all your libraries are in a common directory you can use, COMPILE_OPTIONS property on the directory</div><div><a href="https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_OPTIONS.html#prop_tgt:COMPILE_OPTIONS">https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_OPTIONS.html#prop_tgt:COMPILE_OPTIONS</a><br></div><div>to avoid repetition for each lib.</div><div><br></div><div>All that said, if you are cross-compiling those I bet you are using a toolchain file (<a href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling">https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling</a>)</div><div>so if those "target-specific" compile options are global to your target then you may set</div><div><a href="https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_%3CLANG%3E_FLAGS">https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_%3CLANG%3E_FLAGS</a><br></div><div>in the toolchain.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div></div></div></div></div></div>