tags:

views:

873

answers:

1

Hi

I am customizing qgis source code that builds through cmake.

It has a source tree with many sub directories(with sub-directories withinin them aswell).

The whole source tree is divided into modules like core,that has GIS core components,gui that takes care of the gui,app,that takes care of the main app(containing main.cpp) and other modules aswell..

The problem is that i am stuck with a requirement where i need to access a static class member in a different module. to be precise some member of QgisApp class in Gui module.

So normal inclusion of the qgisapp.h in one of the gui module's .cpp gives me undefined reference to the mamber that i want to access.. later i included the .h and .cpp in the CMakeLists.txt file that resides within the Gui module's root directory,and ran cmake again so that the Makefiles have the proper includes.. but that actually increased the number if undefined references a great deal (maybe because the .h and .cpp that i added into CMakeLists.txt itself includes other .h and .cpp that have references in the app module's own CMakeLists.txt).

So how can i use a member of a class of some module in some other module that is getting built with different set of CMakeLists.txt placed in its respective root directory??

This question is not specifically related to qgis but can come across with any source tree that is similar to what qgis has..So its a Cmake related question basically..

Hope i'm able to clearify my problem.

Help will be appreciated.

Thanks.

+1  A: 

target_link_libraries should do what you are looking for. If this doesn't work can you please try and post some example CMake code?

Mike McQuaid