diff --git a/CMakeLists.txt b/CMakeLists.txt index c2d2dfc7..09428ddb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,10 @@ project(FLAC VERSION 1.3.2) # HOMEPAGE_URL "https://www.xiph.org/flac/") 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_DOCS "Build and install doxygen documents" ON) +option(BUILD_UTILS "Build utils" OFF) option(WITH_OGG "ogg support (default: test for libogg)" ON) if(WITH_OGG) @@ -84,6 +87,10 @@ include_directories("include") include_directories("${CMAKE_CURRENT_BINARY_DIR}") add_definitions(-DHAVE_CONFIG_H) +if(WIN32 AND NOT BUILD_SHARED_LIBS) + add_definitions(-DFLAC__NO_DLL) +endif() + if(MSVC) add_definitions( -D_CRT_SECURE_NO_WARNINGS @@ -93,13 +100,15 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) add_definitions(-DFLAC__OVERFLOW_DETECT) endif() -add_subdirectory("doc") add_subdirectory("src") -add_subdirectory("microbench") +if(BUILD_DOCS) + add_subdirectory("doc") +endif() if(BUILD_EXAMPLES) add_subdirectory("examples") endif() if(BUILD_TESTING) + add_subdirectory("microbench") add_subdirectory("test") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ba7a439e..5bb020f1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,10 +9,14 @@ add_subdirectory("libFLAC") if(BUILD_CXXLIBS) add_subdirectory("libFLAC++") endif() -add_subdirectory("share") -add_subdirectory("flac") -add_subdirectory("metaflac") -add_subdirectory("utils") +if(BUILD_PROGRAMS) + add_subdirectory("flac") + add_subdirectory("metaflac") +endif() +if(BUILD_UTILS) + add_subdirectory("share") + add_subdirectory("utils") +endif() if(WITH_XMMS) add_subdirectory("plugin_common")