[CMake] if( defined xxx ) does not work as (I) expected

Brad King brad.king at kitware.com
Wed Oct 25 10:00:44 EDT 2006


Michael Hufer wrote:
> ---
>  [...]
>   if( DEFINED ${EXT_LINK_FLAGS} )
>     message( "module ${EXT}: adding the linker flags '${EXT_LINK_FLAGS}'" )
>     set_target_properties( ${MODULE} PROPERTIES LINK_FLAGS 
> "${EXT_LINK_FLAGS}" )
>   endif( DEFINED ${EXT_LINK_FLAGS} )
> [...]
> ---
> which is only written if the EXT_LINK_FLAGS variable is defined is missing.

The value of "${EXT_LINK_FLAGS}" is not defined.  This should be

if(DEFINED EXT_LINK_FLAGS)

I checked the

  if( DEFINED EXT_DEFINES )

you mentioned in your original message and that one worked.  I didn't
notice the other until now.

-Brad


More information about the CMake mailing list