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:
if (TEMPLIGHT_IGNORE_SYSTEM)
target_compile_options(${target} PUBLIC 
$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xtemplight -ignore-system>)
endif()
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.

-Jeremy






-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to