diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c02bebf4..28f1c43d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,6 +217,7 @@ function(sanitizer NAME FLAGS) set(USE_SANITIZER TRUE PARENT_SCOPE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}" PARENT_SCOPE) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} ${FLAGS}" PARENT_SCOPE) endif () endfunction() sanitizer(USE_ASAN "-fsanitize=address") @@ -618,6 +619,18 @@ if (BUILD_TOOLS) endif () if (BUILD_TESTS) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} -g -O0") + endif () + + if (DEFINED CMAKE_OSX_SYSROOT) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") + endif () + + if (DEFINED ENV{WASM2C_CFLAGS}) + set(WASM2C_CFLAGS "${WASM2C_CFLAGS} $ENV{WASM2C_CFLAGS}") + endif () + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -681,7 +694,7 @@ if (BUILD_TESTS) set(RUN_TESTS_PY ${WABT_SOURCE_DIR}/test/run-tests.py) add_custom_target(run-tests - COMMAND ${PYTHON_EXECUTABLE} ${RUN_TESTS_PY} --bindir $<TARGET_FILE_DIR:wat2wasm> + COMMAND ${CMAKE_COMMAND} -E env WASM2C_CC=${CMAKE_C_COMPILER} WASM2C_CFLAGS=${WASM2C_CFLAGS} ${PYTHON_EXECUTABLE} ${RUN_TESTS_PY} --bindir $<TARGET_FILE_DIR:wat2wasm> DEPENDS ${WABT_EXECUTABLES} WORKING_DIRECTORY ${WABT_SOURCE_DIR} USES_TERMINAL |