add a test for the find script on the build directory

This commit is contained in:
Mario Werner 2016-01-31 00:02:49 +01:00
parent 4aeeb49d23
commit 00fda9b25a
3 changed files with 30 additions and 0 deletions

View File

@ -112,3 +112,12 @@ add_test(compile-test ${CMAKE_CTEST_COMMAND}
"${CMAKE_CURRENT_BINARY_DIR}/compile-test"
--build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM})
# test if the targets are findable from the build directory
add_test(find-package-test ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMAKE_CURRENT_SOURCE_DIR}/find-package-test"
"${CMAKE_CURRENT_BINARY_DIR}/find-package-test"
--build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options "-Dcppformat_DIR=${PROJECT_BINARY_DIR}")

View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 2.8.12)
project(cppformat-test)
find_package(cppformat REQUIRED)
add_executable(library-test "main.cpp")
target_link_libraries(library-test cppformat)
if (TARGET cppformat-header-only)
add_executable(header-only-test "main.cpp")
target_link_libraries(header-only-test cppformat-header-only)
endif ()

View File

@ -0,0 +1,8 @@
#include <cppformat/format.h>
int main(int argc, char** argv)
{
for(int i = 0; i < argc; ++i)
fmt::print("{}: {}\n", i, argv[i]);
return 0;
}