Re: [CMake] QT_DEFINITIONS
On 05/24/2010 11:39 PM, Clinton Stimpson wrote: On Monday, May 24, 2010 03:07:43 pm Michael Hertling wrote: On 05/24/2010 05:20 PM, Clinton Stimpson wrote: On Sunday, May 23, 2010 08:26:42 am Michael Hertling wrote: Dear CMake community, after having taken a look into FindQt4.cmake, UseQt4.cmake and Qt4ConfigDependentSettings.cmake, I wonder how the QT_DEFINITIONS variable gets populated. As far as I can see, this variable remains empty, perhaps except for -DQT_DLL on Windows; in particular, it does not receive the -DQT_library_LIB flags which are solely enabled via ADD_DEFINITIONS() by UseQt4.cmake, i.e. with INCLUDE(${QT_USE_FILE}) as suggested by FindQt4.cmake. Of course, from within a FindXXX.cmake or XXXConfig.cmake for a package depending on Qt4, one does not want to have the build environment modified by ADD_DEFINITIONS() et al., but convey the necessary settings by variables like QT_DEFINITIONS. Therefore, my question is how to get to know about the flags for compiling Qt4-dependent packages without including UseQt4.cmake. BTW, what is the recommendation for a package XXX which depends on a package YYY regarding FindXXX.cmake and FindYYY.cmake, i.e. would one expect FindXXX.cmake to call FIND_PACKAGE(YYY), or is the user expected to call FIND_PACKAGE() for XXX and YYY in the correct order and, as the case may be, with sufficient sets of components? In general, the latter is easier for the finders, but the former would be more convenient for the user. Any comments, suggestions etc. would be greatly appreciated. I think the answer depends on whether the user of your software will be writing Qt based code themselves, or whether Qt is hidden behind your apis. If they write Qt code themselves, they could choose to use a different set of Qt modules, in which case compile flags could change. Exactly, and this is one reason why I would be interested in learning the compile flags right after a FIND_PACKAGE(Qt4 ...) to save them in my own variables. There's no such problem w.r.t. libraries and include directories since I can refer to QT_QTXXX_{FOUND,LIBRARY,INCLUDE_DIR}, and their values don't depend on the requested set of modules, but as far as I can see, the flags aren't propagated by FindQt4.cmake to the calling CMakeLists.txt in any manner. As a suggestion, would it be possible to enhance FindQt4.cmake with two sections similar to the last two of UseQt4.cmake, i.e. list dependent modules... and Qt modules..., but differing in that QT_DEFINITIONS is populated with the flags according to the requested set of modules? This shouldn't harm backward compatibility, and the user could save the compile flags before FindQt4.cmake possibly runs anew. In UseQt4.cmake, at first glance, ADD_DEFINITIONS(-DQT3_SUPPORT) would need to be moved to FindQt4.cmake and transformed into an addition to QT_DEFINITIONS, and ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB) could be left out as ADD_DEFINITIONS(${QT_DEFINITIONS}) is UseQt4.cmake's first command. I don't quite follow why you want to save those values. Are you assuming the installation location of Qt is the same for you and all of the software users? No, I don't. Saving the values means to transfer the results delivered by FindQt4.cmake to variables for further use, e.g. to return the values from the finder of a Qt4-dependent package as being recommended by ${CMAKE_ROOT}/Modules/readme.txt. I was thinking that if the user of your software was also using Qt, FindQt4.cmake should be used on their machine instead of saved information extracted from FindQt4.cmake on someone else's machine. Of course, FindQt4.cmake is called on the target machine in this way, but that is not my concern. Let me explain by means of the following example: Package XXX uses QtCore, QtGui and Qt...; consequently, its finder calls FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui Qt...), but not INCLUDE(${QT_USE_FILE}) because of the latter's impact on the build environment. The user of XXX is informed about libraries and include directories via XXX_LIBRARIES containing QT_QT{CORE,GUI,...}_LIBRARY and XXX_INCLUDE_DIRS containing QT_QT{CORE,GUI,...}_INCLUDE_DIR, but the compile flags can not be propagated via XXX_DEFINITIONS because FindQt4.cmake doesn't reveal them. So, XXX's user can't find out the potentially necessary flags for the compilation that encompasses the Qt4 headers before eventually enabling them in the build environment later with INCLUDE(${QT_USE_FILE}). Now, my concern is how to get to know about the compile flags after a call to FIND_PACKAGE(Qt4 ...), and AFAIK, this is what variables like QT_DEFINITIONS are meant for. Another possibility is for your XXX_variables to include the values of the QT_* variables, and if the user decides to use additional Qt modules, the burden would be on them. They could have their own find_package(Qt4), as its ok to include it multiple times. This is what I'm doing when writing finders
Re: [CMake] QT_DEFINITIONS
On Sunday, May 23, 2010 08:26:42 am Michael Hertling wrote: Dear CMake community, after having taken a look into FindQt4.cmake, UseQt4.cmake and Qt4ConfigDependentSettings.cmake, I wonder how the QT_DEFINITIONS variable gets populated. As far as I can see, this variable remains empty, perhaps except for -DQT_DLL on Windows; in particular, it does not receive the -DQT_library_LIB flags which are solely enabled via ADD_DEFINITIONS() by UseQt4.cmake, i.e. with INCLUDE(${QT_USE_FILE}) as suggested by FindQt4.cmake. Of course, from within a FindXXX.cmake or XXXConfig.cmake for a package depending on Qt4, one does not want to have the build environment modified by ADD_DEFINITIONS() et al., but convey the necessary settings by variables like QT_DEFINITIONS. Therefore, my question is how to get to know about the flags for compiling Qt4-dependent packages without including UseQt4.cmake. BTW, what is the recommendation for a package XXX which depends on a package YYY regarding FindXXX.cmake and FindYYY.cmake, i.e. would one expect FindXXX.cmake to call FIND_PACKAGE(YYY), or is the user expected to call FIND_PACKAGE() for XXX and YYY in the correct order and, as the case may be, with sufficient sets of components? In general, the latter is easier for the finders, but the former would be more convenient for the user. Any comments, suggestions etc. would be greatly appreciated. I think the answer depends on whether the user of your software will be writing Qt based code themselves, or whether Qt is hidden behind your apis. If they write Qt code themselves, they could choose to use a different set of Qt modules, in which case compile flags could change. Clint ___ 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
Re: [CMake] QT_DEFINITIONS
On Monday, May 24, 2010 03:07:43 pm Michael Hertling wrote: On 05/24/2010 05:20 PM, Clinton Stimpson wrote: On Sunday, May 23, 2010 08:26:42 am Michael Hertling wrote: Dear CMake community, after having taken a look into FindQt4.cmake, UseQt4.cmake and Qt4ConfigDependentSettings.cmake, I wonder how the QT_DEFINITIONS variable gets populated. As far as I can see, this variable remains empty, perhaps except for -DQT_DLL on Windows; in particular, it does not receive the -DQT_library_LIB flags which are solely enabled via ADD_DEFINITIONS() by UseQt4.cmake, i.e. with INCLUDE(${QT_USE_FILE}) as suggested by FindQt4.cmake. Of course, from within a FindXXX.cmake or XXXConfig.cmake for a package depending on Qt4, one does not want to have the build environment modified by ADD_DEFINITIONS() et al., but convey the necessary settings by variables like QT_DEFINITIONS. Therefore, my question is how to get to know about the flags for compiling Qt4-dependent packages without including UseQt4.cmake. BTW, what is the recommendation for a package XXX which depends on a package YYY regarding FindXXX.cmake and FindYYY.cmake, i.e. would one expect FindXXX.cmake to call FIND_PACKAGE(YYY), or is the user expected to call FIND_PACKAGE() for XXX and YYY in the correct order and, as the case may be, with sufficient sets of components? In general, the latter is easier for the finders, but the former would be more convenient for the user. Any comments, suggestions etc. would be greatly appreciated. I think the answer depends on whether the user of your software will be writing Qt based code themselves, or whether Qt is hidden behind your apis. If they write Qt code themselves, they could choose to use a different set of Qt modules, in which case compile flags could change. Exactly, and this is one reason why I would be interested in learning the compile flags right after a FIND_PACKAGE(Qt4 ...) to save them in my own variables. There's no such problem w.r.t. libraries and include directories since I can refer to QT_QTXXX_{FOUND,LIBRARY,INCLUDE_DIR}, and their values don't depend on the requested set of modules, but as far as I can see, the flags aren't propagated by FindQt4.cmake to the calling CMakeLists.txt in any manner. As a suggestion, would it be possible to enhance FindQt4.cmake with two sections similar to the last two of UseQt4.cmake, i.e. list dependent modules... and Qt modules..., but differing in that QT_DEFINITIONS is populated with the flags according to the requested set of modules? This shouldn't harm backward compatibility, and the user could save the compile flags before FindQt4.cmake possibly runs anew. In UseQt4.cmake, at first glance, ADD_DEFINITIONS(-DQT3_SUPPORT) would need to be moved to FindQt4.cmake and transformed into an addition to QT_DEFINITIONS, and ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB) could be left out as ADD_DEFINITIONS(${QT_DEFINITIONS}) is UseQt4.cmake's first command. I don't quite follow why you want to save those values. Are you assuming the installation location of Qt is the same for you and all of the software users? I was thinking that if the user of your software was also using Qt, FindQt4.cmake should be used on their machine instead of saved information extracted from FindQt4.cmake on someone else's machine. One possibility is to make your own UseXXX.cmake file that includes UseQt4.cmake. The UseXXX.cmake could set QT_USE_QT* flags that XXX depends on. That's a bit awkward I guess. Another possibility is for your XXX_variables to include the values of the QT_* variables, and if the user decides to use additional Qt modules, the burden would be on them. They could have their own find_package(Qt4), as its ok to include it multiple times. This latter method is what FindQt4.cmake does as some of the Qt modules have extra dependencies such as zlib, OpenGL, Xlib, etc, but its probably a bit simpler in the case of FindQt4.cmake because most of those 3rd party dependencies are hidden behind the Qt api. The current FindQt4.cmake will do a find_package(OpenGL), find_package(X11), etc.. for those dependencies. Clint ___ 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
[CMake] QT_DEFINITIONS
Dear CMake community, after having taken a look into FindQt4.cmake, UseQt4.cmake and Qt4ConfigDependentSettings.cmake, I wonder how the QT_DEFINITIONS variable gets populated. As far as I can see, this variable remains empty, perhaps except for -DQT_DLL on Windows; in particular, it does not receive the -DQT_library_LIB flags which are solely enabled via ADD_DEFINITIONS() by UseQt4.cmake, i.e. with INCLUDE(${QT_USE_FILE}) as suggested by FindQt4.cmake. Of course, from within a FindXXX.cmake or XXXConfig.cmake for a package depending on Qt4, one does not want to have the build environment modified by ADD_DEFINITIONS() et al., but convey the necessary settings by variables like QT_DEFINITIONS. Therefore, my question is how to get to know about the flags for compiling Qt4-dependent packages without including UseQt4.cmake. BTW, what is the recommendation for a package XXX which depends on a package YYY regarding FindXXX.cmake and FindYYY.cmake, i.e. would one expect FindXXX.cmake to call FIND_PACKAGE(YYY), or is the user expected to call FIND_PACKAGE() for XXX and YYY in the correct order and, as the case may be, with sufficient sets of components? In general, the latter is easier for the finders, but the former would be more convenient for the user. Any comments, suggestions etc. would be greatly appreciated. Best regards, Michael ___ 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