De-duplication with generator expressions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

De-duplication with generator expressions

CMake mailing list

I am passing several LLVM/Clang passes, which means I need arguments not de-duplicated:


-Xtemplight -profiler -Xtemplight -ignore-system


Otherwise I would get


templight++ -Xtemplight -profiler -ignore-system


which crashes. The SHELL: trick works in some cases. However, I also have scenarios where I need a generator expression so compiler flags only apply to C++ files:


target_compile_options(${target} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:…


The following works:

target_compile_options(${target} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xtemplight -profiler -Xtemplight -ignore-system>)


But then splitting around conditionals, the below does not and still does de-dup breaking the build:


target_compile_options(${target} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xtemplight -ignore-system>)


target_compile_options(${target} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xtemplight -profiler>)


After searching for a bit, it would appear SHELL: can still not be used with generator expressions? Has anyone else encountered this and knows a workaround?  No amount of searching or playing around with quotes got this to work.









Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: