mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
41 lines
797 B
CMake
41 lines
797 B
CMake
cmake_minimum_required(VERSION 2.8)
|
|
|
|
# Set the project name
|
|
project (boost_unit_test)
|
|
|
|
|
|
# find a boost install with the libraries unit_test_framework
|
|
find_package(Boost 1.49.1 REQUIRED COMPONENTS unit_test_framework)
|
|
|
|
set (SOURCES
|
|
Reverse.cpp
|
|
Palindrome.cpp
|
|
)
|
|
|
|
include_directories(
|
|
${Boost_INCLUDE_DIRS}
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
|
|
# Add an library for the example classes
|
|
add_library(example_boost_unit_test ${SOURCES})
|
|
|
|
|
|
#############################################
|
|
# Unit tests
|
|
|
|
# enable CTest testing
|
|
enable_testing()
|
|
|
|
# Add a testing executable
|
|
add_executable(unit_tests unit_tests.cpp)
|
|
|
|
target_link_libraries(unit_tests
|
|
example_boost_unit_test
|
|
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
|
)
|
|
|
|
add_definitions (-DBOOST_TEST_DYN_LINK)
|
|
|
|
add_test(test_all unit_tests)
|