<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>I‘m going to ask two questions, but a good answer to the first will make the second question redundant.</div>
<div> </div>
<div>I work with several different cmake projects that are cross compiled, and they depend on each other.  Each project creates a cmake config, so we can use find_package to find the contents.  Up until now we have been setting LINK_INTERFACE_LIBRARIES to “”
SET_TARGET_PROPERTIES(${projectName} PROPERTIES LINK_INTERFACE_LIBRARIES ""), but for a few years this has required us to set CMP0022 to OLD.  Now that we no longer support older versions of CMake I figured it was time to set this to NEW (2.12 is minimum we
use and most of us are up to 3.2 (I have not tried anything newer than 3.2).  </div>
<div> </div>
<div>This works great for libraries that provide a cmake config file when we link a library to libFoo the config includes the need to link to libFoo. However any project that we use a FindXXX.cmake to find (including cmake included like FindLibXml2.cmake) the
package the config file says you need to link to /home/hank/sysroot/path/to/libFoo.  When I package this build and give it to a different developer to install into his sysroot it fails because the correct path for him is /home/joe/some/other/dir/sysroot/path/to/libFoo.
I found a work around: in target_link_libraries make libFoo a private link.  This feels wrong though, I feel that cmake should handle this automatically.  (I’m fine with mark it as private, anything better is probably not implementable)</div>
<div> </div>
<div>First question, how can I use libraries from a Find*.cmake file without having to mark it as private in every target_link_libraries call.</div>
<div> </div>
<div>I couldn’t figure this out, but I was able to mitigate it for the most common package we link to.  For Qt4 is you have a choice, what we were doing was:</div>
<div>  Find_package(Qt4 REQUIRED)</div>
<div>  INCLUDE(${QT_USE_FILE}</div>
<div>  TARGET_LINK_LIBRARIES(MyProject ${QT_LIBRARIES})</div>
<div>If you use this for you get the full path to each library in your sysroot.  </div>
<div> </div>
<div>However if you do:</div>
<div>  Find_package(Qt4 REQUIRED)</div>
<div>  TARGET_LINK_LIBRARIES(Qt4:QtGui …)</div>
<div>You get just the Qt library, which would be what I want except that now the INCLUDE_DIRECTORIES for Qt libraries are not SYSTEM libraries and so I’m getting a lot of compiler warnings in qt header files which I cannot fix.</div>
<div> </div>
<div>Second question: how can I use the TARGET_LINK_LIBRARIES(Qt4:QtGui…) form and get the qt headers as system libraries?</div>
<div> </div>
<div> </div>
<div> </div>
</span></font>
</body>
</html>