[CMake] CMake with wxWidgets on Linux
Brian Eastwood
beastwoo at email.unc.edu
Sat May 27 19:10:50 EDT 2006
Hi All,
I've been using CMake for a few years on Windows and recently switched
over to Linux. I have been having some problems getting a basic hello
world program running using wxWidgets, and figured someone here probably
know what I am doing wrong. Part of my confusion is the large number of
cmake files that could be used to configure wxWidgets. My CMakeLists
file is copied below. The program hworld.cxx is basically Robert
Roebling's hello world tutorial from http://www.wxwidgets.org/hello.htm
I have no problems running cmake or compiling the project, but get a
segmentation fault when I try running the program...there is no other
output. (I'm assuming the application can't find a shared library, but
I don't know which one that would be.)
I am running Fedora Core 5 and installed wxGTK, wxGTK-devel and
compat-wxGTK2-devel (among others) from the fedora extras rpm
repository. Are there other packages I should have installed?
Thanks in advance for any suggestions.
Cheers,
Brian
# CMakeLists.txt
PROJECT (tests)
SET (CMAKE_VERBOSE_MAKEFILE 1)
INCLUDE (${CMAKE_ROOT}/Modules/FindGTK.cmake)
IF (GTK_FOUND)
INCLUDE_DIRECTORIES (${GTK_INCLUDE_DIR})
LINK_LIBRARIES (${GTK_LIBRARIES})
ELSE (GTK_FOUND)
MESSAGE (FATAL_ERROR
"Cannot build without GTK. Please install GTK.")
ENDIF (GTK_FOUND)
FIND_PACKAGE(wxWindows)
IF (WXWINDOWS_FOUND)
SET (CMAKE_CXX_FLAGS "${CMAKE_WXWINDOWS_CXX_FLAGS}")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__WXDEBUG__
-DWXDEBUG=1")
ADD_DEFINITIONS (${WXWINDOWS_DEFINITIONS})
INCLUDE_DIRECTORIES (${WXWINDOWS_INCLUDE_DIR})
LINK_DIRECTORIES (${WXWINDOWS_LINK_DIRECTORIES})
LINK_LIBRARIES (${WXWINDOWS_LIBRARIES})
ELSE (WXWINDOWS_FOUND)
MESSAGE (FATAL_ERROR
"Cannot build without wxWidgets. Please install wxWidgets.")
ENDIF (WXWINDOWS_FOUND)
INCLUDE_DIRECTORIES(
${tests_SOURCE_DIR}
)
IF (WIN32)
SET (GUI_EXE WIN32)
ENDIF (WIN32)
ADD_EXECUTABLE (hworld ${GUI_EXE} hworld.cxx)
More information about the CMake
mailing list