[CMake] Help using CMake & Expat in Windows

Clark Taylor clark.n.taylor at gmail.com
Fri Jul 30 16:23:51 EDT 2010


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

#I think 2.6 is required for some of things I do below, but I am not sure
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# This is the CMake file for my application.  This
# will be my first CMake file of decent size, so please excuse
# any particularly bad syntax :)
PROJECT(MyApp)
FIND_PACKAGE(wxWidgets REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(EXPAT REQUIRED)
INCLUDE (${wxWidgets_USE_FILE} ${OpenCV_USE_FILE} ${EXPAT_INCLUDE_DIRS})

SET(Headers myApp.h myAppGUI.h myAppGUImpl.h Coordinates/Coordinates.h)
SET(Src myApp.cpp myAppGUI.cpp myAppGUImpl.cpp Coordinates/Coordinates.cpp)

ADD_EXECUTABLE(myApp ${Headers} ${Src})
TARGET_LINK_LIBRARIES(myApp ${wxWidgets_LIBRARIES} ${OpenCV_LIBS}
${EXPAT_LIBRARIES})

#End of code

Everything works great in Linux, but when I try to use this in Windows, I
have series of problems, all inter-related.

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).

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"

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.

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.

Any ideas?

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 :)

-- 
Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100730/9d72fc9d/attachment.htm>


More information about the CMake mailing list