Tyler Roscoe a écrit :
On Wed, Jul 01, 2009 at 07:23:27PM +0200, Florent Teichteil wrote:
// BEGINNING OF CMakeLists.txt

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
find_package(wxWidgets COMPONENTS base core REQUIRED)
include_directories(${wxWidgets_INCLUDE_DIRS})
add_definitions(${wxWidgets_DEFINITIONS})
message(STATUS ${wxWidgets_INCLUDE_DIRS})

// END OF CMakeLists.txt

When I run "cmake ." in a terminal window, I get the following output:

Don't do in-source builds, for they lead to suffering. Check the FAQ for
details.

-- /usr/lib/wx/include/gtk2-unicode-release-2.8/usr/include/wx-2.8
-- Configuring done
-- Generating done

The first line gives the value of "wxWidgets_INCLUDE_DIRS" which is obviously wrong. It seems 2 paths have been concatenated without white space. I think it should be something like "/usr/lib/wx/include/gtk2-unicode-release-2.8 /usr/include/wx-2.8".

Try message(STATUS "${wxWidgets_INCLUDE_DIRS}"). My guess is that
variable is a list and the way you are using it in message() is
flattening that list.


I've just found the error I made. I defined another CMakeLists.txt file in a sub-directory containing the source code. Unfortunately, I declared it in the root CMakeLists.txt file (using the command add_subdirectory) after the wxwidgets macros, because I thought that it would be processed after the main file. But this is not the case: it seems the add_subdirectory command immediately processes the sub-directory's CMakeLists.txt file, so that the wxwidgets include paths were not defined in the sub-directory's generated Makefile.

Thank you all very much for your help,
Florent
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to