CMakeLists.txt 1.64 KB
Newer Older
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
1 2 3 4
project(medialibrary)

cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
5
include(cpp11)
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

# Fetch gtest
ExternalProject_Add(
    gtest-dependency
    SVN_REPOSITORY http://googletest.googlecode.com/svn/trunk/
    TIMEOUT 10
    # Disable install step
    INSTALL_COMMAND ""
    UPDATE_COMMAND ""
    # Wrap download, configure and build steps in a script to log output
    LOG_DOWNLOAD ON
    LOG_CONFIGURE ON
    LOG_BUILD ON
)

ExternalProject_Get_Property(gtest-dependency source_dir)
include_directories(${source_dir}/include)
# Also link with gtest:
# fetch the directory which contains the built libraries (gtest & gtest_main)
ExternalProject_Get_Property(gtest-dependency binary_dir)
link_directories(${binary_dir})

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
28
EnableCpp11()
29 30
add_definitions("-Wall -Wextra -pedantic")

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
31
include_directories(${CMAKE_SOURCE_DIR}/include)
32
include_directories(${CMAKE_SOURCE_DIR}/src)
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
33
include_directories(${LIBVLC_INCLUDE_DIR})
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
34 35

list(APPEND TEST_SRCS
36 37
    Files.cpp
    Labels.cpp
38
    Albums.cpp
39
    Tests.cpp
40
    Shows.cpp
41
    Movies.cpp
42
    VideoTracks.cpp
43
    AudioTracks.cpp
44
    VLCMetadataServices.cpp
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
45 46 47 48 49 50 51 52 53 54 55
)

add_executable(unittest ${TEST_SRCS})
add_dependencies(unittest gtest-dependency)

target_link_libraries(unittest medialibrary)
target_link_libraries(unittest gtest gtest_main)
# Also add pthread, as gtest requires it
if(UNIX)
    target_link_libraries(unittest "pthread")
endif()
56 57 58

## Download files for parsing unit tests
file(DOWNLOAD "http://streams.videolan.org/streams/mp3/05-Mr.%20Zebra.mp3" "${CMAKE_CURRENT_BINARY_DIR}/mr-zebra.mp3")
59
file(DOWNLOAD "http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4" "${CMAKE_CURRENT_BINARY_DIR}/mrmssmith.mp4")