ycm-cmake-modules icon indicating copy to clipboard operation
ycm-cmake-modules copied to clipboard

FindOrBuildPackage should check the version all the times

Open drdanz opened this issue 11 years ago • 0 comments

  • On the system you have version 1.0 of the package X
  • Module A requires X version 1.0
  • Module B requires X version 1.0
  • Module C requires X version 2.0
  • Module D requires X version 1.0

Assuming that the config files for package X are written properly, CMakeLists.txt will be something like this:

  find_or_build_package(A) # -> will call BuildA.cmake
  find_or_build_package(B) # -> will call BuildB.cmake
  find_or_build_package(C) # -> will call BuildC.cmake
  find_or_build_package(D) # -> will call BuildD.cmake

Build{A,B,D}.cmake will have a line:

  find_or_build_package(X 1.0)

BuildB.cmake will have a line:

  find_or_build_package(X 2.0)

What I expect is that at configure time

  • BuildA.cmake calls find_or_build_package(X 1.0).
  • find_or_build_package(X 1.0) will find X version 1.0 and will be happy and mark the X version 1.0 as available on the system
  • BuildB.cmake calls find_or_build_package(X 1.0).
  • find_or_build_package(X 1.0) should know that a version is available, check the version and since 1.0 is ok, will do nothing.
  • BuildC.cmake calls find_or_build_package(X 2.0).
  • find_or_build_package(X 2.0) should know that a version is already available, but should still check the version, and since 1.0 is not compatible will mark the X version 2.0 as built by the superbuild
  • BuildD.cmake calls find_or_build_package(X 1.0).
  • find_or_build_package(X 1.0) should know that a version is available, and since this version is built by the superbuild will assume that this version is ok, and will do nothing (if 1.0 and 2.0 are not compatible this should be handled in some other way i.e. considering X version 1.0 and X version 2.0 as 2 different packages X1 and X2, and this is not part of this issue).

Unfortunately, in the configure phase the version is checked only the first time, the other will assume that the version found is ok.

drdanz avatar May 23 '14 15:05 drdanz