View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014021 | CMake | CMake | public | 2013-03-18 07:39 | 2016-06-10 14:31 | ||||
Reporter | Piotr Pietraszkiewicz | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | MS Visual Studio 2008 | OS | Windows | OS Version | 7 | ||||
Product Version | CMake 2.8.10.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014021: Generated .sln files for MS Visual Studio 2008 do not apply Automoc to the top-level dependencies of a sub-folder (library) | ||||||||
Description | In a subdirectory of my project I build a library (sub) which depends on another library found in the top level directory (mainwindow). My subfolder's sub/CMakeLists.txt: ~~~~ project ( sub ) include_directories("${CMAKE_SOURCE_DIR}") add_library(sub SubWindow.h) target_link_libraries(sub ${Qt4_LIBRARIES} mainlib mainwindow) ~~~~ My top level CMakeLists.txt: ~~~~ [..] set(CMAKE_AUTOMOC TRUE) [..] ADD_SUBDIRECTORY(sub) include_directories(. sub) add_library(mainwindow MainWindow.h) target_link_libraries(mainwindow ${Qt4_LIBRARIES}) ~~~~ Both SubWindow.h and MainWindow.h are tagged with Q_OBJECT and thus need to be processed by automoc. SubWindow.h depends on MainWindow.h. Configuring the project on Cygwin/Linux environments and invoking "make" in the "sub" sub-folder yields: ~~~~ ~/src/caamtest/cygwin_build/sub: $ make Scanning dependencies of target mainwindow_automoc [ 14%] Automoc for target mainwindow Generating moc_MainWindow.cpp [ 14%] Built target mainwindow_automoc Scanning dependencies of target mainwindow [ 28%] Building CXX object CMakeFiles/mainwindow.dir/mainwindow_automoc.cpp.o Linking CXX static library libmainwindow.a [ 28%] Built target mainwindow Scanning dependencies of target sub_automoc [ 42%] Automoc for target sub Generating moc_SubWindow.cpp [ 42%] Built target sub_automoc Scanning dependencies of target mainlib_automoc [ 57%] Automoc for target mainlib [ 57%] Built target mainlib_automoc Scanning dependencies of target mainlib [ 71%] Building CXX object CMakeFiles/mainlib.dir/mainlib.cpp.o [ 85%] Building CXX object CMakeFiles/mainlib.dir/mainlib_automoc.cpp.o Linking CXX static library libmainlib.a [ 85%] Built target mainlib Scanning dependencies of target sub [100%] Building CXX object sub/CMakeFiles/sub.dir/sub_automoc.cpp.o Linking CXX static library libsub.a [100%] Built target sub ~~~~ All fine, note that Automoc was started for both "mainwindow" and "sub". In contrast, configuring the project on Windows environment (for MS VS 2008) and building "sub" with devenv yields: ~~~~ D:\[..]\src\caamtest\windows_build\sub>devenv sub.sln /build Microsoft (R) Visual Studio Version 9.0.30729.1. Copyright (C) Microsoft Corp. Alle Rechte vorbehalten. 1>------ Erstellen übersprungen: Projekt: mainwindow_automoc, Konfiguration: Debug Win32 ------ 1>Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt. 2>------ Erstellen übersprungen: Projekt: mainlib_automoc, Konfiguration: Debug Win32 ------ 2>Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt. 3>------ Erstellen gestartet: Projekt: sub_automoc, Konfiguration: Debug Win32 ------ 3>Automoc for target sub [..] ~~~~ "Erstellen übersprungen" means "Building skipped". The automoc for "mainwindow" is not started. Inspecting the configuration of the sub.sln with: devenv sub.sln -> right click on "Project map" (Projektmappe "sub") -> Configuration reveals that "mainlib_automoc" target is present but disabled (see screen-shot: subsln_config.png). I attach my sample project that helps to reproduce the problem. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() ![]() ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0032653) Rolf Eike Beer (developer) 2013-03-18 08:49 |
include_directories(.) is doomed to cause error. Which directory do you want to add? The current source directory? The current binary directory? Some arbitrary directory from which the compiler is called which likely has no include files of interest in it? |
(0032666) Piotr Pietraszkiewicz (reporter) 2013-03-18 13:37 |
Indeed. Thank you for your remark. For my example here the following should do: diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ab7ae..08b66f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,7 @@ ADD_DEFINITIONS(${QT_DEFINITIONS}) ADD_SUBDIRECTORY(sub) -include_directories(. sub) - +include_directories("${CMAKE_SOURCE_DIR}") add_library(mainwindow MainWindow.h) target_link_libraries(mainwindow ${Qt4_LIBRARIES}) Unfortunately, that doesn't improve the situation much. The "mainwindow_automoc" target remains disabled in Visual Studio. |
(0032674) Piotr Pietraszkiewicz (reporter) 2013-03-19 11:06 |
BTW. Dropping "set(CMAKE_AUTOMOC TRUE)" in favour of "QT4_WRAP_CPP" macros seems to be one way to workaround this problem and to correctly invoke moc on the top-level dependencies of "sub" even when building with "devenv sub.sln". |
(0042252) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-03-18 07:39 | Piotr Pietraszkiewicz | New Issue | |
2013-03-18 07:39 | Piotr Pietraszkiewicz | File Added: caamtest.tgz | |
2013-03-18 07:40 | Piotr Pietraszkiewicz | File Added: subsln_config.png | |
2013-03-18 08:49 | Rolf Eike Beer | Note Added: 0032653 | |
2013-03-18 13:37 | Piotr Pietraszkiewicz | Note Added: 0032666 | |
2013-03-19 11:06 | Piotr Pietraszkiewicz | Note Added: 0032674 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042252 | |
2016-06-10 14:28 | Kitware Robot | Status | new => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |