Mercurial > dedupe
view CMakeLists.txt @ 71:88f408092b6d
Support for code coverage analysis with gcov.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 31 Jan 2013 16:15:39 +0100 |
| parents | c2ad34480216 |
| children | b4185273c14a |
line wrap: on
line source
PROJECT(DeDupe) CMAKE_MINIMUM_REQUIRED(VERSION 2.6.4) #INCLUDE(PrecompiledHeader.cmake) OPTION(COVERAGE "Enable code coverage analysis" OFF) IF(COVERAGE) SET(COVERAGE_FLAGS "--coverage") ENDIF() MACRO(NEW_TEST file) ADD_EXECUTABLE(${file} ${file}.cpp ${TEST_SOURCES}) ADD_TEST(${file} ${file}) TARGET_LINK_LIBRARIES(${file} ${QT_LIBRARIES} ${Boost_LIBRARIES} ${COVERAGE_FLAGS}) ENDMACRO() SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake_Modules/") SET(USE_HEADERS_FOR_BOOST_TEST OFF) SET(Boost_USE_MULTITHREADED ON) SET(Boost_USE_STATIC_RUNTIME OFF) IF(USE_HEADERS_FOR_BOOST_TEST) SET(Boost_USE_STATIC_LIBS OFF) FIND_PACKAGE(Boost COMPONENTS filesystem system) ADD_DEFINITIONS( "-DBOOSTTEST_HEADER_INCLUDE" ) ELSE() SET(Boost_USE_STATIC_LIBS ON) FIND_PACKAGE(Boost COMPONENTS filesystem system test_exec_monitor) ENDIF() IF (Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) ADD_DEFINITIONS( "-DHAS_BOOST" ) ENDIF() FIND_PACKAGE(Qt4 COMPONENTS QtOpenGL QtXml QtSql REQUIRED) FIND_PACKAGE(Sqlite3 REQUIRED) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}) SET(CLASS_SOURCES BitArray.cpp BitDecoder.cpp ConfigurationProcessing.cpp DataController.cpp EditDistance.cpp Exception/IOException.cpp Exception/SQLException.cpp FastBitDecoder.cpp FileDBLink.cpp HuffmanSet.cpp HuffmanString.cpp MemoryDBLink.cpp SqliteDBLink.cpp UniqueString.cpp ) SET(CLASS_HEADERS BitArray.hpp BitDecoder.hpp ConfigurationProcessing.hpp DataController.hpp EditDistance.hpp Exception/IOException.hpp FastBitDecoder.hpp FileDBLink.hpp MemoryDBLink.hpp RBTree.hpp SqliteDBLink.hpp UniqueString.hpp ) SET(MOC_HEADERS DataController.hpp ) # Returns the moc_xxx.cpp files in the foo_MOC_SRCS variable QT4_WRAP_CPP(MOC_SOURCES ${MOC_HEADERS}) SET(SOURCES ${CLASS_HEADERS} ${CLASS_SOURCES} ${MOC_SOURCES} ) SET(TEST_SOURCES ${CLASS_SOURCES} ${MOC_SOURCES} TestFramework.cpp ) ADD_DEFINITIONS("-Wall -Werror") #Quiet clang, ccache combination IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ADD_DEFINITIONS("-Qunused-arguments") ENDIF() #Quiet some warnings in headers ADD_DEFINITIONS("-Wno-self-assign") ADD_DEFINITIONS("-Wno-unused-function") ADD_DEFINITIONS("-Wno-unused-variable") #Optimization level #ADD_DEFINITIONS("-O3") ADD_DEFINITIONS("-g2 -fno-inline") ADD_DEFINITIONS(${COVERAGE_FLAGS}) SET(CMAKE_EXE_LINKER_FLAGS "${COVERAGE_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") ADD_EXECUTABLE(DeDupe Apps/DeDupe.cpp ${SOURCES} ${MOC_SOURCES}) TARGET_LINK_LIBRARIES( DeDupe ${QT_LIBRARIES} ${SQLITE3_LIBRARIES} ${Boost_LIBRARIES} ) ADD_EXECUTABLE( updateDeDupe Apps/updateDeDupe.cpp ${SOURCES} ${MOC_SOURCES} ) TARGET_LINK_LIBRARIES( updateDeDupe ${QT_LIBRARIES} ${SQLITE3_LIBRARIES} ${Boost_LIBRARIES} ) ENABLE_TESTING() NEW_TEST(TestBitArray) NEW_TEST(TestBitDecoder) NEW_TEST(TestDBCache) NEW_TEST(TestEditDistance) NEW_TEST(TestFastBitDecoder) NEW_TEST(TestHuffmanString) NEW_TEST(TestRBTree) NEW_TEST(TestSqliteDBLink) #ADD_PRECOMPILED_HEADER(TestEditDistance TestFramework.hpp)
