MantisBT - CMake
View Issue Details
0014012CMakeModulespublic2013-03-14 12:012015-01-05 08:39
Orion Poplawski 
Brad King 
normalminoralways
closedfixed 
CMake 2.8.10.2 
CMake 3.1CMake 3.1 
0014012: FindImageMagick.cmake needs update for ImageMagick >= 6.8.0-8, perhaps use pkgconfig
    From ImageMagick's 6.8.0-8 changelog:

  ABI is incompatible if quantum depth change. Add abi indication to library
  name, thanks to Bastien Roucaries (reference
  http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=22352 [^] [^]).

The library names now include a new suffix, either -6.Q8 or -6.Q16 (maybe others too?), depending on the quantum depth ImageMagick was compiled with.

For example on Fedora Linux we have the following library name changes:

/usr/lib/libMagick++.so.5 => /usr/lib/libMagick++-6.Q16.so.1
/usr/lib/libMagickCore.so.5 => /usr/lib/libMagickCore-6.Q16.so.1
/usr/lib/libMagickWand.so.5 => /usr/lib/libMagickWand-6.Q16.so.1


I think FindImageMagick really should be using pkgconfig instead of hacks to search for possible names.
No tags attached.
related to 0013859closed Brad King FindImageMagick.cmake needs update for ImageMagick >= 6.8.0-8 
related to 0014174closed Brad King FindImageMagick.cmake does not find new imagemagick include dir 
related to 0015007closed Kitware Robot FindImageMagick detection broken with multi-arch imagemagick, need CFLAGS from pkgconfig 
patch cmake-2.8.11-rc1-IM_pkgconfig_hints.patch (2,294) 2013-03-16 21:28
https://public.kitware.com/Bug/file/4684/cmake-2.8.11-rc1-IM_pkgconfig_hints.patch
patch cmake-2.8.11-rc1-IM_pkgconfig_hints-2.patch (2,578) 2013-03-18 10:23
https://public.kitware.com/Bug/file/4687/cmake-2.8.11-rc1-IM_pkgconfig_hints-2.patch
patch 0001-FindImageMagick-Use-pkgconfig-hints-if-available-14012.patch (1,735) 2014-07-07 09:53
https://public.kitware.com/Bug/file/5186/0001-FindImageMagick-Use-pkgconfig-hints-if-available-14012.patch
Issue History
2013-03-14 12:01Orion PoplawskiNew Issue
2013-03-14 13:23Brad KingRelationship addedrelated to 0013859
2013-03-14 13:26Brad KingNote Added: 0032631
2013-03-14 13:26Brad KingSeveritymajor => minor
2013-03-14 13:26Brad KingStatusnew => backlog
2013-03-16 21:28Rex DieterFile Added: cmake-2.8.11-rc1-IM_pkgconfig_hints.patch
2013-03-16 21:31Rex DieterNote Added: 0032652
2013-03-18 09:02Brad KingNote Added: 0032654
2013-03-18 10:23Rex DieterFile Added: cmake-2.8.11-rc1-IM_pkgconfig_hints-2.patch
2013-03-18 10:23Rex DieterNote Added: 0032655
2013-03-18 11:10Brad KingNote Added: 0032657
2013-03-18 11:15Orion PoplawskiNote Added: 0032658
2013-03-18 11:41Orion PoplawskiNote Added: 0032660
2013-03-18 12:12Orion PoplawskiNote Added: 0032661
2013-03-18 12:33Brad KingNote Added: 0032662
2013-03-18 12:34Brad KingNote Added: 0032663
2013-03-18 12:36Orion PoplawskiNote Added: 0032664
2013-03-18 16:41Brad KingNote Added: 0032668
2013-05-28 09:43Brad KingRelationship addedrelated to 0014174
2014-07-07 09:27Brad KingRelationship addedrelated to 0015007
2014-07-07 09:53Brad KingFile Added: 0001-FindImageMagick-Use-pkgconfig-hints-if-available-14012.patch
2014-07-07 09:54Brad KingNote Added: 0036320
2014-07-12 16:13broucariNote Added: 0036356
2014-07-14 15:05Brad KingNote Added: 0036377
2014-07-14 15:06Brad KingAssigned To => Brad King
2014-07-14 15:06Brad KingStatusbacklog => resolved
2014-07-14 15:06Brad KingResolutionopen => fixed
2014-07-14 15:06Brad KingFixed in Version => CMake 3.1
2014-07-14 15:06Brad KingTarget Version => CMake 3.1
2014-07-14 15:07Brad KingNote Added: 0036378
2015-01-05 08:39Robert MaynardNote Added: 0037584
2015-01-05 08:39Robert MaynardStatusresolved => closed

Notes
(0032631)
Brad King   
2013-03-14 13:26   
Our policy for find module maintenance is here:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]

If you would like to implement the proposed pkgconfig functionality we welcome the contribution.

Of course the "C" in CMake stands for "cross-platform" and pkgconfig does not work on all Windows toolchains so if ImageMagick supports Windows there still needs to be a way to work without pkgconfig.
(0032652)
Rex Dieter   
2013-03-16 21:31   
cmake-2.8.11-rc1-IM_pkgconfig_hints.patch is a first draft if adding pkg-config hints as well as searching for new 6.<quantum> style libraries.

Probably would to conditionalize the pkgconfig support for certain platforms (wrapped in 'if (NOT WIN32)' ... ), but hopefully you get the idea.
(0032654)
Brad King   
2013-03-18 09:02   
Re 0014012:0032652: Thanks, that looks like a good start. I do not think we need a platform conditional, my request in 0014012:0032631 was simply that it also work without pkgconfig.

In order to be sure the PKG_CHECK_MODULES macro is available one must first find_package(PkgConfig QUIET). See Modules/FindLibXml2.cmake for an example.
(0032655)
Rex Dieter   
2013-03-18 10:23   
Great, iteration 2, cmake-2.8.11-rc1-IM_pkgconfig_hints-2.patch
adds find_package(PkgConfig QUIET)
(0032657)
Brad King   
2013-03-18 11:10   
Re 0014012:0032655: Thanks. Orion, does Rex's patch work for you? Please also try it with the hard-coded name combinations commented out so you know it is pkgconfig that works.
(0032658)
Orion Poplawski   
2013-03-18 11:15   
Brad - Rex is building the Fedora cmake package with this patch, so we are doing our testing there, and Rex can speak for me about whether this is fixed or not. So far so good it seems though. I'll try to do a test with the name search commented out soon.
(0032660)
Orion Poplawski   
2013-03-18 11:41   
So, the pkgconfig patch really isn't doing much to help find the name for the library other than telling us *where* to look.

We'd need to somehow parse:

# pkg-config MagickCore --libs
-lm -lMagickCore-6.Q16

to extract the name to do that. Brad - any suggestions here?
(0032661)
Orion Poplawski   
2013-03-18 12:12   
I've posted this: http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=22986 [^] to see if we can get ImageMagick to export a library name.
(0032662)
Brad King   
2013-03-18 12:33   
If ImageMagick is willing to become CMake-aware they could provide a package configuration file:

 http://www.cmake.org/Wiki/CMake/Tutorials/Packaging [^]

even if they don't build with CMake. That would allow find_package to work even without a find module.

Qt5 does this for example.
(0032663)
Brad King   
2013-03-18 12:34   
Re 0014012:0032660: I'm not particularly familiar with CMake's PkgConfig API so I don't know whether it already has something for parsing library names.
(0032664)
Orion Poplawski   
2013-03-18 12:36   
I passed your CMake configuration file suggestion on in my thread as well. Good idea!
(0032668)
Brad King   
2013-03-18 16:41   
Regardless of how future suffixes are detected (pkgconfig or upstream help) we still need to detect the existing versions. I've taken that part of Rex's patch:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbd895b8 [^]
(0036320)
Brad King   
2014-07-07 09:54   
I've split what remains of Rex's patch out as attachment "0001-FindImageMagick-Use-pkgconfig-hints-if-available-14012.patch".

According to 0015007 it looks like it may be necessary to use pkgconfig to get CFLAGS in some cases.
(0036356)
broucari   
2014-07-12 16:13   
No the problem is more than cflags. You need to check arch include dir also
(0036377)
Brad King   
2014-07-14 15:05   
After the report in 0015007:0036375 I've applied the rest of Rex's patch:

 FindImageMagick: Use pkgconfig hints if available
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90245fe8 [^]
(0036378)
Brad King   
2014-07-14 15:07   
The remaining issue is to use the CFLAGS, and issue 0015007 covers that, so I've resolved this issue.
(0037584)
Robert Maynard   
2015-01-05 08:39   
Closing resolved issues that have not been updated in more than 4 months