MantisBT - CMake
View Issue Details
0016091CMakeCMakepublic2016-05-03 02:382016-06-10 14:31
LCID Fire 
Roger Leigh 
normalmajoralways
closedmoved 
PCWindows8.1
CMake 3.5.2 
 
0016091: RelWithDebInfo links Boost debug libraries
Since switching to 3.5, Boost is trying to link against
e.g. libboost_system-vc140-mt-gd-1_60.lib for RelWithDebInfo.
This of course fails because iterator level and other symbols differ.

Linker errors:
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in files.obj
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in files.obj
fatal error LNK1104: cannot open file 'libboost_filesystem-vc140-mt-1_60.lib'
Boost_DEBUG prints:
_boost_TEST_VERSIONS = 1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
Boost_USE_MULTITHREADED = ON
Boost_USE_STATIC_LIBS = ON
Boost_USE_STATIC_RUNTIME = OFF
Boost_ADDITIONAL_VERSIONS =
Boost_NO_SYSTEM_PATHS = ON
Declared as CMake or Environmental Variables:
  BOOST_ROOT =
  BOOST_INCLUDEDIR = C:/boost/lib
  BOOST_LIBRARYDIR = C:/boost/lib/lib64-msvc-14.0
_boost_TEST_VERSIONS = 1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
location of version.hpp: C:/boost/lib/boost/version.hpp
version.hpp reveals boost 1.60.0
guessed _boost_COMPILER = -vc140
_boost_MULTITHREADED = -mt
_boost_RELEASE_ABI_TAG = -
_boost_DEBUG_ABI_TAG = -gd
_boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH_boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Searching for FILESYSTEM_LIBRARY_RELEASE: libboost_filesystem-vc140-mt-1_60;libboost_filesystem-vc140-mt;libboost_filesystem-mt-1_60;libboost_filesystem-mt;libboost_filesystem
 Boost_LIBRARY_DIR_RELEASE = C:/boost/lib/lib64-msvc-14.0 _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc140-mt-gd-1_60;libboost_filesystem-vc140-mt-gd;libboost_filesystem-mt-gd-1_60;libboost_filesystem-mt-gd;libboost_filesystem-mt;libboost_filesystem
 Boost_LIBRARY_DIR_DEBUG = C:/boost/lib/lib64-msvc-14.0 _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-vc140-mt-1_60;libboost_system-vc140-mt;libboost_system-mt-1_60;libboost_system-mt;libboost_system
 Boost_LIBRARY_DIR_RELEASE = C:/boost/lib/lib64-msvc-14.0 _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Searching for SYSTEM_LIBRARY_DEBUG: libboost_system-vc140-mt-gd-1_60;libboost_system-vc140-mt-gd;libboost_system-mt-gd-1_60;libboost_system-mt-gd;libboost_system-mt;libboost_system
 Boost_LIBRARY_DIR_DEBUG = C:/boost/lib/lib64-msvc-14.0 _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/boost/lib/lib64-msvc-14.0;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
Boost_FOUND = 1
No tags attached.
Issue History
2016-05-03 02:38LCID FireNew Issue
2016-05-03 06:28LCID FireNote Added: 0041015
2016-05-03 07:27LCID FireNote Added: 0041016
2016-05-03 08:17Brad KingAssigned To => Roger Leigh
2016-05-03 08:17Brad KingStatusnew => assigned
2016-05-03 08:18Brad KingNote Added: 0041018
2016-05-03 08:23Brad KingNote Added: 0041019
2016-06-10 14:29Kitware RobotNote Added: 0042996
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0041015)
LCID Fire   
2016-05-03 06:28   
The example:

find_package(Boost 1.56 REQUIRED COMPONENTS
             date_time filesystem iostreams)
add_executable(foo foo.cc)
target_link_libraries(foo Boost::date_time Boost::filesystem
                          Boost::iostreams)

Does not seem to work with RelWithDebInfo. The new imported targets seem invalid for that configuration.
(0041016)
LCID Fire   
2016-05-03 07:27   
Adding:
get_property( BLUB TARGET Boost::filesystem PROPERTY IMPORTED_LOCATION_RELEASE)
set_property( TARGET Boost::filesystem PROPERTY IMPORTED_LOCATION_RELWITHDEBINFO ${BLUB} )

after find_package( Boost )
fixes the problem. In general it seems the way FindBoost sets up the imported targets is insufficient.
(0041018)
Brad King   
2016-05-03 08:18   
For reference, the imported targets were added here:

 FindBoost: Add imported targets
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f9b081f [^]
(0041019)
Brad King   
2016-05-03 08:23   
Another approach may be to set the MAP_IMPORTED_CONFIG_RELWITHDEBINFO target property to map it to one of the other imported configurations:

 https://cmake.org/cmake/help/v3.5/prop_tgt/MAP_IMPORTED_CONFIG_CONFIG.html [^]
 https://cmake.org/cmake/help/v3.5/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG.html [^]

This is meant specifically for the case when the current project has a different set of configurations than the imported project built with. However, it is also meant to be set by project code and not by the creator of the imported target.

FindBoost may need to be taught to populate the RelWithDebInfo configuration itself. This convention may then need to be propagated to all the other find modules that provide imported targets.
(0042996)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.