[CMake] CMake Version Specific Code and Testing

Stephen McDowell sjm324 at cornell.edu
Tue Apr 3 12:38:13 EDT 2018


Hello,

Suppose I have a cmake_minimum_required(VERSION 2.8.12) project I would like to contribute to.

So when I am testing code for a v2.8.12 project, but my installed CMake version is say 3.10, if I (accidentally, or through ignorance) write code that would only work in CMake 3.x but not in 2.8.12, will the build fail or should I make sure to install 2.8.12 and test using that?

For example, my understanding is that for things like policies, I can do

if (POLICY CMP<NNNN>)
  cmake_policy(SET CMP<NNNN> NEW)
endif()

and this will mean that an older version of CMake running this code that does not know about policy NNNN will still work.  But if I ended up using an entirely new command that did not exist at the time of 2.8.12, but does exist in 3.10 of my installed CMake, should the build fail or succeed?

Thanks for any guidance, I’m sorry if this question doesn’t make any sense…

-Stephen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180403/d126aa7e/attachment.html>


More information about the CMake mailing list