From: Lukáš Lalinský Date: Sat, 9 Apr 2011 17:51:23 +0000 (+0200) Subject: Clean up the main CMakeLists.txt file X-Git-Tag: v1.8beta~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1596dc7c696c76ba471410437b15b6b0914c84e0;p=taglib Clean up the main CMakeLists.txt file --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a5a89d0..a70fb78b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,83 +2,76 @@ project(taglib) cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) -OPTION(ENABLE_STATIC "Make static version of libtag" OFF) +option(ENABLE_STATIC "Make static version of libtag" OFF) -OPTION(BUILD_TESTS "Build the test suite" OFF) -OPTION(BUILD_EXAMPLES "Build the examples" OFF) +option(BUILD_TESTS "Build the test suite" OFF) +option(BUILD_EXAMPLES "Build the examples" OFF) -OPTION(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF) -OPTION(WITH_ASF "Enable ASF tag reading/writing code" OFF) -OPTION(WITH_MP4 "Enable MP4 tag reading/writing code" OFF) +option(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF) +option(WITH_ASF "Enable ASF tag reading/writing code" OFF) +option(WITH_MP4 "Enable MP4 tag reading/writing code" OFF) add_definitions(-DHAVE_CONFIG_H) -#add some KDE specific stuff -set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) -set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE) -# ## the following are directories where stuff will be installed to -set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE) -set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) -set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE) +set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") +set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Base directory for executables and libraries" FORCE) +set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE) +set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) +set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() -SET(TAGLIB_LIB_MAJOR_VERSION "1") -SET(TAGLIB_LIB_MINOR_VERSION "7") -SET(TAGLIB_LIB_PATCH_VERSION "0") - -SET(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}") +set(TAGLIB_LIB_MAJOR_VERSION "1") +set(TAGLIB_LIB_MINOR_VERSION "7") +set(TAGLIB_LIB_PATCH_VERSION "0") +set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}") # 1. If the library source code has changed at all since the last update, then increment revision. # 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. # 3. If any interfaces have been added since the last public release, then increment age. # 4. If any interfaces have been removed since the last public release, then set age to 0. -SET(TAGLIB_SOVERSION_CURRENT 11) -SET(TAGLIB_SOVERSION_REVISION 0) -SET(TAGLIB_SOVERSION_AGE 10) - -MATH(EXPR TAGLIB_SOVERSION_MAJOR "${TAGLIB_SOVERSION_CURRENT} - ${TAGLIB_SOVERSION_AGE}") -MATH(EXPR TAGLIB_SOVERSION_MINOR "${TAGLIB_SOVERSION_AGE}") -MATH(EXPR TAGLIB_SOVERSION_PATCH "${TAGLIB_SOVERSION_REVISION}") +set(TAGLIB_SOVERSION_CURRENT 11) +set(TAGLIB_SOVERSION_REVISION 0) +set(TAGLIB_SOVERSION_AGE 10) +math(EXPR TAGLIB_SOVERSION_MAJOR "${TAGLIB_SOVERSION_CURRENT} - ${TAGLIB_SOVERSION_AGE}") +math(EXPR TAGLIB_SOVERSION_MINOR "${TAGLIB_SOVERSION_AGE}") +math(EXPR TAGLIB_SOVERSION_PATCH "${TAGLIB_SOVERSION_REVISION}") include(ConfigureChecks.cmake) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config ) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR}) if(NOT WIN32) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc ) -endif(NOT WIN32) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +endif() + include_directories(${CMAKE_CURRENT_BINARY_DIR}) -configure_file(config-taglib.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) +configure_file(config-taglib.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) if(WITH_ASF) set(TAGLIB_WITH_ASF TRUE) -endif(WITH_ASF) +endif() if(WITH_MP4) set(TAGLIB_WITH_MP4 TRUE) -endif(WITH_MP4) -configure_file(taglib/taglib_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib) - -ADD_SUBDIRECTORY( taglib ) - -ADD_SUBDIRECTORY(tests) -ADD_SUBDIRECTORY(examples) +endif() -ADD_SUBDIRECTORY(bindings) -if(NOT WIN32) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) -endif(NOT WIN32) +configure_file(taglib/taglib_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib) -INSTALL( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR}) +add_subdirectory(taglib) +add_subdirectory(bindings) +add_subdirectory(tests) +add_subdirectory(examples) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) file(COPY doc/taglib.png DESTINATION doc) -ADD_CUSTOM_TARGET(docs doxygen) +add_custom_target(docs doxygen) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 3bbf2485..e4a6d1fa 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -1,8 +1,3 @@ -# NOTE: only add something here if it is really needed by all of kdelibs. -# Otherwise please prefer adding to the relevant config-foo.h.cmake file, -# and the CMakeLists.txt that generates it (or a separate ConfigureChecks.make file if you prefer) -# to minimize recompilations and increase modularity. - include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckSymbolExists) @@ -11,18 +6,18 @@ include(CheckLibraryExists) include(CheckTypeSize) include(CheckCXXSourceCompiles) -#check for libz using the cmake supplied FindZLIB.cmake -FIND_PACKAGE(ZLIB) +# check for libz using the cmake supplied FindZLIB.cmake +find_package(ZLIB) +if(ZLIB_FOUND) + set(HAVE_ZLIB 1) +else() + set(HAVE_ZLIB 0) +endif() -IF(ZLIB_FOUND) - SET(HAVE_ZLIB 1) -ELSE(ZLIB_FOUND) - SET(HAVE_ZLIB 0) -ENDIF(ZLIB_FOUND) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) +find_package(CppUnit) +if(NOT CppUnit_FOUND AND BUILD_TESTS) + message(STATUS "CppUnit not found, disabling tests.") + set(BUILD_TESTS OFF) +endif() -SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -FIND_PACKAGE(CppUnit) -IF (NOT CppUnit_FOUND AND BUILD_TESTS) - MESSAGE(STATUS "CppUnit not found, disabling tests.") - SET(BUILD_TESTS OFF) -ENDIF(NOT CppUnit_FOUND AND BUILD_TESTS) diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index 0afe1195..d019843e 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -1 +1 @@ -ADD_SUBDIRECTORY( c ) +add_subdirectory(c)