From: <ai...@us...> - 2009-05-11 23:05:17
|
Revision: 9967 http://plplot.svn.sourceforge.net/plplot/?rev=9967&view=rev Author: airwin Date: 2009-05-11 23:05:09 +0000 (Mon, 11 May 2009) Log Message: ----------- Go back to Andrew's general fix for the possibility of debug or optimized keywords in library lists being exported to *.pc files since that is a better solution than mine which made some incorrect assumptions which could lead to problems on non-Linux platforms for -DCMAKE_BUILD_TYPE=Release. I have checked that with this fix, the configured plplotd-qt.pc files are identical for no specified CMAKE_BUILD_TYPE, -DCMAKE_BUILD_TYPE=Debug, and -DCMAKE_BUILD_TYPE=Release for my particular Qt4.5.1 installation where there is no real difference between the debug and optimized versions of the Qt4 libraries (as shown by the printed out QT_LIBRARIES variable). This result confirms the logic is working properly. Of course, for other Qt4 installations with real differences between debug and optimized, the configured plplotd-qt.pc file will depend on whether CMAKE_BUILD_TYPE is Debug or not. Modified Paths: -------------- trunk/cmake/modules/pkg-config.cmake trunk/cmake/modules/plplot.cmake trunk/cmake/modules/qt.cmake Modified: trunk/cmake/modules/pkg-config.cmake =================================================================== --- trunk/cmake/modules/pkg-config.cmake 2009-05-11 21:39:43 UTC (rev 9966) +++ trunk/cmake/modules/pkg-config.cmake 2009-05-11 23:05:09 UTC (rev 9967) @@ -102,21 +102,22 @@ # N.B. ${_link_flags_in} must be a string and not a list. # First strip out optimized / debug options which are not needed - # Currently only FindQt4 seems to need this so it is handled - # explicitly in the Qt code. - # Leave this for reference in case it turns out there is a more - # general need for it. - #if(CMAKE_BUILD_TYPE MATCHES "Debug") - # string(REGEX REPLACE "(^|;)optimized;[^;]*;" "\\1" ${_link_flags_out} "${_link_flags_in}") - # string(REGEX REPLACE "(^|;)debug;" "\\1" ${_link_flags_out} "${${_link_flags_out}}") - #else(CMAKE_BUILD_TYPE MATCHES "Debug") - # string(REGEX REPLACE "(^|;)debug;[^;]*;" "\\1" ${_link_flags_out} "${_link_flags_in}") - # string(REGEX REPLACE "(^|;)optimized;" "\\1" ${_link_flags_out} "${${_link_flags_out}}") - #endif(CMAKE_BUILD_TYPE MATCHES "Debug") + # Currently only FindQt4 seems to need this. + if(CMAKE_BUILD_TYPE MATCHES "Debug") + # Get rid of the optimized keyword and immediately following library as + # well as the debug keyword anywhere such patterns occur in the list. + string(REGEX REPLACE "(^|;)optimized;[^;]*;" "\\1" ${_link_flags_out} "${_link_flags_in}") + string(REGEX REPLACE "(^|;)debug;" "\\1" ${_link_flags_out} "${${_link_flags_out}}") + else(CMAKE_BUILD_TYPE MATCHES "Debug") + # Get rid of the debug keyword and immediately following library as + # well as the optimized keyword anywhere such patterns occur in the list. + string(REGEX REPLACE "(^|;)debug;[^;]*;" "\\1" ${_link_flags_out} "${_link_flags_in}") + string(REGEX REPLACE "(^|;)optimized;" "\\1" ${_link_flags_out} "${${_link_flags_out}}") + endif(CMAKE_BUILD_TYPE MATCHES "Debug") #message("(original link flags) = ${_link_flags_in}") # Convert link flags to a blank-delimited string. - string(REGEX REPLACE ";" " " ${_link_flags_out} "${_link_flags_in}") + string(REGEX REPLACE ";" " " ${_link_flags_out} "${${_link_flags_out}}") #message("(blanks) ${_link_flags_out} = ${${_link_flags_out}}") # Replace actual library names with the -LPATHNAME and -lLIBRARYNAME form Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-05-11 21:39:43 UTC (rev 9966) +++ trunk/cmake/modules/plplot.cmake 2009-05-11 23:05:09 UTC (rev 9967) @@ -28,7 +28,7 @@ include(CheckSymbolExists) include(CheckPrototypeExists) -# Useful macros.... +# Useful macros go here. macro(TRANSFORM_VERSION _numerical_result _version) # _version must be a period-delimited triplet string of the form @@ -46,30 +46,6 @@ endif(${_version} MATCHES "^[0-9]*\\.[0-9]*\\.[0-9]*$") endmacro(TRANSFORM_VERSION) -macro(split_libraries_list _list _list_general _list_debug _list_optimized) - # Macro for splitting a libraries list into its keyword denoted general, - # debug, and optimized lists. - set(${_list_general}) - set(${_list_debug}) - set(${_list_optimized}) - - set(_keyword "general") - foreach(_element ${${_list}}) - if(_element STREQUAL "general" OR _element STREQUAL "debug" OR _element STREQUAL "optimized" ) - set(_keyword ${_element}) - else(_element STREQUAL "general" OR _element STREQUAL "debug" OR _element STREQUAL "optimized" ) - if(_keyword STREQUAL "general") - list(APPEND ${_list_general} ${_element}) - elseif(_keyword STREQUAL "debug") - list(APPEND ${_list_debug} ${_element}) - elseif(_keyword STREQUAL "optimized") - list(APPEND ${_list_optimized} ${_element}) - endif(_keyword STREQUAL "general") - endif(_element STREQUAL "general" OR _element STREQUAL "debug" OR _element STREQUAL "optimized" ) - endforeach(_element) - -endmacro(split_libraries_list _list _list_general _list_debug _list_optimized) - # ======================================================================= # Compilation and build options (PLFLT, install locations, and rpath) # Note, must come before java since that depends on, e.g., LIB_DIR. Modified: trunk/cmake/modules/qt.cmake =================================================================== --- trunk/cmake/modules/qt.cmake 2009-05-11 21:39:43 UTC (rev 9966) +++ trunk/cmake/modules/qt.cmake 2009-05-11 23:05:09 UTC (rev 9967) @@ -52,39 +52,7 @@ set(qt_COMPILE_FLAGS "${qt_COMPILE_FLAGS} -I${DIR}") endforeach(DIR ${QT_INCLUDES}) - split_libraries_list(QT_LIBRARIES QT_LIBRARIES_general QT_LIBRARIES_debug QT_LIBRARIES_optimized) - - # There is a complicated interpretation issue to be considered here. - # FindQt4.cmake associates "debug" with the Qt4 library DEBUG suffix (with - # currently unknown criteria for which libraries are labelled that way), - # and "optimized" with the Qt4 library RELEASE suffix (again with - # currently unknown criteria). Furthermore, CMake documentation is - # is not completely clear on how the debug and optimized keywords are to - # be interpreted by target_link_libraries for the Debug, Release, - # RelWithDebInfo and MinSizeRes possibilities for CMAKE_BUILD_TYPE. For - # example with gcc, the C options are Debug=-g, Release=-O3, - # RelWithDebInfo = -g -O2, and MinSizeRes=-Os. For that compiler, some of - # the options are clearly debug (Debug), some of the options are clearly - # optimized (Release), but the rest are ambiguous. For now we will assign - # the ambiguous ones to debug, but we may change that interpretation - # in the future. It is also clear from analysis of FindQt4.cmake that any - # of QT_LIBRARIES_general, QT_LIBRARIES_debug, or QT_LIBRARIES_optimized - # could be empty depending on the Qt install and whether CMAKE_BUILD_TYPE - # is specified or not. Therefore, specifically deal with the empty cases. message(STATUS "QT_LIBRARIES = ${QT_LIBRARIES}") - if(CMAKE_BUILD_TYPE STREQUAL "Release" AND QT_LIBRARIES_optimized) - set(QT_LIBRARIES ${QT_LIBRARIES_optimized}) - elseif(QT_LIBRARIES_debug) - set(QT_LIBRARIES ${QT_LIBRARIES_debug}) - elseif(QT_LIBRARIES_general) - set(QT_LIBRARIES ${QT_LIBRARIES_general}) - else(CMAKE_BUILD_TYPE STREQUAL "Release" AND QT_LIBRARIES_optimized) - # This should be impossible because of the above check on QT_LIBRARIES - # being true (i.e., non-empty). - message(FATAL_ERROR "qt.cmake QT_LIBRARIES logic error") - endif(CMAKE_BUILD_TYPE STREQUAL "Release" AND QT_LIBRARIES_optimized) - message(STATUS "revised QT_LIBRARIES (based on keyword interpretation for -the CMAKE_BUILD_TYPE that is specified) = ${QT_LIBRARIES}") set(qt_LINK_FLAGS ${QT_LIBRARIES}) #message("qt_LINK_FLAGS = ${qt_LINK_FLAGS}") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |