<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: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:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Monotype Corsiva";
        panose-1:3 1 1 1 1 2 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        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.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:102694974;
        mso-list-type:hybrid;
        mso-list-template-ids:-370275046 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hello-<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am trying to set up a source tree which will allow CMake to create a MSVC++ .sln file that contains the following two projects:<o:p></o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>A DLL (called “FeatureViewer”) containing a vanilla C++ class that links against several VTK kits (Graphics, Rendering, and Hybrid). <o:p></o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>An EXE (called “TestDriver”) that links against the aforementioned library containing the vanilla C++ class. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have built VTK 5.6 from source, and I want to deliver the DLL, LIB, and class header file from (1) above to a co-worker who has his own application and wants to use the functionality I’m encapsulating, but he doesn’t want to “vtk-ify” his build process. The EXE in (2) above is simply my test driver for (1).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My problem is that the EXE won’t build because the generated project is spuriously looking for vtk libraries (e.g. vtkGraphics.lib et. al.) at link time that it doesn’t directly reference, and it doesn’t know where to find them. The EXE shouldn’t need to know about them because their use is strictly within the FeatureViewer library. If I go into the EXE project properties and manually delete the references to vtkGraphics.lib et. al. from the linker->input->additional-dependencies list, I get a whole bunch of unresolved symbols for the stuff in the vtk libs. I figured out that part of my problem is that the FeatureViewer library was being built static (there was no dll), so I changed the CMakeLists.txt file for the library so that it builds SHARED. Now, I get a DLL, but there’s now no .lib for my EXE to link against. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Can someone tell me what I’m doing wrong? Here’s what I’m doing in the three CMakeLists.txt files (top level, library subdir, executable subdir)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Top Level CMakeLists.txt: <o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>IF(COMMAND CMAKE_POLICY)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> CMAKE_POLICY(SET CMP0003 NEW)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ENDIF(COMMAND CMAKE_POLICY)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>PROJECT(FeatureViewer)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>SUBDIRS (<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> FeatureViewer<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> TestDriver<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>#INCLUDE_DIRECTORIES(${FeatureViewer_SOURCE_DIR}/FeatureViewer)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Library CMakeLists.txt file in FeatureViewer subdir:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'>SET (FeatureViewer_SRCS<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> FeatureViewer.cxx<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>IF(NOT VTK_BINARY_DIR)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>FIND_PACKAGE(VTK REQUIRED)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>IF(NOT VTK_USE_RENDERING)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'> MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_RENDERING.")<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ENDIF(NOT VTK_USE_RENDERING)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>INCLUDE(${VTK_USE_FILE})<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ENDIF(NOT VTK_BINARY_DIR)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>ADD_LIBRARY(FeatureViewer SHARED ${FeatureViewer_SRCS})<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>TARGET_LINK_LIBRARIES(FeatureViewer vtkGraphics vtkRendering vtkHybrid)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Executable CMakeLists.txt file in TestDriver subdir:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'>ADD_EXECUTABLE(TestDriver TestDriver.cxx)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>TARGET_LINK_LIBRARIES(TestDriver FeatureViewer)<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'>INCLUDE_DIRECTORIES(${FeatureViewer_SOURCE_DIR}/FeatureViewer)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>When I try to build, FeatureViewer builds ok (DLL is there, but no LIB in sight), but TestDriver fails with the following:<o:p></o:p></p><p class=MsoNormal><span style='font-size:8.0pt;font-family:"Courier New"'>2>LINK : fatal error LNK1104: cannot open file '..\FeatureViewer\Debug\FeatureViewer.lib'</span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This seems straightforward enough. Can anyone tell me what I’m doing wrong? Please let me know if the cmake mailing list is the more appropriate venue for this question, and I will re-post there. Thanks so much in advance for any assistance you can provide.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:24.0pt;font-family:"Monotype Corsiva"'>Chris</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Times New Roman","serif"'>--<br>Christopher R. Volpe, Ph.D. </span><span lang=FR style='font-size:10.0pt;font-family:"Times New Roman","serif"'>Email: <a href="mailto:cvolpe@ara.com">cvolpe@ara.com</a> <o:p></o:p></span></p><p class=MsoNormal><span lang=FR style='font-size:10.0pt;font-family:"Times New Roman","serif"'>Senior Scientist, Information Exploitation Systems Main Desk: 919-582-3300<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Times New Roman","serif"'><a href="http://www.ara.com/">Applied Research Associates, Inc</a> Direct: 919-582-3380<o:p></o:p></span></p><p class=MsoNormal><span lang=FR style='font-size:10.0pt;font-family:"Times New Roman","serif"'>8537 Six Forks Rd., Suite 6000 Fax : 919-582-3301<o:p></o:p></span></p><p class=MsoNormal><span lang=FR style='font-size:10.0pt;font-family:"Times New Roman","serif"'>Raleigh, NC 27615 Web: </span><span style='font-size:10.0pt;font-family:"Times New Roman","serif"'><a href="http://www.ara.com/offices/NC.htm" title="http://www.ara.com/offices/NC.htm">http://www.ara.com/offices/NC.htm</a></span><span lang=FR style='font-size:10.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <span style='font-size:12.0pt'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>