MantisBT - CMake
View Issue Details
0014630CMakeCMakepublic2013-12-04 06:292014-06-02 08:39
breese 
Rolf Eike Beer 
normalminoralways
closedunable to reproduce 
UbuntuLinux3.11.0-14
CMake 2.8.11.2 
 
0014630: FindBZip2 finds bzip2 without header file
The bzip2 package contains the libraries, but not the header files. The header files are located in the libbz2-dev package. If you only have installed the bzip2 package, but not the libbz2-dev package, FindBZip2 will report bzip2 as found and provide the include directory.

The problem is due to an incorrect use of FIND_PACKAGE_HANDLE_STANDARD_ARGS(), which is missing the DEFAULT_MSG argument. The attached patch fixes the problem.
No tags attached.
diff FindBZip2.diff (594) 2013-12-04 06:30
https://public.kitware.com/Bug/file/5001/FindBZip2.diff
diff FindBZip2-b.diff (612) 2013-12-05 03:13
https://public.kitware.com/Bug/file/5003/FindBZip2-b.diff
Issue History
2013-12-04 06:29breeseNew Issue
2013-12-04 06:30breeseFile Added: FindBZip2.diff
2013-12-04 08:23Brad KingNote Added: 0034707
2013-12-04 08:23Brad KingAssigned To => Brad King
2013-12-04 08:23Brad KingStatusnew => resolved
2013-12-04 08:23Brad KingResolutionopen => fixed
2013-12-04 08:23Brad KingFixed in Version => CMake 3.0
2013-12-04 08:23Brad KingTarget Version => CMake 3.0
2013-12-04 09:31Brad KingAssigned ToBrad King => Rolf Eike Beer
2013-12-04 09:31Brad KingStatusresolved => assigned
2013-12-04 09:31Brad KingResolutionfixed => open
2013-12-04 09:31Brad KingFixed in VersionCMake 3.0 =>
2013-12-04 11:20Brad KingNote Added: 0034710
2013-12-05 03:12breeseNote Added: 0034718
2013-12-05 03:13breeseFile Added: FindBZip2-b.diff
2013-12-05 11:00Brad KingNote Added: 0034721
2013-12-05 14:51Rolf Eike BeerNote Added: 0034729
2014-01-27 13:52Brad KingStatusassigned => resolved
2014-01-27 13:52Brad KingResolutionopen => unable to reproduce
2014-01-27 13:52Brad KingTarget VersionCMake 3.0 =>
2014-06-02 08:39Robert MaynardNote Added: 0036095
2014-06-02 08:39Robert MaynardStatusresolved => closed

Notes
(0034707)
Brad King   
2013-12-04 08:23   
Applied, thanks!

FindBZip2: Require header to be found
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6d073a9 [^]
(0034710)
Brad King   
2013-12-04 11:20   
Eike pointed out that the proposed patch mixes the FPHSA signatures. Reverting for now:

 Revert "FindBZip2: Require header to be found"
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93c2734e [^]
(0034718)
breese   
2013-12-05 03:12   
Is the second patch (FindBZip2-b.diff) better?
(0034721)
Brad King   
2013-12-05 11:00   
Actually the current FPHSA call looks correct and is the same as in many other modules.

I cannot even reproduce the reported issue:

$ apt-cache policy bzip2
bzip2:
  Installed: 1.0.6-5
  Candidate: 1.0.6-5

$ apt-cache policy libbz2-dev
libbz2-dev:
  Installed: (none)
  Candidate: 1.0.6-5

$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
project(Issue14630 C)
find_package(BZip2)
foreach(v BZIP2_FOUND BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
  message(STATUS "${v}=[${${v}}]")
endforeach()

$ cmake --version
cmake version 2.8.12.1

$ cmake ..
...
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- BZIP2_FOUND=[FALSE]
-- BZIP2_LIBRARIES=[BZIP2_LIBRARY-NOTFOUND]
-- BZIP2_INCLUDE_DIR=[BZIP2_INCLUDE_DIR-NOTFOUND]
...

Even if I fake the library location it still fails on the headers:

$ cmake .. -DBZIP2_LIBRARY_RELEASE=/usr/lib/x86_64-linux-gnu/libz.so
...
-- Could NOT find BZip2 (missing: BZIP2_INCLUDE_DIR)
-- BZIP2_FOUND=[FALSE]
-- BZIP2_LIBRARIES=[/usr/lib/x86_64-linux-gnu/libz.so]
-- BZIP2_INCLUDE_DIR=[BZIP2_INCLUDE_DIR-NOTFOUND]
...
(0034729)
Rolf Eike Beer   
2013-12-05 14:51   
This is also the result from my testing: it just works when the header is there or not. So please test again with the example CMakeLists.txt from Brad.
(0036095)
Robert Maynard   
2014-06-02 08:39   
Closing resolved issues that have not been updated in more than 4 months.