Skip to content

Commit

Permalink
fix running cmake ctests in windows
Browse files Browse the repository at this point in the history
* removed fsanitize=address for windows cmake build

* specify the build config to use when running the ctests in windows cmake workflow

* also removed the clang installation in build.yml
  • Loading branch information
mrdcvlsc committed Jun 6, 2024
1 parent c381990 commit b4f0101
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: install clang
run: sudo apt install clang


- uses: actions/checkout@v3

- name: get updated submodules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
run: cmake --build tests --config Debug

- name: Run ${{matrix.platform.bin}} test executables
run: ctest --test-dir tests
run: ctest --test-dir tests --build-config Debug --output-on-failure
21 changes: 8 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ cmake_minimum_required(VERSION 3.16)

file(GLOB SOURCES "*.cpp")

message("=========================")
# message(CMAKE_C_COMPILER="${CMAKE_C_COMPILER}")
# message(CMAKE_CPP_COMPILER="${CMAKE_CPP_COMPILER}")
# message(CMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}")
# message(CMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}")
message("=========================")

if(WIN32)
# disable windows asan for now since I don't know how to make it work
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()

set(CMAKE_VERBOSE_MAKEFILE ON)

Expand All @@ -18,14 +19,8 @@ add_compile_definitions(_HIDE_WARNING)

foreach(test_src_code ${SOURCES})
get_filename_component(test_exec_name ${test_src_code} NAME_WE)
message("Source Code = ${test_src_code} | ${test_exec_name}")
add_executable(${test_exec_name} ${test_src_code})
target_compile_features(${test_exec_name} PRIVATE cxx_std_20)
target_compile_options(${test_exec_name} PRIVATE -fsanitize=address)
target_link_options(${test_exec_name} PRIVATE -fsanitize=address)

# message(CMAKE_C_COMPILER="${CMAKE_C_COMPILER}")
# message(CMAKE_CPP_COMPILER="${CMAKE_CPP_COMPILER}")

add_test(
NAME ${test_exec_name}
Expand Down

0 comments on commit b4f0101

Please sign in to comment.