<div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 12, 2018 at 6:42 PM David Jobet <<a href="mailto:djobet@tower-research.com">djobet@tower-research.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
we embed in our source a copy of an ICC build of LLVM, that we import :<br>
<br>
add_library(global_llvm_external STATIC IMPORTED)<br>
set_property(TARGET global_llvm_external APPEND PROPERTY<br>
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/icc/include)<br>
set_property(TARGET global_llvm_external APPEND PROPERTY<br>
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/icc/lib/libLLVMCore.a)<br>
set_property(TARGET global_llvm_external APPEND PROPERTY<br>
INTERFACE_LINK_LIBRARIES<br>
${CMAKE_CURRENT_SOURCE_DIR}/icc/lib/libLLVMLTO.a ...)<br>
<br>
add_library(global_llvm INTERFACE)<br>
target_link_libraries(global_llvm INTERFACE global_llvm_external)<br>
add_library(global::llvm ALIAS global_llvm)<br>
<br>
It works fine, until someone decided to install a more recent version<br>
of LLVM in its development env. (which is not ABI compatible)<br>
<br>
Somehow, system includes path are looked into first<br>
g++ ... -I/apps/homefs1/USER/work/. -I. -isystem<br>
/spare/local/USER/conda_root/envs/gcc6cxx14/include -isystem<br>
/apps/homefs1/USER/work/.../libllvm/icc/include ...<br>
<br>
so, as with include_directories where it's possible to control the<br>
ordering with BEFORE or AFTER, is there a way to tell cmake that when<br>
linking against global::llvm we want the include directories needed by<br>
global::llvm to be prepended (instead of appended) ?<br><br></blockquote><div><br></div><div>While not directly answering your question, what version of CMake are you using? There was a change related to this area in the following merge request that went in for the 3.12 release:</div></div><div><br></div><a href="https://gitlab.kitware.com/cmake/cmake/merge_requests/1968">https://gitlab.kitware.com/cmake/cmake/merge_requests/1968</a><br clear="all"><div><br></div><div>The part that got my attention is the following claim in the description:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">An effect of the -isystem flag is to search the directory after those specified via -I flags.</blockquote></div><div><br></div><div>Which seems at odds with your observations/comments, unless I'm misunderstanding what you're saying.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>New book released: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div></div></div></div>