summaryrefslogtreecommitdiff
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
parentbe1df4085aec5ea44008013600c315ffb20358b1 (diff)
downloadflac-20137386220fa120a5dd303b9d75f2031035830c.tar.gz
[CMake] Add options for better MS Visual Studio building
-rw-r--r--CMakeLists.txt7
-rw-r--r--cmake/FindOgg.cmake8
2 files changed, 11 insertions, 4 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)
diff --git a/cmake/FindOgg.cmake b/cmake/FindOgg.cmake
index b60c3526..34407fd4 100644
--- a/cmake/FindOgg.cmake
+++ b/cmake/FindOgg.cmake
@@ -1,13 +1,17 @@
find_package(PkgConfig)
pkg_check_modules(_OGG QUIET ogg)
+file(GLOB _OGG_DIR ../libogg-*)
+
find_path(OGG_INCLUDE_DIR
NAMES "ogg/ogg.h"
- PATHS ${_OGG_INCLUDE_DIRS})
+ PATHS ${_OGG_INCLUDE_DIRS}
+ HINTS "${_OGG_DIR}/include")
find_library(OGG_LIBRARY
NAMES ogg libogg
- HINTS ${_OGG_LIBRARY_DIRS})
+ HINTS ${_OGG_LIBRARY_DIRS}
+ HINTS "${_OGG_DIR}/Release")
mark_as_advanced(
OGG_INCLUDE_DIR