From: <ai...@us...> - 2014-04-21 00:26:14
|
Revision: 13105 http://sourceforge.net/p/plplot/code/13105 Author: airwin Date: 2014-04-21 00:26:11 +0000 (Mon, 21 Apr 2014) Log Message: ----------- Implement and use (in the CMake-based build system for the installed examples) a cmake-packages approach as documented at <http://www.cmake.org/cmake/help/git-next/manual/cmake-packages.7.html> for handling the CMake export of information concerning the PLplot libraries. This change in approach allows finding Qt5 automatically as part of the CMake package configuration file. That solves a linking issue with the previous approach when exporting a static version of the plplot library that depends on Qt5. Also refine the condition under which qt_example is tested both for the core build and the CMake-based build of the installed examples. Modified Paths: -------------- trunk/examples/CMakeLists.txt trunk/src/CMakeLists.txt Added Paths: ----------- trunk/src/plplotConfig.cmake Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2014-04-21 00:16:56 UTC (rev 13104) +++ trunk/examples/CMakeLists.txt 2014-04-21 00:26:11 UTC (rev 13105) @@ -332,9 +332,9 @@ # Install qt support file. if(ANY_QT_DEVICE) install(FILES - ${CMAKE_SOURCE_DIR}/cmake/modules/ndp_UseQt4.cmake - DESTINATION ${DATA_DIR}/examples/cmake/modules - ) + ${CMAKE_SOURCE_DIR}/cmake/modules/ndp_UseQt4.cmake + DESTINATION ${DATA_DIR}/examples/cmake/modules + ) endif(ANY_QT_DEVICE) # Install PLplot-specific language support files needed for CMake-based @@ -409,7 +409,7 @@ #Configure variables and enable languages as needed. include(plplot_configure) - include(export_plplot) + find_package(plplot) endif(CORE_BUILD) @@ -857,7 +857,7 @@ endif(WIN32_AND_NOT_CYGWIN) endif(ENABLE_wxwidgets) - if(PLD_extqt) + if(PLD_extqt AND TARGET qt_example) add_custom_target(test_qt_example COMMAND qt_example DEPENDS @@ -868,7 +868,7 @@ add_dependencies(test_qt_example test_qt_dyndriver) endif(FILE_DEPENDS_qt) list(APPEND interactive_targets_LIST test_qt_example) - endif(PLD_extqt) + endif(PLD_extqt AND TARGET qt_example) endif(ENABLE_cxx) Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2014-04-21 00:16:56 UTC (rev 13104) +++ trunk/src/CMakeLists.txt 2014-04-21 00:26:11 UTC (rev 13105) @@ -420,8 +420,45 @@ # This exports information for every target in the whole build that # has the EXPORT export_plplot signature (as above) for the # install(TARGETS ... # command. -install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples/cmake/modules) +install(EXPORT export_plplot DESTINATION ${LIB_DIR}/cmake/plplot) +# Install associated CMake package config file. + +install(FILES plplotConfig.cmake DESTINATION ${LIB_DIR}/cmake/plplot) + +if(NOT ENABLE_DYNDRIVERS AND ANY_QT_DEVICE AND PLPLOT_USE_QT5) + # For this special case QT_LIBRARIES is not populated so must + # this alternative method to add Qt(5) libraries to the pkg-config file + # for the plplot library. + + # FIXME? This list will need revision whenever the PLplot qt device + # driver dependencies on the Qt5 components are revised. + set(Qt5_library_name_list + Core + Svg + Gui + Widgets + PrintSupport + ) + + set(Qt5_library_fullpath_list) + foreach(Qt5_library_name ${Qt5_library_name_list}) + find_library(Qt5${Qt5_library_name}_fullpath Qt5${Qt5_library_name}) + if(Qt5${Qt5_library_name}_fullpath) + list(APPEND Qt5_library_fullpath_list ${Qt5${Qt5_library_name}_fullpath}) + else(Qt5${Qt5_library_name}_fullpath) + message(STATUS "Qt5${Qt5_library_name}_fullpath = ${Qt5${Qt5_library_name}_fullpath}") + message(FATAL_ERROR "Qt5${Qt5_library_name} library not found.") + endif(Qt5${Qt5_library_name}_fullpath) + endforeach(Qt5_library_name ${Qt5_library_name_list}) + + pkg_config_link_flags(Qt5_library_LINK_FLAGS "${Qt5_library_fullpath_list}") + set( + libplplot${LIB_TAG}_LINK_FLAGS + "${libplplot${LIB_TAG}_LINK_FLAGS} ${Qt5_library_LINK_FLAGS}" + ) +endif(NOT ENABLE_DYNDRIVERS AND ANY_QT_DEVICE AND PLPLOT_USE_QT5) + #message("libplplot${LIB_TAG}_LINK_FLAGS = ${libplplot${LIB_TAG}_LINK_FLAGS}") string(REGEX REPLACE ";" " " Added: trunk/src/plplotConfig.cmake =================================================================== --- trunk/src/plplotConfig.cmake (rev 0) +++ trunk/src/plplotConfig.cmake 2014-04-21 00:26:11 UTC (rev 13105) @@ -0,0 +1,7 @@ +if(PLPLOT_USE_QT5) + # Find Qt5 components that we need. + find_package(Qt5 5.2.0 COMPONENTS Svg Gui PrintSupport) +endif(PLPLOT_USE_QT5) + +# Find export files in same directory location as present file. +include(${CMAKE_CURRENT_LIST_DIR}/export_plplot.cmake) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |