I'm trying out my project on 3.3.0-rc1, but currently I'm using 2.8.11 and 
2.8.12.  I got  a couple errors from CMP0046.  Most of them are correct: I've 
fixed a couple places where a non-existent dependency was used, and I want to 
set this policy to NEW so that more do not sneak in.

However there is a problem. I have a test that dynamically loads a bunch of 
.so's, as configured by a .xml file to ensure they are compatible.  Some of the 
.so's are in the same project and some are from a different project and 
installed into the system at build time.  We are running tests as part of the 
make all target, (easy to do with a few add_custom_command/add_custom_target).  
The obvious problem is this test needs to have all the .so's built before the 
test runs, but it doesn't link them.  This was easy enough - I just parsed the 
.xml for the name of the .so and place that name into an add_dependencies. That 
works great in cmake 2.8.11.

In cmake 3.3.0-rc1 it doesn't work.  Some of the .so's are installed on the 
system and not built in the project.  Obviously no target exists for them. What 
I want to do to solve this is:

      cmake_policy(PUSH)
         if(POLICY CMP0046)
            CMAKE_POLICY(SET CMP0046 OLD)
          endif()
             add_dependencies(${MyTestRunTarget} ${XML_PARSED_DEPENDENCIES})
      cmake_policy(POP)

This does not work.  It appears that the policy is not actually checked until 
long after the add_dependencies line is done processing, and the fact that I 
want to suppress the policy for just these is not carried along.

Is there some way to achieve changing this policy for just a few select targets?


-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to