Skip to content

Commit

Permalink
configure compiler warning flags specifically for BytePackTests target
Browse files Browse the repository at this point in the history
  • Loading branch information
farukeryilmaz committed Jan 8, 2024
1 parent ad68644 commit 860f9f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ project(BytePack)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Compiler specific warning flags
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Wconversion -Wsign-conversion)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/W4 /w14640 /permissive-)
endif()

add_library(bytepack INTERFACE)
target_include_directories(bytepack INTERFACE ${PROJECT_SOURCE_DIR}/include)

# Option for building tests
# Option for building tests. Pass -DBYTEPACK_BUILD_TESTS=ON to cmake to enable tests building and running.
option(BYTEPACK_BUILD_TESTS "Build the BytePack tests" OFF)
if(BYTEPACK_BUILD_TESTS)
message("Build the BytePack tests")
Expand Down
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@ target_sources(BytePackTests
usecase1_test.cpp
)

# Compiler specific warning flags for tests
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Wconversion -Wsign-conversion)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/W4 /w14640 /permissive-)
endif()

add_test(NAME BytePackTests COMMAND BytePackTests)

0 comments on commit 860f9f3

Please sign in to comment.