[CMake] FindModules vs EXEC_PROGRAM
Stephen Adler
adler at stephenadler.com
Sun Mar 25 13:03:40 EST 2007
CMake folks...
I'm setting up a project using vxWidget and cmake. I've run across a
configuration dilema. I've followed the instructions on how to use the
wxWidgets file module .cmake as found in
${CMAKE_ROOT}/Modules/FindwxWidgets.cmake, but it does not seem to find
my wxWidget install. (My guess is that I'm actually using wxGTK, which
is the GTK port of wxWidget.)
wxWidget software is setup to use the wx-config command which dumps to
stdout the various compialiation and ld switches needed to properly
build a wxWidget application. So, I added the following lines to my
CMakeLists.txt file.
EXEC_PROGRAM(wx-config ARGS --cxxflags OUTPUT_VARIABLE WXCXXFLAGS)
EXEC_PROGRAM(wx-config ARGS --libs OUTPUT_VARIABLE WXFLAGS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WXCXXFLAGS}")
ADD_EXECUTABLE(wxHello wxHello.cpp)
TARGET_LINK_LIBRARIES(wxHello ${WXFLAGS})
This seems to work fine. Is there any reason I should avoid using the
'execute wx-config program and stuff the output into CMAKE_CXX_FLAGS'
method, and stick to using the more traditional method of including the
Find module for wxWidgets?
Cheers. Steve.
More information about the CMake
mailing list