<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi!<br>
<br>
Am 30.07.2010 22:23, schrieb Clark Taylor:
<blockquote
cite="mid:AANLkTimW1AU_O0A7PnRdXQdT+p6GCq9GPBHsRvhKArD1@mail.gmail.com"
type="cite">
<div>I have created a very simple CMake file (I am a newbie) that
works wonderfully in Linux, but am having problems in Windows. The
CMakeLists.txt is below</div>
<div> </div>
<div>#I think 2.6 is required for some of things I do below, but I am
not sure<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)</div>
<div> </div>
<div># This is the CMake file for my application. This <br>
# will be my first CMake file of decent size, so please excuse <br>
# any particularly bad syntax :)<br>
PROJECT(MyApp)</div>
<div>FIND_PACKAGE(wxWidgets REQUIRED)<br>
FIND_PACKAGE(OpenCV REQUIRED)<br>
FIND_PACKAGE(EXPAT REQUIRED)</div>
<div>INCLUDE (${wxWidgets_USE_FILE} ${OpenCV_USE_FILE}
${EXPAT_INCLUDE_DIRS})</div>
</blockquote>
This looks wrong. INCLUDE() includes another file into your cmake
script, it does not set the include directories for the compiler. This
is what include_directories() is for. I guess it may be right for
wxWidgets_USE_FILE and OpenCV_USE_FILE, if their cmake-modules create
files that shall be included directly into your CMake script. But
EXPAT_INCLUDE_DIRS is a variable that contains the path to the header
files, so you should use the following to let the compiler know about
it:<br>
include_directories(${EXPAT_INCLUDE_DIRS})<br>
<br>
<blockquote
cite="mid:AANLkTimW1AU_O0A7PnRdXQdT+p6GCq9GPBHsRvhKArD1@mail.gmail.com"
type="cite">
<div> </div>
<div>SET(Headers myApp.h myAppGUI.h myAppGUImpl.h
Coordinates/Coordinates.h)<br>
SET(Src myApp.cpp myAppGUI.cpp myAppGUImpl.cpp
Coordinates/Coordinates.cpp)</div>
<div><br>
ADD_EXECUTABLE(myApp ${Headers} ${Src})</div>
</blockquote>
You should not need to add ${Headers} here (usually only the sources
should be compiled).<br>
<br>
<blockquote
cite="mid:AANLkTimW1AU_O0A7PnRdXQdT+p6GCq9GPBHsRvhKArD1@mail.gmail.com"
type="cite">
<div>TARGET_LINK_LIBRARIES(myApp ${wxWidgets_LIBRARIES}
${OpenCV_LIBS} ${EXPAT_LIBRARIES})<br>
<br clear="all">
#End of code</div>
<div> </div>
<div>Everything works great in Linux, but when I try to use this in
Windows, I have series of problems, all inter-related. </div>
<div> </div>
<div>Problem #1. While wxWidgets and OpenCV work seamlessly, Cmake
can't find the expat libraries. (They are installed. I installed the
expat libraries using the basic windows download and install package).
</div>
<div> </div>
<div>Problem #2. While I can overcome problem #1 by hardcoding in
where the expat include directory and library files are (setting the
values in the CMake GUI), when I then open up the resulting solution in
Visual Studio 2008 Express and compile my code, the compiler gives the
error "can't find expat.h"</div>
<div> </div>
<div>Problem #3. I can fix that problem as well by directly
modifying the solution properties, but then when I run the project, it
dies because it can't find libexpat.dll.</div>
<div> </div>
<div>So, in summary, I think cmake is completely ignoring libexpat,
even when I explicitly tell it (in the gui) where the include and
library files are.</div>
<div> </div>
<div>Any ideas?</div>
</blockquote>
If this doesn't help, try to determine whether the variables are set
correctly, e.g. by using message(${EXPAT_INCLUDE_DIRS}) to print it's
content when cmake is run. But you should already get an error message
if the required libraries could not be found...<br>
<br>
<blockquote
cite="mid:AANLkTimW1AU_O0A7PnRdXQdT+p6GCq9GPBHsRvhKArD1@mail.gmail.com"
type="cite">
<div> </div>
<div>Sorry if this is an extremely stupid question, but I did not
find any related information on Google, so..... Hopefully this will
help make me a more intelligent user of CMake :)</div>
</blockquote>
Hope it helps :)<br>
<br>
Stefan<br>
<br>
<blockquote
cite="mid:AANLkTimW1AU_O0A7PnRdXQdT+p6GCq9GPBHsRvhKArD1@mail.gmail.com"
type="cite">
<div> </div>
<div>-- <br>
Clark <br>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
</blockquote>
<br>
</body>
</html>