On 06/18/2016 12:18 PM, Nils Gladitz wrote:
On 18.06.2016 11:38, Alexander Shukaev wrote:
I did try both variants, after and before
cmake_minimum_required(VERSION)
but the result is the same. The scope is for sure parent to targets.
I don't know what else it could be but this works fine for me:
cmake_minimum_required(VERSION 2.8.12)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
file(WRITE foo.cpp "int main() {}")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
add_executable(foo foo.cpp)
Is it possible that the scope where the policy warning comes from has
its own cmake_minimum_required(VERSION) call? (e.g. is there more than
one?)
Nils
You were right, Nils. I have a CMake library that is pretty huge. When
one does `find_package' for it, then it will `include' all its modules
into the client code. Back when I started it, I didn't know that
`cmake_minimum_required' can reset policies. So there were a couple of
modules that were still calling `cmake_minimum_required' which is
clearly a bad practice. I cleaned it up and it works now.
However, now the sequence is like this
xxx.cmake:
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif()
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
CMakeLists.txt:
include(xxx)
cmake_minimum_required(VERSION 3.1.0)
and it still works. Is it because the version is high enough so it does
not reset policies?
Alexander
--
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