0

I am trying to create emscripten logic in Makefile . I am calling cmake command of a CMakeLists.txt. So the logic looks like this

ifeq(EXECUTOR, Emscripten)
    emcmake cmake cmake/CMakeLists.txt
else
   cmake cmake/CMakeLists.txt
endif

And in CMakeLists.txt I have

if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten)
    // Do some logic
endif()

So it is crucial to detect this ifeq(EXECUTOR, Emscripten) How can I do that?

Hrant Nurijanyan
  • 789
  • 2
  • 9
  • 26
  • Well, the string `EXECUTOR` will never be equal to the string `Emscripten`, like the string `foo` is never equal to `bar`. Since you don't give any other information, it's hard to say what you really wanted to do. – MadScientist Nov 01 '21 at 13:05
  • @MadScientist In other words I need to detect emscripten in makefile – Hrant Nurijanyan Nov 02 '21 at 11:36
  • What I mean is, if you want to compare the **CONTENTS** of the variable `EXECUTOR` you have to reference it, like `ifeq ($(EXECUTOR),Emscripten)`. In cmake you can avoid using the `${...}` because cmake will infer that the value should be a variable name but make never does that. If you want the variable you have to reference it. Else you're just comparing the plain string `EXECUTOR`, not a variable named `EXECUTOR`. If what you're asking is how to figure out what the value of `EXECUTOR` should be and how to set it, you have to do it yourself. Make doesn't do anything like that for you. – MadScientist Nov 02 '21 at 13:54
  • Note that in your cmake file a simple `if (EMSCRIPTEN)` should work as well. – cajomar Nov 02 '21 at 22:29

0 Answers0