Hello,

I'm hacking on a CMake build system for Boost, and we'd like to
extract the Boost version number from our version header
(boost/version.hpp) so that we can use the version number within
CMake. Actually doing this is trivial:

file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/boost/version.hpp BOOST_VERSIONSTR
  REGEX "#define[ ]+BOOST_VERSION[ ]+[0-9]+")
string(REGEX MATCH "[0-9]+" BOOST_VERSIONSTR ${BOOST_VERSIONSTR})
if (BOOST_VERSIONSTR)
  math(EXPR BOOST_VERSION_MAJOR "${BOOST_VERSIONSTR} / 100000")
  math(EXPR BOOST_VERSION_MINOR "${BOOST_VERSIONSTR} / 100 % 1000")
  math(EXPR BOOST_VERSION_SUBMINOR "${BOOST_VERSIONSTR} % 100")
  set(BOOST_VERSION
"${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
endif()

However, we'd also like to force CMake to reconfigure when
boost/version.hpp changes. Is there some top-level target that we can
attach such a dependency to? e.g., I could imagine that there could
exist a cmake-cache target, such that we could add

  add_dependencies(cmake-cache ${CMAKE_CURRENT_SOURCE_DIR}/boost/version.hpp)

and then CMake would be re-run if boost/version.hpp changes. Does
something like this exist?

  - Doug
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to