[CMake] FindBoost.cmake trouble with static libs (-gd vs -sgd issue)

Dixon, Shane Shane.Dixon at atmel.com
Thu Sep 2 16:08:12 EDT 2010


I found that when using the FindBoost.cmake and using the Boost_USE_STATIC_LIBS option, it wouldn't find the static libs in my C:\Boost\libs folder.  It kept coming back with files ending in -gd libs instead of -sgd libs even though the option Boost_USE_STATIC_LIBS was set.  I found that it had to do with the order that the FIND_LIBRARY looks for the files.  I had BOTH the -gd and the -sgd libraries installed so it found the -gd ones first and then ignores the next option.  I fixed it by applying the following:

 

 

728,729c728,729

<         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}

<                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}

---

>         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}

>                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}

 

I just switched the order to look for the more specific lib before the more general one.  If ${_boost_STATIC_TAG} is empty when Boost_USE_STATIC_LIBS is OFF, then maybe this could just be one line:

 

${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}

 

Which seems like it should find either -sgd or -gd files, but sould find -sgd files first if the option was provided.  Any thoughts?  I defer to anyone with more experience for the best way to do this.

 

--

Shane

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100902/dfb8d9a2/attachment-0001.htm>


More information about the CMake mailing list