diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 13ce0c9e6..93061cfef 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -5,7 +5,6 @@ on: branches: [ master ] pull_request: branches: [ master ] - env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release @@ -39,9 +38,12 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + + # The macro ${{github.workspace}} results in windows file seprators, (\) which CMake often cannot parse. + # To get around this use a relative path instead. run: | if [ ${{ matrix.os }} == 'windows-latest' ]; then - cmake -DTEST=ON -Dgtest_disable_pthreads=ON -B ${{github.workspace}}/build + cmake -DTEST=ON -Dgtest_disable_pthreads=ON -B ./build else cmake -DTEST=ON -B ${{github.workspace}}/build fi; diff --git a/CMakeLists.txt b/CMakeLists.txt index d18363937..a1b002585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,17 +19,19 @@ if(DEBUG) ) endif(DEBUG) -option(SANITIZE "Enable Sanitize" OFF) -if(SANITIZE) - add_compile_options( - -fsanitize=address - -fsanitize=leak - ) - add_link_options( - -fsanitize=address - -fsanitize=leak - ) -endif(SANITIZE) +if (NOT MSVC) + option(SANITIZE "Enable Sanitize" OFF) + if(SANITIZE) + add_compile_options( + -fsanitize=address + -fsanitize=leak + ) + add_link_options( + -fsanitize=address + -fsanitize=leak + ) + endif(SANITIZE) +endif(NOT MSVC) # set up CPM.cmake if(CPM_SOURCE_CACHE) @@ -52,5 +54,4 @@ add_subdirectory(test) add_subdirectory(benchmark) add_subdirectory(examples) -#install(FILES include/Graph.hpp DESTINATION /usr/include) install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f41935317..731aa1875 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,35 +1,39 @@ -option(CODE_COVERAGE "Enable coverage reporting" OFF) option(CMAKE_USE_WIN32_THREADS_INIT "using WIN32 threads" ON) option(gtest_disable_pthreads "Disable uses of pthreads in gtest." ON) # Force dynamic linking since MSVC now links C runtimes dynamically by default set(gtest_force_shared_crt on) -if(CODE_COVERAGE) - message( "Code Coverage Enabled" ) - add_compile_options( - -O0 #no optimization - -g #generate debug info - --coverage #set coverage flag - -fprofile-arcs - -ftest-coverage - -fPIC - ) - link_libraries( - "gcov" - "-fprofile-arcs" - "--coverage" - ) +if (NOT MSVC) + option(CODE_COVERAGE "Enable coverage reporting" OFF) + if(CODE_COVERAGE) + message( "Code Coverage Enabled" ) + add_compile_options( + -O0 #no optimization + -g #generate debug info + --coverage #set coverage flag + -fprofile-arcs + -ftest-coverage + -fPIC + ) + link_libraries( + "gcov" + "-fprofile-arcs" + "--coverage" + ) -endif(CODE_COVERAGE) + endif(CODE_COVERAGE) +endif(NOT MSVC) option(TEST "Enable Test" OFF) if(TEST) include(${CPM_DOWNLOAD_LOCATION}) - add_compile_options( - -Wall - -Wextra - ) + if (NOT MSVC) + add_compile_options( + -Wall + -Wextra + ) + endif(NOT MSVC) CPMAddPackage( NAME googletest