On Dec 5, 2011, at 8:29 AM, David Doria wrote:

> On Sun, Dec 4, 2011 at 11:34 AM, Michael Jackson
> <mike.jack...@bluequartz.net> wrote:
>> Do you have "MyWidget" packaged as a true library, or did you just create 
>> the Designer Plugin and then have a "loose" .cpp/.h file?
>> 
>>  The is a project called Qwt* that has a similar setup. It has a Designer 
>> plugin for its various widgets and it has a qwt.dylib/.dll/.so that your 
>> program links against. You might be able to use this type of workflow for 
>> your project. In rough form this is what I am suggesting:
>> 
>> Create a MyWidget project that builds the Designer plugin and a dynamic 
>> library. When the project "installs" it will install its headers and library 
>> under its own install location and also install the Designer plugin into the 
>> appropriate location inside the Qt distribution you are using. The MyWidget 
>> would also include the necessary CMake EXPORT files or what ever so other 
>> projects can use it.
>> 
>> In the project that actually _uses_ MyWidget, you call 
>> "find_package(MyWidget)" which will setup all the necessary include 
>> directories and "MyWidget_LIBRARIES" variables.
>> 
>> *Normal Qwt at Sourceforge does NOT use CMake as a build system. I have 
>> created a CMake build system for Qwt which is located on my public git-web 
>> server.
>> 
>> Hope some of that helps.
> 
> Thanks Mike,
> 
> I tried simply placing the Widget in a subdirectory called Widget. I
> got it to work, but I am confused about one thing. If in the main
> project CMakeLists.txt I add:
> add_subdirectory(Widget)
> 
> and then in Widget/CMakeLists.txt I add:
> 
> include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
> 
> I get errors that LabeledSlider.h can't find ui_LabeledSlider.h, and
> main.cpp can't find LabeledSlider.h (problems with uic). However, if
> instead I add directly to the main project CMakeLists.txt:
> 
> include_directories(${CMAKE_CURRENT_BINARY_DIR}/Widget)
> include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Widget)
> 
> it works fine. Can you explain the difference between these two
> methods of adding the include directories? I have setup both cases
> here: http://daviddoria.com/Uploads/QtSubdirectory.tar.gz
> 
> Thanks,
> 
> David

Basically you have to figure out where "ui_LabeledSlider.h" is being generated 
and make sure that directory is being added via "include_directories". Once you 
work through that the other errors may go away.

----
Mike Jackson 
--

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