[CMake] cmp0065

Johannes Zarl-Zierl johannes.zarl-zierl at jku.at
Wed Jul 6 05:52:42 EDT 2016


Hi,

On Tuesday 05 July 2016 23:46:16 J Decker wrote:
> https://cmake.org/cmake/help/v3.4/policy/CMP0065.html
> while I like the idea it suggests, I don't use the flags for -rdynamic so
> this is meaningless to me

I'm not sure I understood you correctly, but if the policy is meaningless to 
you, it shouldn't affect you...

> https://cmake.org/cmake/help/v3.4/prop_tgt/ENABLE_EXPORTS.html#prop_tgt:ENAB
> LE_EXPORTS
>   SET_PROPERTY(TARGET ${project} APPEND PROPERTY COMPILE_DEFINITIONS
> TARGET_LABEL=${TARGET_LABEL};TARETNAME=\"${TARGETNAME}\" )
> 
> or
> 
>     SET_PROPERTY( TARGET ${project} APPEND PROPERTY COMPILE_DEFINITIONS
> "CONSOLE_SHELL" )
> 
> to indicate it's non-WIN32....

First of all, there are the usual standard definitions provided by the 
compiler, so you can just use 

#if defined(WIN32)
#endif

to check whether the compilation happens for windows or another platform.

If you have the need for additional definitions, it seems to me that the usual 
command:

target_compile_definitions( yourTarget PRIVATE COMPILE_SHELL)
https://cmake.org/cmake/help/v3.4/command/target_compile_definitions.html

Is that what you are searching for?

> I noted at the bottom of that the the default behavior will eventually be
> phased out... but then can we have some other flag to phase it back in?

You can always set policies to “OLD” to revert to the old behavior (until it 
is finally phased out). In the case of cmp0065 the documentation explains what 
you can do to have the same behavior with the policiy enabled:
Just set the ENABLE_EXPORTS property on the targets that need to export their 
symbols.

HTH,
  Johannes


More information about the CMake mailing list