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.

43 lines
1.6 KiB

2 months ago
  1. set( Boost_Bootstrap_Command )
  2. if( UNIX )
  3. set( Boost_Bootstrap_Command ./bootstrap.sh )
  4. set( Boost_b2_Command ./b2 )
  5. elseif( WIN32 )
  6. set( Boost_Bootstrap_Command ${CMAKE_COMMAND} -E env "VSCMD_START_DIR=<BUILD_DIR>" .\\bootstrap.bat )
  7. set( Boost_b2_Command b2.exe )
  8. endif()
  9. string(REPLACE "." "_" BOOST_VERSION_FILENAME ${Boost_VERSION})
  10. set(BOOST_OPTIONS --without-mpi --without-python --without-random --without-regex --without-serialization --without-wave)
  11. ExternalProject_Add(
  12. Boost-EP
  13. URL https://sourceforge.net/projects/boost/files/boost/${Boost_VERSION}/boost_${BOOST_VERSION_FILENAME}.zip/download
  14. URL_MD5 ${Boost_ZIPHASH}
  15. BUILD_IN_SOURCE 1
  16. DOWNLOAD_NO_PROGRESS 1
  17. UPDATE_COMMAND ""
  18. PATCH_COMMAND ""
  19. CONFIGURE_COMMAND ${Boost_Bootstrap_Command}
  20. BUILD_COMMAND ${Boost_b2_Command} -s NO_BZIP2=1 --variant=release headers
  21. INSTALL_COMMAND ${Boost_b2_Command} -d0 -s NO_BZIP2=1 --variant=release ${BOOST_OPTIONS} install --prefix=<INSTALL_DIR>
  22. )
  23. ExternalProject_Get_Property(Boost-EP INSTALL_DIR)
  24. set(shared_libs)
  25. set(static_libs)
  26. foreach(component ${BOOST_COMPONENTS})
  27. list(APPEND shared_libs "${INSTALL_DIR}/lib/libboost_${component}${DYNAMIC_EXT}")
  28. list(APPEND static_libs "${INSTALL_DIR}/lib/libboost_${component}${STATIC_EXT}")
  29. endforeach()
  30. add_imported_library(Boost SHARED "${shared_libs}" "${INSTALL_DIR}/include" ${BOOST_COMPONENTS})
  31. add_imported_library(Boost STATIC "${static_libs}" "${INSTALL_DIR}/include" ${BOOST_COMPONENTS})
  32. unset(shared_libs)
  33. unset(static_libs)
  34. add_dependencies(Boost_SHARED Boost-EP)
  35. add_dependencies(Boost_STATIC Boost-EP)
  36. add_dependencies(resources Boost_SHARED Boost_STATIC)