diff --git a/CMakeLists.txt b/CMakeLists.txt index 6577ad1..6fc51f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 373fd3d..fba5e12 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) \ No newline at end of file