4
votes

I continually get this issue when configure my CMake project:

CMake Warning (dev) at examples/CMakeLists.txt:74 (ADD_EXECUTABLE):
Policy CMP0063 is not set: Honor visibility properties for all target types. Run "cmake --help-policy CMP0063" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Target "Protonect" of type "EXECUTABLE" has the following visibility
properties set for CXX:

CXX_VISIBILITY_PRESET
VISIBILITY_INLINES_HIDDEN

For compatibility CMake is not honoring them for this target. This warning is for project developers. Use -Wno-dev to suppress it.

I know I want to call cmake_policy(SET CMP0063 NEW) - which I'm doing, but then I'm not sure how I'm supposed to use add_executable(Protonect).

1

1 Answers

2
votes

These kind of policy warnings are introduced with new CMake versions when the behavior of CMake is changed. So this warning just says that you have to choose which behavior you want.

When a new policy is introduced, newer CMake versions will begin to warn about the backward compatible behavior.

Those warnings normally detect when you use such kind of feature. In your case - policy CMP0063 - I suspect that you have set ENABLE_EXPORTS for one of your library targets.

So - for your question which one you want - I would also recommend

cmake_policy(SET CMP0063 NEW)

Because OLD would only be for cases where you rely on that CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN properties are not honored for "sources may be compiled as part of static libraries or object libraries and then linked into a shared library later".

For more details CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN see also