Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,297
    • Issues 3,297
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21394

Closed
Open
Created Nov 04, 2020 by Arno Mayrhofer@arnom

FindBoost fails to find static debug libraries

When building boost as static library with debug flags your libraries will be compiled with name e.g.: libboost_filesystem-vc140-mt-sgd-x64-1_71.lib

Note in particular the -sgd- in the name.

When running FindBoost with Boost_DEBUG enabled you get the following output:

Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc140-mt-gd-x64-1_71;libboost_filesystem-vc140-mt-gd-x64;libboost_filesystem-vc140-mt-gd;libboost_filesystem-mt-gd-x64-1_71;libboost_filesystem-mt-gd-x64;libboost_filesystem-mt-gd;libboost_filesystem-mt;libboost_filesystem;libboost_filesystem-vc140-mt-s-gd-x64-1_71;libboost_filesystem-vc140-mt-s-gd-x64;libboost_filesystem-vc140-mt-s-gd;libboost_filesystem-mt-s-gd-x64-1_71;libboost_filesystem-mt-s-gd-x64;libboost_filesystem-mt-s-gd

In particular note the libboost_filesystem-vc140-mt-s-gd-x64-1_71 which is correct except for the dash between s-gd.

If I specify Boost_USE_STATIC_RUNTIME everything works and the -sgd- version is found (and listed in the Searching ... output).

If this parameter is not set the workaround in line 2111 is used. Since _boost_DEBUG_ABI_TAG contains a - already this goes bad so instead of

set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")

we should have something like

string(SUBSTRING ${_boost_DEBUG_ABI_TAG} 1 -1 _boost_DEBUG_ABI_TAG_NO_DASH)
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG_NO_DASH}")

Note, this is untested and might need a guard against zero length _boost_DEBUG_ABI_TAG.

Cheers, Arno

Edited Nov 04, 2020 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None