add a test for the find script on the build directory
This commit is contained in:
parent
4aeeb49d23
commit
00fda9b25a
@ -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}")
|
13
test/find-package-test/CMakeLists.txt
Normal file
13
test/find-package-test/CMakeLists.txt
Normal 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 ()
|
8
test/find-package-test/main.cpp
Normal file
8
test/find-package-test/main.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user