Skip to content

Commit 98f9e36

Browse files
committed
Cleanup cmake find modules
1 parent 5f8aedb commit 98f9e36

File tree

5 files changed

+51
-69
lines changed

5 files changed

+51
-69
lines changed

CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
project(dsd)
2-
cmake_minimum_required(VERSION 2.6)
2+
cmake_minimum_required(VERSION 2.8.11)
33

44
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
55

66
include(git_revision)
77
git_describe(GIT_TAG)
88

99
find_package(LibSndFile REQUIRED)
10-
find_package(LibMbe REQUIRED)
10+
find_package(MBE REQUIRED)
1111
find_package(ITPP REQUIRED)
1212
find_package(LibPortAudio)
1313

14+
include_directories(SYSTEM ${LIBSNDFILE_INCLUDE_DIR} ${MBE_INCLUDE_DIR} ${ITPP_INCLUDE_DIR})
15+
set(LIBS ${MBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY})
16+
17+
if(PORTAUDIO_FOUND)
18+
include_directories(SYSTEM ${PORTAUDIO_INCLUDE_DIRS})
19+
list(APPEND LIBS ${PORTAUDIO_LIBRARIES})
20+
add_definitions(-DUSE_PORTAUDIO)
21+
endif(PORTAUDIO_FOUND)
22+
1423
FILE(GLOB SRCS src/*.c src/*.cpp)
1524
FILE(GLOB HEADERS include/*.h include/*.hpp)
1625

1726
configure_file("src/git_ver.c.in" "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c" @ONLY)
1827
list(APPEND SRCS "${CMAKE_CURRENT_BINARY_DIR}/git_ver.c")
1928

20-
INCLUDE_DIRECTORIES(
21-
"${PROJECT_SOURCE_DIR}/include"
22-
"${LIBSNDFILE_INCLUDE_DIR}"
23-
"${LIBMBE_INCLUDE_DIR}"
24-
"${ITPP_INCLUDE_DIR}"
25-
)
26-
27-
SET(LIBS ${LIBS} ${LIBMBE_LIBRARY} ${LIBSNDFILE_LIBRARY} ${ITPP_LIBRARY})
28-
29-
if(PORTAUDIO_FOUND)
30-
SET(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} "${PORTAUDIO_INCLUDE_DIRS}")
31-
SET(LIBS ${LIBS} ${PORTAUDIO_LIBRARIES})
32-
add_definitions(-DUSE_PORTAUDIO)
33-
endif(PORTAUDIO_FOUND)
29+
include_directories("${PROJECT_SOURCE_DIR}/include")
3430

3531
ADD_EXECUTABLE(dsd ${SRCS} ${HEADERS})
3632
TARGET_LINK_LIBRARIES(dsd ${LIBS})

cmake/FindITPP.cmake

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# Find ITPP
1+
# - Try to find ITPP
2+
# Once done this will define
3+
#
4+
# ITPP_FOUND - System has ITPP
5+
# ITPP_INCLUDE_DIR - The ITPP include directory
6+
# ITPP_LIBRARY - The library needed to use ITPP
7+
#
28

3-
FIND_PATH(ITPP_INCLUDE_DIR itpp/itcomm.h)
9+
find_path(ITPP_INCLUDE_DIR itpp/itcomm.h)
410

5-
SET(ITPP_NAMES ${ITPP_NAMES} itpp libitpp libitpp.dll)
6-
FIND_LIBRARY(ITPP_LIBRARY NAMES ${ITPP_NAMES} PATH)
11+
set(ITPP_NAMES ${ITPP_NAMES} itpp libitpp libitpp.dll)
12+
FIND_LIBRARY(ITPP_LIBRARY NAMES ${ITPP_NAMES})
713

8-
IF (ITPP_INCLUDE_DIR AND ITPP_LIBRARY)
9-
SET(ITPP_FOUND TRUE)
10-
ENDIF (ITPP_INCLUDE_DIR AND ITPP_LIBRARY)
11-
12-
IF (ITPP_FOUND)
13-
IF (NOT ITPP_FIND_QUIETLY)
14-
MESSAGE (STATUS "Found ITPP: ${ITPP_LIBRARY}")
15-
ENDIF (NOT ITPP_FIND_QUIETLY)
16-
ELSE (ITPP_FOUND_FOUND)
17-
IF (ITPP_FIND_REQUIRED)
18-
MESSAGE (FATAL_ERROR "Could not find ITPP")
19-
ENDIF (ITPP_FIND_REQUIRED)
20-
ENDIF (ITPP_FOUND)
14+
include(FindPackageHandleStandardArgs)
15+
find_package_handle_standard_args(ITPP DEFAULT_MSG ITPP_LIBRARY ITPP_INCLUDE_DIR)

cmake/FindLibMbe.cmake

Lines changed: 0 additions & 20 deletions
This file was deleted.

cmake/FindLibSndFile.cmake

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
# Find libsndfile
1+
# - Try to find Libsndfile
2+
# Once done this will define
3+
#
4+
# LIBSNDFILE_FOUND - System has LIBSNDFILE
5+
# LIBSNDFILE_INCLUDE_DIR - The SNDFILE include directory
6+
# LIBSNDFILE_LIBRARY - The library needed to use SNDFILE
7+
#
28

3-
FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h)
9+
find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h)
410

511
SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile)
6-
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES} PATH)
12+
FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES})
713

8-
IF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)
9-
SET(LIBSNDFILE_FOUND TRUE)
10-
ENDIF (LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)
11-
12-
IF (LIBSNDFILE_FOUND)
13-
IF (NOT LibSndFile_FIND_QUIETLY)
14-
MESSAGE (STATUS "Found LibSndFile: ${LIBSNDFILE_LIBRARY}")
15-
ENDIF (NOT LibSndFile_FIND_QUIETLY)
16-
ELSE (LIBSNDFILE_FOUND)
17-
IF (LibSndFile_FIND_REQUIRED)
18-
MESSAGE (FATAL_ERROR "Could not find sndfile")
19-
ENDIF (LibSndFile_FIND_REQUIRED)
20-
ENDIF (LIBSNDFILE_FOUND)
14+
include(FindPackageHandleStandardArgs)
15+
find_package_handle_standard_args(LIBSNDFILE DEFAULT_MSG LIBSNDFILE_LIBRARY
16+
LIBSNDFILE_INCLUDE_DIR)

cmake/FindMBE.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# - Try to find MBE
2+
# Once done this will define
3+
#
4+
# MBE_FOUND - System has MBE
5+
# MBE_INCLUDE_DIR - The MBE include directory
6+
# MBE_LIBRARY - The library needed to use MBE
7+
#
8+
9+
find_path(MBE_INCLUDE_DIR mbelib.h)
10+
11+
set(MBE_NAMES ${MBE_NAMES} mbe libmbe)
12+
find_library(MBE_LIBRARY NAMES ${MBE_NAMES})
13+
14+
include(FindPackageHandleStandardArgs)
15+
find_package_handle_standard_args(MBE DEFAULT_MSG MBE_LIBRARY MBE_INCLUDE_DIR)

0 commit comments

Comments
 (0)