[cmake-developers] [CMake 0015364]: FindBoost.cmake does not find debug libraries if they are located in a different directory than the release libraries

Mantis Bug Tracker mantis at public.kitware.com
Thu Jan 22 07:55:54 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15364 
====================================================================== 
Reported By:                Gunther Laure
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15364
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-01-22 07:55 EST
Last Modified:              2015-01-22 07:55 EST
====================================================================== 
Summary:                    FindBoost.cmake does not find debug libraries if
they are located in a different directory than the release libraries
Description: 
FindBoost.cmake does not find debug libraries if they are located in a different
directory than the release libraries.

Assume following boost lib dir layout:

lib/shared/Debug
lib/shared/Release
lib/static/Debug
lib/static/Release
lib64/shared/Debug
lib64/shared/Release
lib64/static/Debug
lib64/static/Release

For previous cmake version we changed changed the CMAKE_LIBRARY_PATH (depending
on x86,x64,Release,Debug) so that FindBoost did find the correct libraries.

The current version of FindBoost.cmake assumes that Debug and Release have to be
in the same directoy.

This is done in the macro _Boost_FIND_LIBRARY (line 323-325):
  # If Boost_LIBRARY_DIR is known then search only there.
  if(Boost_LIBRARY_DIR)
    set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
  endif()


Commenting/Removing these lines restores the previous behaviour and Release and
Debug libraries are found again.


Steps to Reproduce: 

create a directory structure like that:
lib/Debug
lib/Release

and put valid boost libs in there:
lib/Debug/boost_system-vc120-mt-gd-1_55.lib
lib/Release/boost_system-vc120-mt-1_55.lib

With CMAKE_LIBRARY_PATH set to both directories and the current version of cmake
(3.1) 
find_package(Boost REQUIRED COMPONENTS
  system
)
will result in:
Boost_SYSTEM_LIBRARY = lib/Release/boost_system-vc120-mt-1_55.lib


with the lines 323 to 325 commented in FindBoost.cmake it will find both libs:
Boost_SYSTEM_LIBRARY =
optimized;lib/Release/boost_system-vc120-mt-1_55.lib;debug;lib/Debug/boost_system-vc120-mt-gd-1_55.lib
(absolute path removed manually)



Additional Information: 
If this is only an issue for us, we could workaround the problem with a
customized FindBoost.cmake file in our environment.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-01-22 07:55 Gunther Laure  New Issue                                    
======================================================================



More information about the cmake-developers mailing list