From: <ai...@us...> - 2009-08-13 23:49:07
|
Revision: 10247 http://plplot.svn.sourceforge.net/plplot/?rev=10247&view=rev Author: airwin Date: 2009-08-13 23:48:59 +0000 (Thu, 13 Aug 2009) Log Message: ----------- To avoid contamination of all builds with qt flags, use CMake include(${QT_USE_FILE}) command only for subdirectories and conditions where it is needed rather than (implicitly) in the top-level directory. Modified Paths: -------------- trunk/bindings/qt_gui/CMakeLists.txt trunk/cmake/modules/qt.cmake trunk/drivers/CMakeLists.txt trunk/src/CMakeLists.txt Modified: trunk/bindings/qt_gui/CMakeLists.txt =================================================================== --- trunk/bindings/qt_gui/CMakeLists.txt 2009-08-13 20:01:31 UTC (rev 10246) +++ trunk/bindings/qt_gui/CMakeLists.txt 2009-08-13 23:48:59 UTC (rev 10247) @@ -19,6 +19,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if(ENABLE_qt) + # Set up Qt4-based build environment. + include(${QT_USE_FILE}) + if(NOT QT_LIBRARIES) + message(FATAL_ERROR "include(${QT_USE_FILE}) failed in bindings/qt_gui subdirectory.") + endif(NOT QT_LIBRARIES) set(qt_SOURCE plqt.cpp) include_directories( ${CMAKE_SOURCE_DIR}/include @@ -46,12 +51,11 @@ else(ANY_QT_DEVICE) message(FATAL_ERROR "Internal build system inconsistency between ENABLE_qt true and ANY_QT_DEVICE false.") endif(ANY_QT_DEVICE) - #message("qt_LINK_FLAGS = ${qt_LINK_FLAGS}") target_link_libraries( plplotqt${LIB_TAG} plplot${LIB_TAG} ${MATH_LIB} - ${qt_LINK_FLAGS} + ${QT_LIBRARIES} ) # qt_RPATH set in cmake/modules/qt.cmake. This is only used for the # install-tree rpath since cmake handles the build-tree rpath @@ -91,11 +95,10 @@ FILE export_plplotqt.cmake ) - # Transform "${qt_LINK_FLAGS}" to the - # standard pkg-config form. + # Transform "${QT_LIBRARIES}" to the standard pkg-config form. pkg_config_link_flags( libplplotqt${LIB_TAG}_LINK_FLAGS - "${qt_LINK_FLAGS}" + "${QT_LIBRARIES}" ) # Configure pkg-config *.pc file corresponding to the compile and link @@ -120,7 +123,7 @@ # Also used to determine PC_LINK_FLAGS and # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags: # fields. - set(PC_DATA "qt:QT:QT4 bindings, :plplotqt${LIB_TAG}") + set(PC_DATA "qt:Qt:Qt4 bindings, :plplotqt${LIB_TAG}") string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA}) set(PC_FILE_SUFFIX "-${BINDING}") Modified: trunk/cmake/modules/qt.cmake =================================================================== --- trunk/cmake/modules/qt.cmake 2009-08-13 20:01:31 UTC (rev 10246) +++ trunk/cmake/modules/qt.cmake 2009-08-13 23:48:59 UTC (rev 10247) @@ -69,24 +69,19 @@ if(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2) set(QT_USE_QTSVG 1) endif(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2) - include(${QT_USE_FILE}) - endif(QT4_FOUND) - if(QT4_FOUND AND QT_LIBRARIES) + # Do not include(${QT_USE_FILE}) here because it contaminates ALL + # build environments with Qt flags from the top-level directory on + # down. Instead include(${QT_USE_FILE}) only in certain subdirectories + # where it is necessary. set(qt_COMPILE_FLAGS) foreach(DIR ${QT_INCLUDES}) set(qt_COMPILE_FLAGS "${qt_COMPILE_FLAGS} -I${DIR}") endforeach(DIR ${QT_INCLUDES}) - message(STATUS "QT_LIBRARIES = ${QT_LIBRARIES}") - - set(qt_LINK_FLAGS ${QT_LIBRARIES}) - #message("qt_LINK_FLAGS = ${qt_LINK_FLAGS}") + set(qt_LINK_FLAGS) set(qt_RPATH ${QT_LIBRARY_DIR}) #message("qt_LIBRARY_DIR = ${qt_LIBRARY_DIR}") - else(QT4_FOUND AND QT_LIBRARIES) - message(STATUS "QT_LIBRARIES not found so disabling all qt devices") - set(ANY_QT_DEVICE OFF) - endif(QT4_FOUND AND QT_LIBRARIES) + endif(QT4_FOUND) endif(ANY_QT_DEVICE) if(NOT ANY_QT_DEVICE) Modified: trunk/drivers/CMakeLists.txt =================================================================== --- trunk/drivers/CMakeLists.txt 2009-08-13 20:01:31 UTC (rev 10246) +++ trunk/drivers/CMakeLists.txt 2009-08-13 23:48:59 UTC (rev 10247) @@ -82,34 +82,50 @@ PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(${SOURCE_ROOT_NAME}_COMPILE_FLAGS) + + # ${SOURCE_ROOT_NAME}_LINK_FLAGS is ideally a list of the full path names + # to libraries determined with find_library. However, the list can also + # include link flags such as the -L and -l form of specifying libraries, + # but that way of doing things only works on Unix, and even for Unix, + # cmake does not correctly set the rpath for the build tree results + # for non-standard locations with the -L and -l forms. + #message("${SOURCE_ROOT_NAME}_LINK_FLAGS = ${${SOURCE_ROOT_NAME}_LINK_FLAGS}") + # ${SOURCE_ROOT_NAME}_TARGETS is a list of PLplot CMake targets that the + # device driver depends on. + #message("${SOURCE_ROOT_NAME}_TARGETS = ${${SOURCE_ROOT_NAME}_TARGETS}") + if(SOURCE_ROOT_NAME STREQUAL "qt" AND NOT ENABLE_qt) if(ANY_QT_DEVICE) add_library(${SOURCE_ROOT_NAME} MODULE ${${SOURCE_ROOT_NAME}_SOURCE}) add_dependencies(${SOURCE_ROOT_NAME} moc_outfile_generated) + # Set up Qt4-based build environment. + include(${QT_USE_FILE}) + if(NOT QT_LIBRARIES) + message(FATAL_ERROR "include(${QT_USE_FILE}) failed in drivers subdirectory.") + endif(NOT QT_LIBRARIES) + + target_link_libraries( + ${SOURCE_ROOT_NAME} + plplot${LIB_TAG} + ${MATH_LIB} + ${${SOURCE_ROOT_NAME}_LINK_FLAGS} + ${${SOURCE_ROOT_NAME}_TARGETS} + ${QT_LIBRARIES} + ) else(ANY_QT_DEVICE) message(FATAL_ERROR "Internal build system inconsistency. Attempt to build dynamic qt device when ANY_QT_DEVICE is false.") endif(ANY_QT_DEVICE) else(SOURCE_ROOT_NAME STREQUAL "qt" AND NOT ENABLE_qt) add_library(${SOURCE_ROOT_NAME} MODULE ${${SOURCE_ROOT_NAME}_SOURCE}) + target_link_libraries( + ${SOURCE_ROOT_NAME} + plplot${LIB_TAG} + ${MATH_LIB} + ${${SOURCE_ROOT_NAME}_LINK_FLAGS} + ${${SOURCE_ROOT_NAME}_TARGETS} + ) endif(SOURCE_ROOT_NAME STREQUAL "qt" AND NOT ENABLE_qt) - # ${SOURCE_ROOT_NAME}_LINK_FLAGS is ideally a list of the full path names - # to libraries determined with find_library. However, the list can also - # include link flags such as the -L and -l form of specifying libraries, - # but that way of doing things only works on Unix, and even for Unix, - # cmake does not correctly set the rpath for the build tree results - # for non-standard locations with the -L and -l forms. - #message("${SOURCE_ROOT_NAME}_LINK_FLAGS = ${${SOURCE_ROOT_NAME}_LINK_FLAGS}") - # ${SOURCE_ROOT_NAME}_TARGETS is a list of PLplot CMake targets that the - # device driver depends on. - #message("${SOURCE_ROOT_NAME}_TARGETS = ${${SOURCE_ROOT_NAME}_TARGETS}") - target_link_libraries( - ${SOURCE_ROOT_NAME} - plplot${LIB_TAG} - ${MATH_LIB} - ${${SOURCE_ROOT_NAME}_LINK_FLAGS} - ${${SOURCE_ROOT_NAME}_TARGETS} - ) # ${SOURCE_ROOT_NAME}_RPATH originally set in cmake/modules files for # each driver in ${DRIVERS_LIST}. This is only used for the # install-tree rpath since cmake handles the build-tree rpath Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-08-13 20:01:31 UTC (rev 10246) +++ trunk/src/CMakeLists.txt 2009-08-13 23:48:59 UTC (rev 10247) @@ -106,6 +106,14 @@ # For this case libplot must have a target dependency on the # moc files generated in the binary include directory. set(qt_dependency moc_outfile_generated) + + # Set up Qt4-based build environment. + include(${QT_USE_FILE}) + if(NOT QT_LIBRARIES) + message(FATAL_ERROR "include(${QT_USE_FILE}) failed in src subdirectory.") + endif(NOT QT_LIBRARIES) + set(DRIVERS_LINK_FLAGS ${DRIVERS_LINK_FLAGS} ${QT_LIBRARIES}) + else(ANY_QT_DEVICE) message(FATAL_ERROR "Internal build system inconsistency. Attempt to build static qt device when ANY_QT_DEVICE is false.") endif(ANY_QT_DEVICE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |