如果有的话,如何通过 'emcmake cmake' 而不仅仅是 'cmake' 来检测 CMakeLists.txt 是 运行?
If at all, how is it possible to detect that CMakeLists.txt is run by 'emcmake cmake' instead of just 'cmake'?
我有一个项目在使用 cmake
或 emcmake cmake
时应该 configured/built 不同(后跟分别是 make
或 emmake make
)。例如,如果 emcmake cmake
是 运行,我不需要构建测试可执行文件,因为结果将是 WebAssembly。
那么,当运行 by emcmake cmake
时,是否有任何可用的变量可供我查询?还有其他方法吗?
您可以检测 emcmake cmake
或 emconfigure cmake
是否与 EMSCRIPTEN
变量一起使用:
if(EMSCRIPTEN)
message("Using emscripten!")
else()
message("Not using emscripten!")
endif()
我有一个项目在使用 cmake
或 emcmake cmake
时应该 configured/built 不同(后跟分别是 make
或 emmake make
)。例如,如果 emcmake cmake
是 运行,我不需要构建测试可执行文件,因为结果将是 WebAssembly。
那么,当运行 by emcmake cmake
时,是否有任何可用的变量可供我查询?还有其他方法吗?
您可以检测 emcmake cmake
或 emconfigure cmake
是否与 EMSCRIPTEN
变量一起使用:
if(EMSCRIPTEN)
message("Using emscripten!")
else()
message("Not using emscripten!")
endif()