<div dir="ltr">That is what he said, but it seems to be a typo, because the CMakeLists.txt file clearly states '<span style="font-size:12.8px">set(QT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/</span><span style="font-size:12.8px">ThirdParty/Qt/4.8.6)' - still a stone-age version of Qt actually :(</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Sincerely,</span></div><div><span style="font-size:12.8px">Jakob van Bethlehem</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 9:09 AM, Hendrik Sattler <span dir="ltr"><<a href="mailto:post@hendrik-sattler.de" target="_blank">post@hendrik-sattler.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
Am 1. Juni 2016 09:02:41 MESZ, schrieb Jakob van Bethlehem <<a href="mailto:jsvanbethlehem@gmail.com">jsvanbethlehem@gmail.com</a>>:<br>
>Hej,<br>
><br>
>Some things that come to mind:<br>
>* You're generating files *inside* the source tree - you're not<br>
>supposed to<br>
>do that<br>
>* Why do you want to have a special Qt_tmp directory? I don't see the<br>
>benefit, and without that requirement you can simply use the<br>
>qt4_wrap_cpp<br>
>macro explicitly and you still are not forced to use the automoc<br>
>feature<br>
><br>
>And now for what is probably wrong in your CMakeLists.txt:<br>
>* It seems you made an important mistake regarding the behaviour of<br>
>'file(GLOB)'. That function will do the expansion *while running<br>
>CMake*.<br>
>But at that time the moc_* files *don't exist!* (as a matter of fact,<br>
>the<br>
>tmp directory doesn't even exist). In other words, your ${Moc_SOURCES}<br>
>will<br>
>be empty, and hence they are not compiled, and hence you get precisely<br>
>the<br>
>linker errors you see (because these sources implement the functions<br>
>that<br>
>are listed as missing by the linker)<br>
><br>
>If you would use the qt4_wrap_cpp() macro you don't run into this<br>
>problem,<br>
>so I'd strongly suggest using it.<br>
<br>
</div></div>Except that he is using Qt3.<br>
<div><div class="h5"><br>
>Sincerely,<br>
>Jakob van Bethlehem<br>
><br>
><br>
><br>
><br>
>On Tue, May 31, 2016 at 4:52 PM, irene w <<a href="mailto:ire866306@gmail.com">ire866306@gmail.com</a>> wrote:<br>
><br>
>> It seems CMakw could not find the generated moc_xxx files.  I<br>
>modified the<br>
>> scripts to specify moc_xxx files is generated, but it still has same<br>
>errors.<br>
>><br>
>> ADD_CUSTOM_COMMAND ( OUTPUT ${Qt_tmp}/moc_GMWindow.cpp<br>
>>                      COMMAND ${QT_MOC_CMD} ${GM_DIR}/GMWindow.h -o<br>
>> ${Qt_tmp}/moc_GMWindow.cpp<br>
>>                      DEPENDS ${GM_DIR}/GMWindow.h<br>
>>                    )<br>
>> ADD_CUSTOM_TARGET(generate_foo DEPENDS ${Qt_tmp}/moc_GMWindow.cpp)<br>
>> SET_SOURCE_FILES_PROPERTIES(${Qt_tmp}/moc_GMWindow.cpp PROPERTIES<br>
>> GENERATED 1)<br>
>> SET_PROPERTY(SOURCE ${GM_DIR}/GMWindow.cpp APPEND PROPERTY<br>
>OBJECT_DEPENDS<br>
>> ${Qt_tmp}/moc_GMWindow.cpp)<br>
>><br>
>> .....<br>
>> add_dependencies (GM generate_foo)<br>
>><br>
>><br>
>> Does the Macro  "SET_SOURCE_FILES_PROPERTIES" with "GENERATED"<br>
>> setting work for this purposes?  Any help would be greatly<br>
>appreciated !<br>
>><br>
>><br>
>> On Wed, May 25, 2016 at 12:48 PM, irene w <<a href="mailto:ire866306@gmail.com">ire866306@gmail.com</a>><br>
>wrote:<br>
>><br>
>>> Hi,<br>
>>><br>
>>> I am compiling a simple Qt3 application on Linux using CMake. In my<br>
>case,<br>
>>> I need to build moc_xxx files with custom options and output to a<br>
>specified<br>
>>> directory, So, I was not using CAMKE_AUTO macros. My cmake scripts<br>
>create a<br>
>>> "Qt_tmp" directory and output moc_xxx there.<br>
>>><br>
>>> It looked it always failed to link the moc_xxx files for the first<br>
>time<br>
>>> build when there is no "Qt_tmp" directory, and succeeded if I ran<br>
>build<br>
>>> again if the "Qt_tmp" directory and moc_xxx files created by the<br>
>failed<br>
>>> build were kept without removing.  However, it'll fail if I delete<br>
>>> the "Qt_tmp" directory.<br>
>>><br>
>>> Even it failed at the first build, the moc_xxx files were<br>
>>> successfully created in the "Qt_tmp" directory.<br>
>>><br>
>>> Here is my cmake scripts and the errors I got.  Can anyone help me<br>
>to<br>
>>> figure out the issues? Any help would be greatly appreciated.<br>
>Thanks.<br>
>>><br>
>>> CMakeLists.txt<br>
>>><br>
>>><br>
>---------------------------------------------------------------------------------------------<br>
>>> cmake_minimum_required(VERSION 3.4.1)<br>
>>> project (GM_Application CXX)<br>
>>> SET (CMAKE_SYSTEM_NAME Linux)<br>
>>> SET (CMAKE_CXX_COMPILER ${COMPILER_PATH}${CROSS_COMPILE}g++)<br>
>>> set (GM_DIR ${CMAKE_CURRENT_SOURCE_DIR})<br>
>>> set (QT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/Qt/4.8.6)<br>
>>> LINK_DIRECTORIES (${QT_DIR}/lib)<br>
>>> INCLUDE_DIRECTORIES ("${QT_DIR}/include"<br>
>>>                      "${GM_DIR}"<br>
>>> )<br>
>>> ##### Compiling QT moc and ui  #####<br>
>>> set (QT_MOC_CMD ${QT_DIR}/bin/moc -I$(QT_DIR)/mkspecs/linux-g++<br>
>>> -I${QT_DIR}/include -I${QT_DIR}/include/QtGui)<br>
>>> file (MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Qt_tmp)<br>
>>> set (Qt_tmp ${CMAKE_CURRENT_SOURCE_DIR}/Qt_tmp)<br>
>>> add_custom_target (Moc_GMWindows<br>
>>>                    COMMAND ${QT_MOC_CMD} ${GM_DIR}/GMWindow.h -o<br>
>>> ${Qt_tmp}/moc_GMWindow.cpp<br>
>>>                   )<br>
>>><br>
>>> ##### Compiling application  #####<br>
>>> file (GLOB GM_SOURCES ${GM_DIR}/*.h ${GM_DIR}/*.cpp)<br>
>>> file (GLOB Moc_SOURCES ${Qt_tmp}/*.h ${Qt_tmp}/*.cpp)<br>
>>> add_executable (GM ${GM_SOURCES} ${Moc_SOURCES})<br>
>>> target_include_directories (GM PRIVATE ${Qt_tmp})<br>
>>> add_dependencies (GM Moc_GMWindows)<br>
>>> target_link_libraries (GM QtGui)<br>
>>><br>
>>><br>
>>><br>
>-------------------------------------------------------------------------------------------<br>
>>> Errors:<br>
>>><br>
>>> Scanning dependencies of target Moc_GMWindows<br>
>>> [  0%] Built target Moc_GMWindows<br>
>>> Scanning dependencies of target GM<br>
>>> [ 14%] Building CXX object GM/CMakeFiles/GM.dir/GM/GM.cpp.o<br>
>>> [ 42%] Building CXX object GM/CMakeFiles/GM.dir/GM/GMService.cpp.o<br>
>>> [ 67%] Building CXX object GM/CMakeFiles/GM.dir/GM/GMWindow.cpp.o<br>
>>> [ 85%] Building CXX object GM/CMakeFiles/GM.dir/GM/main.cpp.o<br>
>>> [100%] Linking CXX executable ../bin/GM<br>
>>> CMakeFiles/GM.dir/GM/GMWindow.cpp.o: In function<br>
>>> `GM::GMWindow::emitAppendMessage(QStrin<br>
>>> g)':<br>
>>> /GM/GMWindow.cpp:217: undefined reference to<br>
>>> `GM::GMWindow::appendMessage(QString)'<br>
>>><br>
>CMakeFiles/GM.dir/GM/GMWindow.cpp.o:(.rodata._ZTVN2GM8GMWindowE[vtable<br>
>>> for GM::GMWindow]<br>
>>> +0x8): undefined reference to `GM::GMWindow::metaObject() const'<br>
>>><br>
>CMakeFiles/GM.dir/GM/GMWindow.cpp.o:(.rodata._ZTVN2GM8GMWindowE[vtable<br>
>>> for GM::GMWindow]<br>
>>> +0xc): undefined reference to `GM::GMWindow::qt_metacast(char<br>
>const*)'<br>
>>><br>
>CMakeFiles/GM.dir/GM/GMWindow.cpp.o:(.rodata._ZTVN2GM8GMWindowE[vtable<br>
>>> for GM::GMWindow]<br>
>>> +0x10): undefined reference to<br>
>>> `GM::GMWindow::qt_metacall(QMetaObject::Call, int, void**)'<br>
>>> collect2: ld returned 1 exit status<br>
>>> make[2]: *** [bin/GM] Error 1<br>
>>> make[1]: *** [GM/CMakeFiles/GM.dir/all] Error 2<br>
>>> make: *** [all] Error 2<br>
>>><br>
>>><br>
>>><br>
>>><br>
</div></div>><<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" rel="noreferrer" target="_blank">https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail</a>><br>
>Virus-free.<br>
>>> <a href="http://www.avast.com" rel="noreferrer" target="_blank">www.avast.com</a><br>
>>><br>
><<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" rel="noreferrer" target="_blank">https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail</a>><br>
>>><br>
><#m_3542150497808946122_m_6400203814648417669_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2><br>
<span class="">>>><br>
>><br>
>><br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Kitware offers various services to support the CMake community. For<br>
>more<br>
>> information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
>><br>
><br>
><br>
</span>>------------------------------------------------------------------------<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.<br>
</font></span><div class="HOEnZb"><div class="h5">--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>