From: <ai...@us...> - 2014-05-14 05:36:28
|
Revision: 13115 http://sourceforge.net/p/plplot/code/13115 Author: airwin Date: 2014-05-14 05:36:26 +0000 (Wed, 14 May 2014) Log Message: ----------- Work around GTK+ pgk-config configuration issue where -lm is included in library flags for the Windows case when that math library does not separately exist on that platform. Modified Paths: -------------- trunk/cmake/modules/pkg-config.cmake trunk/cmake/modules/plplot.cmake Modified: trunk/cmake/modules/pkg-config.cmake =================================================================== --- trunk/cmake/modules/pkg-config.cmake 2014-04-30 08:10:03 UTC (rev 13114) +++ trunk/cmake/modules/pkg-config.cmake 2014-05-14 05:36:26 UTC (rev 13115) @@ -222,6 +222,16 @@ # (such as "-framework whatever") so preserve those by splitting into # separate list elements only if the next element starts with a hyphen. string(REGEX REPLACE " -" ";-" _link_flags_list "${_link_flags_in}") + if(NOT MATH_LIB) + # On systems (normally Windows) where MATH_LIB is not defined + # filter out -lm from link flags. This works around a pkg-config + # configuration bug on Windows for the GTK+ stack of libraries where + # -lm is supplied as a required library flag when that library does + # not exist on Windows platforms. + list(REMOVE_ITEM _link_flags_list "-lm") + endif(NOT MATH_LIB) + #message("_link_flags_list = ${_link_flags_list}") + # Extract list of directories from -L options. list(LENGTH _link_flags_list _link_flags_length) math(EXPR _link_flags_length "${_link_flags_length} - 1") @@ -236,11 +246,10 @@ endif(_list_element STREQUAL "-L${_list_element1}") endforeach(_list_index RANGE ${_link_flags_length}) #message("_index_list = ${_index_list}") - if("${_index_list}" STREQUAL "") - else("${_index_list}" STREQUAL "") + if(NOT "${_index_list}" STREQUAL "") # Remove -L options from list. list(REMOVE_AT _link_flags_list ${_index_list}) - endif("${_index_list}" STREQUAL "") + endif(NOT "${_index_list}" STREQUAL "") #message("_link_directory_list = ${_link_directory_list}") #message("_link_flags_list (without -L options) = ${_link_flags_list}") Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2014-04-30 08:10:03 UTC (rev 13114) +++ trunk/cmake/modules/plplot.cmake 2014-05-14 05:36:26 UTC (rev 13115) @@ -398,8 +398,21 @@ check_perl_modules(PERL_XML_PARSER XML::Parser) check_perl_modules(PERL_XML_DOM XML::DOM) endif(PERL_FOUND) - + # ======================================================================= +# MATH_LIB must be defined (or not) before pkg-config. +# ======================================================================= + +# On windows systems the math library is not separated so do not specify +# it unless you are on a non-windows system. +if(NOT WIN32_OR_CYGWIN) + find_library(MATH_LIB NAMES m PATHS /usr/local/lib /usr/lib) + if(NOT MATH_LIB) + message(FATAL_ERROR "Cannot find required math library") + endif(NOT MATH_LIB) +endif(NOT WIN32_OR_CYGWIN) + +# ======================================================================= # pkg-config support as well as macros to put link flags in standard # *.pc (pkg-config) form as well as standard fullpath form used by cmake. # ======================================================================= @@ -521,14 +534,6 @@ # Support for shapelib library for reading shapefile map data include(shapelib) include(freetype) -# On windows systems the math library is not separated so do not specify -# it unless you are on a non-windows system. -if(NOT WIN32_OR_CYGWIN) - find_library(MATH_LIB NAMES m PATHS /usr/local/lib /usr/lib) - if(NOT MATH_LIB) - message(FATAL_ERROR "Cannot find required math library") - endif(NOT MATH_LIB) -endif(NOT WIN32_OR_CYGWIN) # csiro must come after MATH_LIB is defined (or not). # csiro must come after c++ and fortran because of use of filter_rpath include(csiro) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |