[CMake] Building arguments to target_comple_definitions()

Chuck Atkins chuck.atkins at kitware.com
Thu Oct 11 15:12:10 EDT 2018


Hi Rob,


> target_compile_definitions( CHUNK1 ${COMMON_DEFINITIONS}  CHUNK1_STUFF
> CHUNK_NAME=\”One\” )
>
> target_compile_definitions( CHUNK2 ${COMMON_DEFINITIONS}  CHUNK2_STUFF
> CHUNK_NAME=\”Two\”)
>
> target_compile_definitions( FooBar ${COMMON_DEFINITIONS}  )
>

This is what I was referring to.  Adding visibility to
target_compile_definitions:

target_compile_definitions(CHUNK1 PRIVATE ${COMMON_DEFINITIONS}
CHUNK1_STUFF CHUNK_NAME=\"One\")
target_compile_definitions(CHUNK2 PRIVATE ${COMMON_DEFINITIONS}
CHUNK2_STUFF CHUNK_NAME=\"Two\")
target_compile_definitions(FooBar PRIVATE ${COMMON_DEFINITIONS})

All of the target_<foo> commands take the format target_foo(target_name
USAGE_VISIBILY bar1 bar2 bar3 ...).  target_link_libraries is the exception
with everythign being PUBLIC by default but only because it pre-dates all
the other target commands.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181011/89dac02e/attachment.html>


More information about the CMake mailing list