# ------------------------------------------------------------------- # tests # ------------------------------------------------------------------- # tell in which directory to find 'FindCppUnit.cmake' set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) # tell to find the package to later integrate it find_package( CppUnit REQUIRED ) # tell where to find include directories # - user defined # - and cppunit includes include_directories( src/${VERSION} ${CPPUNIT_INCLUDE_DIR} ) # add CppUnit list( APPEND UnitTestLibs ${CPPUNIT_LIBRARY} ) #Include the "unit-tests" directory include_directories("tst") #Find all source files in unit test file( GLOB_RECURSE UNIT_TEST "tst/*.cpp" ) # for each source file tell to produce some binary # and link with cppunit foreach(a_file ${UNIT_TEST}) get_filename_component( a_target ${a_file} NAME_WE ) project(${a_target}) set( CMAKE_BUILD_TYPE release ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -ftree-vectorize -msse2 -std=c++11" ) add_executable( ${a_target} ${a_file} ) target_link_libraries( ${a_target} ${UnitTestLibs} base maths ) endforeach(a_file ${UNIT_TEST})