You can handle emscripten specific options inside an if-block which check 
that CMAKE_SYSTEM_NAME is "Emscripten". For example see here at the start 
and towards the end of the CMakeLists.txt file:

https://github.com/floooh/pacman.c/blob/main/CMakeLists.txt

On Friday, 29 October 2021 at 01:44:48 UTC+2 [email protected] wrote:

> On Wed, Oct 27, 2021 at 4:59 PM 'Steven Johnson' via emscripten-discuss <
> [email protected]> wrote:
>
>> If I am using emcmake to build an existing CMake-based executable, what's 
>> the right / best way to set emcc options? (e.g. -s ASSERTIONS=1 -s 
>> ENVIRONMENT=node)?
>>
>> Random googling hasn't found a definitive answer. Some hits suggest that 
>> I can use target_compile_options() and/or target_link_opions() in my CMake 
>> build files to set these, but it would be nice if I could (also) just 
>> specify them on the command line (for cases where the CMake files aren't 
>> yet modified to be smart).
>>
>
> We don't support anything special here, so the answer is the same as if 
> you had asked "how to I pass extra compile and/or link flags to a cmake 
> project".  
>
> I think the answer is here: 
> https://stackoverflow.com/questions/44284275/passing-compiler-options-cmake.  
> Do -DCMAKE_C_FLAGS=... and -DCMAKE_CXX_FLAGS=... work for you?
>
>  
>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/emscripten-discuss/CAM%3DdnvcfdQqqYP1xNznuLZK19kjaq2sPfhY%3DQTYxpWtgZhfgdw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/emscripten-discuss/CAM%3DdnvcfdQqqYP1xNznuLZK19kjaq2sPfhY%3DQTYxpWtgZhfgdw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/66084f8e-d6e3-47f7-8160-29087fcaba3an%40googlegroups.com.

Reply via email to