<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>When using the install target command as follows<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp; INSTALL (</span></b><span
style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
TARGETS</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
${HDF5_LIB_TARGET}</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
EXPORT</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
${HDF5_EXPORTED_TARGETS}</span></b><span style='font-size:8.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LIBRARY DESTINATION lib COMPONENT libraries</span></b><span style='font-size:
8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ARCHIVE DESTINATION lib COMPONENT libraries</span></b><span style='font-size:
8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
RUNTIME DESTINATION bin COMPONENT libraries</span></b><span style='font-size:
8.0pt;font-family:"Courier New"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-autospace:none'><b><span
style='font-size:8.0pt;font-family:"Courier New"'>&nbsp; )<o:p></o:p></span></b></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal>cmake very nicely generates an HDF5-config.cmake file in the
build directory, and at install time, in the install directory. This is great.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>However, I have project A(paraview) with two subdirectories
B (hdf5) and C (mystuff), where C &#8220;uses&#8221; B. All is well except that
if C includes the hdf5-config.cmake from the Build directory as generated by B <span
style='font-size:8.0pt'>(ADD_LIBRARY(vtkhdf5 SHARED IMPORTED)) </span>, cmake
produces error messages along the lines of <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;
font-family:"Times New Roman","serif";color:red'>CMake Error at
D:/cmakebuild/pv-shared/Utilities/hdf5-1.8/HDF5-config.cmake:16 (ADD_LIBRARY):</span><span
style='font-size:9.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;
font-family:"Times New Roman","serif";color:red'>add_library cannot create
imported target &quot;vtkhdf5&quot; because another target</span><span
style='font-size:9.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:9.0pt;
font-family:"Times New Roman","serif";color:red'>with the same name already
exists.</span><span style='font-size:8.0pt'><o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Naturally, when building C standalone using the install
directory of standalone B, all works fine.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Everything would be simple, if cmake would simply skip the
imported target from B the second time it is loaded when called from the
subproject C, then a single set of config and cmakelists would work all the
time, but as it is, extra logic needs to be added.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Is there any easy way of telling project C, load the config file
if B is not part of the same build so that I can reuse the same syntax between
separate build or common builds. I&#8217;d like to use the generated
hdf5-config.cmake files because they have all the necessary properties set correctly
(like when target name is not the same as lib name etc etc, which makes things
harder like below). <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:8.0pt'>#
Import target &quot;vtkhdf5&quot; for configuration &quot;Debug&quot;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>SET_PROPERTY(TARGET
vtkhdf5 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>SET_TARGET_PROPERTIES(vtkhdf5
PROPERTIES<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>&nbsp;
IMPORTED_IMPLIB_DEBUG
&quot;D:/cmakebuild/pv-shared/bin/Debug/vtkhdf5ddll.lib&quot;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>&nbsp;
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG &quot;ws2_32;wsock32;C:/Program
Files/MPICH2/lib/mpi.lib;vtkzlib&quot;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>&nbsp;
IMPORTED_LOCATION_DEBUG
&quot;D:/cmakebuild/pv-shared/bin/Debug/vtkhdf5ddll.dll&quot;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:8.0pt'>&nbsp;
)</span><o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thanks<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>JB<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:Consolas'>--
<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:Consolas'>John
Biddiscombe,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
email:biddisco @ cscs.ch<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:Consolas'><a
href="http://www.cscs.ch/"><span style='color:blue'>http://www.cscs.ch/</span></a><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:Consolas'>CSCS,
Swiss National Supercomputing Centre&nbsp; | Tel:&nbsp; +41 (91) 610.82.07<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:Consolas'>Via
Cantonale, 6928 Manno, Switzerland&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Fax:&nbsp;
+41 (91) 610.82.82<o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>