Hi David,

See my remarks inline.

On 15/12/12 16:47, David Cole wrote:
On Sat, Dec 15, 2012 at 10:33 AM, Marcel Loose <marcel.lo...@zonnet.nl <mailto:marcel.lo...@zonnet.nl>> wrote:

    Thanks, that seems to work.

    Is the idiom

        if(POLICY CMP<NNNN>)
          cmake_policy(PUSH)
          cmake_policy(SET CMP<NNNN> OLD)
          cmake_policy(POP)
        endif()

    one that you also need to use with newer CMakes? Or does it then
    suffice to do

        cmake_policy(SET CMP<NNNN> OLD)


I assume you really mean:

if(POLICY CMP<NNNN>)
  cmake_policy(PUSH)
  cmake_policy(SET CMP<NNNN> OLD)
endif()

...
other code where the policy is set to OLD
...

if(POLICY CMP<NNNN>)
  cmake_policy(POP)
endif()

Yes, you're right. I was oversimplifying.

The policies are tightly tied to the minimum required version of CMake. So if you use cmake_minimum_required with a certain version number, you can write code without if(POLICY assuming that all the policies you need to set are known as of that minimum version. If they are not (and they must not be in this particular case), then you'll need the if(POLICY construct.

So, that basically means that you need to use if(POLICY...) for all policies that are not part of the minimum required version? Is there a way to find out which policies exist for which version of CMake?

I was hoping for a more forward compatible solution. In other words, I was hoping that I could always use CMAKE_POLICY(SET...) unconditionally. It's a bit of a shame that I have to clutter my CMakeLists.txt and *.cmake files with these extra conditionals; and have to remove them (or should I say: clean up) whenever I bump the minimum required version.

What's the reason that cmake doesn't silently ignore a CMAKE_POLICY(SET...) for a policy it doesn't know about?

The other option is to bump up your minimum required version.
Sure, but that defeats the whole purpose of setting a minimum required version. I need to be compatible with version 2.6.2.

Best regards,
Marcel Loose.

<<attachment: loose.vcf>>

--

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