summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2021-12-27 20:55:45 +0100
committerMartijn van Beurden <mvanb1@gmail.com>2022-04-13 17:37:50 +0200
commit20137386220fa120a5dd303b9d75f2031035830c (patch)
tree8535bd8c66910772821b5248eab0c4a6ea396e9c /CMakeLists.txt
parentbe1df4085aec5ea44008013600c315ffb20358b1 (diff)
downloadflac-20137386220fa120a5dd303b9d75f2031035830c.tar.gz
[CMake] Add options for better MS Visual Studio building
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 5 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73c7c6be..be6dd678 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(BUILD_CXXLIBS "Build libFLAC++" ON)
option(BUILD_PROGRAMS "Build and install programs" ON)
option(BUILD_EXAMPLES "Build and install examples" ON)
+option(BUILD_TESTING "Build tests" ON)
option(BUILD_DOCS "Build and install doxygen documents" ON)
option(WITH_STACK_PROTECTOR "Enable GNU GCC stack smash protection" ON)
option(INSTALL_MANPAGES "Install MAN pages" ON)
@@ -39,10 +40,11 @@ endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef")
endif()
+if(MSVC)
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /O2 /Ob2 /Oi /Ot /Oy /MT")
+endif()
include(CMakePackageConfigHelpers)
-include(CPack)
-include(CTest)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckSymbolExists)
@@ -53,6 +55,7 @@ include(CheckCXXSourceCompiles)
include(GNUInstallDirs)
include(UseSystemExtensions)
include(TestBigEndian)
+enable_testing()
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)