diff --git a/.travis.yml b/.travis.yml index 1709853..d73bd71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,11 +12,10 @@ compiler: - clang++ env: - - TARGET_CPU=amd64 BUILD_CONFIGURATION=Release + - PLATFORM=x64 CONFIGURATION=Release script: - - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION -DTARGET_CPU=$TARGET_CPU + - cmake .. -DCMAKE_BUILD_TYPE=$CONFIGURATION -DTARGET_CPU=$PLATFORM - cmake --build . - - ctest -V --output-on-failure -С $BUILD_CONFIGURATION \ No newline at end of file + - ctest -V --output-on-failure -С $CONFIGURATION \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 60846da..da3b19a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,15 @@ project(nameof) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -enable_testing() +if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + add_compile_options(-pedantic) + add_compile_options(-Wall) + add_compile_options(-Wextra) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + add_compile_options(/W4) +endif() add_subdirectory(example) + +enable_testing() add_subdirectory(test) \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 5808bd3..72b562b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,7 +31,8 @@ init: before_build: - ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta' - - if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER% + - cd build + - if "%BUILDER%"=="CMake" cmake.exe .. -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DTARGET_CPU=$PLATFORM build_script: - ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta' diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/example/example.cpp b/example/example.cpp index 82b5f6e..cde130b 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -102,7 +102,8 @@ void TestCase2() { }; try { - int z = div(10, 0); + const int z = div(10, 0); + std::cout << z << std::endl; } catch (const std::exception& e) { std::cout << e.what() << std::endl; // y should not be zero! }