Hello,

for my project I have the following structure in my project directory:

./CMakeLists.txt
./source/CMakeLists.txt
./source/eea/CMakeLists.txt
./source/eea/ui/CMakeLists.txt
./source/eea/ui/schematic/CMakeLists.txt

with
---8<---
./CMakeLists.txt:
project(eea)
...

---8<---
./source/CMakeLists.txt:
add_subdirectory(eea)
...

---8<---
./source/eea/CMakeLists.txt
add_executable(eea ...)

target_link_libraries(eea
    eea_ui_schematic_lib
    eea_ui_lib
    ...
)

qt5_use_modules(eea Widgets ...)

add_subdirectory(ui)
...

---8<---
./source/eea/ui/CMakeLists.txt
project(eea_ui)
...
set(eea_ui_SOURCE mainwindow_private.cpp graphics_view.cpp...)
add_library(eea_ui_lib STATIC
    ${eea_ui_SOURCE}
    ...
)

qt5_use_modules(eea_ui_lib Widgets ...)

add_subdirectory(schematic)
...
---8<---
./source/eea/ui/schematic/CMakeLists.txt:
project(eea_ui_schematic)
...
set(eea_ui_schematic_SOURCE schematics_view.cpp ...)
add_library(eea_ui_schematic_lib STATIC
    ${eea_ui_schematic_SOURCE}
    ...
)

qt5_use_modules(eea_ui_schematic_lib Widgets ...)

So far, so good - all compiles.



With
---8<---
./source/eea/ui/mainwindow_private.cpp :
...
createWindows() {
    SchematicView* schematicView = new SchematicView(q);
    ...
}

---8<---
./source/eea/ui/graphics_view.cpp:
GraphicsView::GraphicsView(QWidget* parent) { ...  }

---8<---
./source/eea/ui/schematic/schematic_view.cpp
class SchematicView
: public GraphicsView
{ .... }


I got the linker error:

../../lib/libeea_ui_lib.a(mainwindow_private.cpp.o): In function `eea::ui::MainWindowPrivate::createWindows()': mainwindow_private.cpp:(.text+0xbb): warning: undefined reference to `eea::ui::SchematicView::SchematicView(QWidget*)'

So, what happened here and how to solve it? Before the contents of ui/schematic moved into the ui directory/project and I've got no errors.

Thanks,
Olaf
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to