From f177e9c235bdc76a347fcef13ecb6cd982c2cbae Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 19 Apr 2017 22:47:40 +0900 Subject: [PATCH] add CMakeLists --- .gitignore | 4 +--- CMakeLists.txt | 8 ++++++++ tests/CMakeLists.txt | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 tests/CMakeLists.txt diff --git a/.gitignore b/.gitignore index dd7a7c5..a007fea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -*.out -callgrind.out.* -Makefile +build/* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d3c3475 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8) +enable_testing() +project(toml11) + +include_directories(${PROJECT_SOURCE_DIR}) +add_definitions(-std=c++11) + +add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..c1e0a18 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,20 @@ +set(TEST_NAMES + test_traits +# test_value + ) + +add_definitions("-Wall -Wpedantic") + +set(test_library_dependencies) +find_library(BOOST_UNITTEST_FRAMEWORK_LIBRARY boost_unit_test_framework) +if (BOOST_UNITTEST_FRAMEWORK_LIBRARY) + add_definitions(-DBOOST_TEST_DYN_LINK) + add_definitions(-DUNITTEST_FRAMEWORK_LIBRARY_EXIST) + set(test_library_dependencies boost_unit_test_framework) +endif() + +foreach(TEST_NAME ${TEST_NAMES}) + add_executable(${TEST_NAME} ${TEST_NAME}.cpp) + target_link_libraries(${TEST_NAME} ${test_library_dependencies}) + add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) +endforeach(TEST_NAME)