|
@@ -138,14 +138,15 @@ foreach (LANG C CXX)
|
|
|
# The ABI info could not be checked as per normal as CMake does not understand the test build output from Emscripten, so bypass it also
|
|
# The ABI info could not be checked as per normal as CMake does not understand the test build output from Emscripten, so bypass it also
|
|
|
set (CMAKE_${LANG}_ABI_COMPILED TRUE)
|
|
set (CMAKE_${LANG}_ABI_COMPILED TRUE)
|
|
|
set (CMAKE_${LANG}_SIZEOF_DATA_PTR 4) # Assume it is always 32-bit for now (we could have used our CheckCompilerToolChains.cmake module here)
|
|
set (CMAKE_${LANG}_SIZEOF_DATA_PTR 4) # Assume it is always 32-bit for now (we could have used our CheckCompilerToolChains.cmake module here)
|
|
|
- # There could be a bug in CMake itself where setting CMAKE_EXECUTABLE_SUFFIX variable outside of the scope, where it processes the platform configuration files, does not being honored by try_compile() command and as a result all the check macros that depend on try_compile() do not work properly when the CMAKE_EXECUTABLE_SUFFIX variable is only being set later further down the road; At least one of the CMake devs has the opinion that this is the intended behavior but it is an unconvincing explanation because setting CMAKE_EXECUTABLE_SUFFIX variable later does have the desired effect everywhere else EXCEPT the try_compile() command
|
|
|
|
|
- # We are forced to set CMAKE_EXECUTABLE_SUFFIX_C and CMAKE_EXECUTABLE_SUFFIX_CXX here as a workaround; we could not just set CMAKE_EXECUTABLE_SUFFIX directly because CMake processes platform configuration files after the toolchain file and since we tell CMake that we are cross-compiling for 'Linux' platform via CMAKE_SYSTEM_NAME variable, CMake initializes the CMAKE_EXECUTABLE_SUFFIX to empty string (as expected for Linux platform); the workaround avoids our setting from being overwritten by platform configuration files by using the C and CXX language variants of the variable
|
|
|
|
|
- # The executable suffix needs to be .js for the below Emscripten-specific compiler setting to be effective
|
|
|
|
|
- set (CMAKE_EXECUTABLE_SUFFIX_${LANG} .js)
|
|
|
|
|
|
|
+ # We could not set CMAKE_EXECUTABLE_SUFFIX directly because CMake processes platform configuration files after the toolchain file and since we tell CMake that we are cross-compiling for 'Linux' platform (Emscripten is not a valid platform yet in CMake) via CMAKE_SYSTEM_NAME variable, as such CMake force initializes the CMAKE_EXECUTABLE_SUFFIX to empty string (as expected for Linux platform); To workaround it we have to use CMAKE_EXECUTABLE_SUFFIX_C and CMAKE_EXECUTABLE_SUFFIX_CXX instead, which are fortunately not being touched by platform configuration files
|
|
|
|
|
+ if (NOT DEFINED CMAKE_EXECUTABLE_SUFFIX_${LANG})
|
|
|
|
|
+ set (CMAKE_EXECUTABLE_SUFFIX_${LANG} .html)
|
|
|
|
|
+ endif ()
|
|
|
endforeach ()
|
|
endforeach ()
|
|
|
|
|
|
|
|
-# Set required compiler flags for internal CMake various check_xxx() macros which rely on the error to occur for the check to be performed correctly
|
|
|
|
|
-set (CMAKE_REQUIRED_FLAGS "-s ERROR_ON_UNDEFINED_SYMBOLS=1")
|
|
|
|
|
|
|
+# Set required compiler flags for various internal CMake checks which rely on the compiler/linker error to be occured for the check to be performed correctly
|
|
|
|
|
+# The executable suffix needs to be .js for the below Emscripten-specific compiler setting to be effective
|
|
|
|
|
+set (CMAKE_REQUIRED_FLAGS "-s ERROR_ON_UNDEFINED_SYMBOLS=1;-DSmileyHack=byYaoWT;-DCMAKE_EXECUTABLE_SUFFIX_C=.js;-DCMAKE_EXECUTABLE_SUFFIX_CXX=.js")
|
|
|
|
|
|
|
|
# Use response files on Windows host
|
|
# Use response files on Windows host
|
|
|
if (CMAKE_HOST_WIN32)
|
|
if (CMAKE_HOST_WIN32)
|