The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15826 
====================================================================== 
Reported By:                Edward Rudd
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15826
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-11-02 17:41 WAST
Last Modified:              2015-11-02 17:41 WAST
====================================================================== 
Summary:                    handling quoting for compile options.
Description: 
So, I'm trying to build up a project via CMake that targets emscripten/asm.js
Generally everything works great except for ONE thing that I'm trying to do. 
Pass custom emcc specific compile options.   Emcc has compile options in the
form of "-s USE_BLAH=2" .  Generally these are used only as link options which
doing this

target_link_libraries(MyTarget "-s USE_ZLIB=1" "-s USE_SDL=2" "-s ASSERTIONS=2")
works fine. and the produced options has the options unquoted.

  em++ -s USE_ZLIB=1 -s USE_SDL=2 -s ASSERTIONS=2 -g -o MyTarget.js
@CMakeFiles/MyTarget.dir/linklibs.rsp

However when applying them to compile options it breaks apart. e.g.

target_compile_options(MyTarget PRIVATE "-s USE_ZLIB=1" "-s USE_SDL=2")

CXX_FLAGS = "-s USE_ZLIB=1" "-s USE_SDL=2" -g
@CMakeFiles/MyTarget.dir/includes_CXX.rsp

which emcc/em++ do not see the quoted argument as the option correctly and
things do not work. 

If I don't quote them then the produced output is further incorrect

target_compile_options(MyTarget PRIVATE -s USE_ZLIB=1 -s USE_SDL=2)

CXX_FLAGS = -s USE_ZLIB=1 USE_SDL=2 -g @CMakeFiles/MyTarget.dir/includes_CXX.rsp

Only one "-s" is produced!
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-11-02 17:41 Edward Rudd    New Issue                                    
======================================================================

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to