<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Rob,<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_5248350963662844526WordSection1">
<p class="MsoNormal">How would one set a variable containing multiple definitions to be passed to target_compile_definitions() ?</p></div></div></blockquote><div><br></div><div>The example you gave works (adjusting for typos, PIC, and adding visibility specifier):</div><div style="margin-left:40px"><span style="font-family:monospace,monospace">...</span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">set(COMMON_DEFINITIONS SOME_DEFINE_1 SOME_DEFINE_2 SOME_DEFINE_3)<br>...<br>target_compile_definitions(CHUNK1 PRIVATE ${COMMON_DEFINITIONS} CHUNK1_STUFF CHUNK_NAME=\"One\")<br>target_compile_definitions(CHUNK2 PRIVATE ${COMMON_DEFINITIONS} CHUNK2_STUFF CHUNK_NAME=\"Two\")<br>target_compile_definitions(FooBar PRIVATE ${COMMON_DEFINITIONS})</span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">...</span></div></div><div class="gmail_quote">results in the following:</div><div class="gmail_quote"><div style="margin-left:40px"><span style="font-family:monospace,monospace">...</span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">/usr/bin/c++ -DCHUNK1_STUFF -DCHUNK_NAME=\"One\" -DSOME_DEFINE_1 -DSOME_DEFINE_2 -DSOME_DEFINE_3 -fPIC -o CMakeFiles/CHUNK1.dir/chunk_one.cpp.o -c /home/chuck/Code/tmp/source/chunk_one.cpp<br>...</span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">/usr/bin/c++ -DCHUNK2_STUFF -DCHUNK_NAME=\"Two\" -DSOME_DEFINE_1 -DSOME_DEFINE_2 -DSOME_DEFINE_3 -fPIC -o CMakeFiles/CHUNK2.dir/chunk_two.cpp.o -c /home/chuck/Code/tmp/source/chunk_two.cpp<br>...<br></span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">/usr/bin/c++ -DFooBar_EXPORTS -DSOME_DEFINE_1 -DSOME_DEFINE_2 -DSOME_DEFINE_3 -fPIC -o CMakeFiles/FooBar.dir/foobar.cpp.o -c /home/chuck/Code/tmp/source/foobar.cpp</span></div><div style="margin-left:40px"><span style="font-family:monospace,monospace">...</span><br></div><div> </div><div>Here you can see the common definitions make it to all targets.</div><div><br></div><div>- Chuck<br></div></div></div></div></div></div></div></div></div>