You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OvLinkBoostLib.cmake 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #
  2. # Win32 only
  3. #
  4. # This concoction mainly exists to locate the boost libraries on WIN32 in the case where our dependency/ folder has only a
  5. # truncated version of boost and we cannot use find_package(). The background story is that we wish to link explicitly
  6. # instead of using automatic linking and specifying a generic boost path to linker before each project definition.
  7. #
  8. # The downside of this is that it assumes the boost library names to have a particular format and only works for VC90/VC100
  9. #
  10. # Function: Links specified boost library defined by COMPONENT and BOOST_VERSION to PROJECT_NAME.
  11. #
  12. FUNCTION(OV_LINK_BOOST_LIB BOOST_COMPONENT BOOST_VERSION)
  13. IF(WIN32)
  14. IF(MSVC)
  15. IF(MSVC_VERSION EQUAL 1500) # vc9
  16. SET(LIB_BOOST "libboost_${BOOST_COMPONENT}-vc90-mt-${BOOST_VERSION}.lib")
  17. SET(LIB_BOOST_DEBUG "libboost_${BOOST_COMPONENT}-vc90-mt-gd-${BOOST_VERSION}.lib")
  18. ELSEIF(MSVC_VERSION EQUAL 1600) # vc 10
  19. SET(LIB_BOOST "libboost_${BOOST_COMPONENT}-vc100-mt-${BOOST_VERSION}.lib")
  20. SET(LIB_BOOST_DEBUG "libboost_${BOOST_COMPONENT}-vc100-mt-gd-${BOOST_VERSION}.lib")
  21. ELSEIF(MSVC_VERSION EQUAL 1700) # vc 11
  22. SET(LIB_BOOST "libboost_${BOOST_COMPONENT}-vc110-mt-${BOOST_VERSION}.lib")
  23. SET(LIB_BOOST_DEBUG "libboost_${BOOST_COMPONENT}-vc110-mt-gd-${BOOST_VERSION}.lib")
  24. ELSEIF(MSVC_VERSION EQUAL 1800) # vc12
  25. SET(LIB_BOOST "libboost_${BOOST_COMPONENT}-vc120-mt-${BOOST_VERSION}.lib")
  26. SET(LIB_BOOST_DEBUG "libboost_${BOOST_COMPONENT}-vc120-mt-gd-${BOOST_VERSION}.lib")
  27. ENDIF(MSVC_VERSION EQUAL 1500)
  28. ENDIF(MSVC)
  29. SET(LIB_BOOST_PATH "-NOTFOUND")
  30. FIND_LIBRARY(LIB_BOOST_PATH NAMES ${LIB_BOOST} PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost/lib NO_DEFAULT_PATH)
  31. IF(LIB_BOOST_PATH)
  32. debug_message( " [ OK ] lib ${LIB_BOOST_PATH}")
  33. IF(TARGET ${PROJECT_NAME})
  34. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${LIB_BOOST_PATH})
  35. ENDIF()
  36. ELSE(LIB_BOOST_PATH)
  37. MESSAGE(WARNING " Unable to find boost ${LIB_BOOST}")
  38. ENDIF(LIB_BOOST_PATH)
  39. SET(LIB_BOOST_DEBUG_PATH "-NOTFOUND")
  40. FIND_LIBRARY(LIB_BOOST_DEBUG_PATH NAMES ${LIB_BOOST_DEBUG} PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/boost/lib NO_DEFAULT_PATH)
  41. IF(LIB_BOOST_DEBUG_PATH)
  42. debug_message( " [ OK ] lib ${LIB_BOOST_DEBUG_PATH}")
  43. IF(TARGET ${PROJECT_NAME})
  44. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${LIB_BOOST_DEBUG_PATH})
  45. ENDIF()
  46. ELSE(LIB_BOOST_DEBUG_PATH)
  47. MESSAGE(WARNING " Unable to find boost ${LIB_BOOST_DEBUG}")
  48. ENDIF(LIB_BOOST_DEBUG_PATH)
  49. ENDIF(WIN32)
  50. ENDFUNCTION(OV_LINK_BOOST_LIB)