added const and constexpr refacotred build options

This commit is contained in:
2024-09-23 10:46:32 -07:00
parent ee68574542
commit 46e7a82f1d
5 changed files with 97 additions and 91 deletions

View File

@@ -5,20 +5,26 @@ project(omath)
set(CMAKE_CXX_STANDARD 26)
option(BUILD_TESTS "Build unit tests" ON)
option(THREAT_WARNING_AS_ERROR "Set highest level of warnings and force compiler to threat them as errors" ON)
add_library(omath STATIC source/Vector3.cpp)
option(OMATH_BUILD_TESTS "Build unit tests" ON)
option(OMATH_THREAT_WARNING_AS_ERROR "Set highest level of warnings and force compiler to threat them as errors" ON)
option(OMATH_BUILD_AS_SHARED_LIBRARY "Build Omath as .so\\.dll." OFF)
if (OMATH_BUILD_AS_SHARED_LIBRARY)
add_library(omath SHARED source/Vector3.cpp)
else()
add_library(omath STATIC source/Vector3.cpp)
endif()
add_subdirectory(source)
add_subdirectory(extlibs)
if(BUILD_TESTS)
if(OMATH_BUILD_TESTS)
add_subdirectory(tests)
endif ()
if (WIN32 AND THREAT_WARNING_AS_ERROR)
if (WIN32 AND OMATH_THREAT_WARNING_AS_ERROR)
target_compile_options(omath PRIVATE /W4 /WX)
elseif(UNIX AND THREAT_WARNING_AS_ERROR)
elseif(UNIX AND OMATH_THREAT_WARNING_AS_ERROR)
target_compile_options(omath PRIVATE -Wall -Wextra -Wpedantic)
endif()