CheckCmakeCompat.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Central location to check for cmake (version) requirements
  2. #
  3. #=============================================================================
  4. # Copyright 2012 Bernhard Miklautz <bernhard.miklautz@thincast.com>
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #=============================================================================
  18. macro(enable_cmake_compat CMVERSION)
  19. if(${CMAKE_VERSION} VERSION_LESS ${CMVERSION})
  20. LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/compat_${CMVERSION}/")
  21. endif()
  22. endmacro()
  23. # Compatibility includes - order does matter!
  24. enable_cmake_compat(3.7.0)
  25. enable_cmake_compat(2.8.11)
  26. enable_cmake_compat(2.8.6)
  27. enable_cmake_compat(2.8.3)
  28. enable_cmake_compat(2.8.2)
  29. # GetGitRevisionDescription requires FindGit which was added in version 2.8.2
  30. # build won't fail but GIT_REVISION is set to n/a
  31. if(${CMAKE_VERSION} VERSION_LESS 2.8.2)
  32. message(WARNING "GetGitRevisionDescription reqires (FindGit) cmake >= 2.8.2 to work properly - GIT_REVISION will be set to n/a")
  33. endif()
  34. # Since cmake 2.8.9 modules/library names without lib/.so can be used
  35. # for dependencies
  36. if(IOS AND ${CMAKE_VERSION} VERSION_LESS 2.8.9)
  37. message(FATAL_ERROR "CMAKE version >= 2.8.9 required to build the IOS client")
  38. endif()